smooth_savgol¶
Smooth a spectrum with a Savitzky-Golay filter.
| Category | Smoothing |
| Backend | scipy - implemented here on top of scipy primitives |
| Version | 1.0.1 |
| Reads | ctx.spectrum (a Spectrum1D) |
| Writes | spectrum |
Non-finite samples (NaN/inf) are bridged by linear interpolation over the finite neighbours before filtering, so a bad pixel neither raises nor smears ; the original non-finite positions are restored to NaN in the output (finite inputs are processed bit-identically to v1.0.0). The uncertainty array is copied unchanged, i.e. it is an overestimate after smoothing (the filter reduces the noise) ; propagating it is a contract change left for a future major release.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
window |
11 |
- | Sliding-window length in samples (odd; coerced up to the next odd). |
polyorder |
3 |
- | Polynomial order fitted within each window (< window). |
Use it¶
References¶
- Savitzky & Golay 1964, Analytical Chemistry 36, 1627
- scipy.signal.savgol_filter
Related algorithms¶
compare_smoothings- Run every smoothing kernel onctx.spectrumand collect the results.smooth_gaussian- Smooth a spectrum by convolution with a Gaussian kernel.