snr_linear_fit¶
Estimate SNR from the scatter around a linear fit of a continuum region.
| Category | Quality / SNR |
| Backend | numpy - implemented here on top of numpy primitives |
| Version | 1.0.1 |
| Reads | ctx.spectrum (a Spectrum1D) |
| Writes | metrics.snr_linear_fit |
SNR = median(flux) / std(flux − linear fit) over the window. Non-finite samples (NaN/inf) are masked before the fit and excluded from the statistics ; the brick fails when fewer than 3 finite samples remain. Returns inf when the residuals have zero scatter.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
wavelength_min |
None |
- | Lower bound of the continuum window (Å); null uses the start. |
wavelength_max |
None |
- | Upper bound of the continuum window (Å); null uses the end. |
Use it¶
References¶
- Stoehr et al. 2008, 'DER_SNR: A Simple & General Spectroscopic Signal-to-Noise Measurement Algorithm', ASP Conf. Ser. 394, 505 — the comparison baseline (snr_der) for continuum-window SNR estimators.
- Gray 2005, The Observation and Analysis of Stellar Photospheres, 3rd ed., Cambridge UP — ch. 12, continuum placement and noise estimation in line-free windows.
Related algorithms¶
compare_snr_methods- Run every SNR estimator onctx.spectrumand collect their numbers.snr_der- Derivative-based SNR estimator (DER_SNR, Stoehr et al. 2008).snr_edge- Estimate SNR from the flat, line-free regions at the spectrum's edges.validate_bess_header- Check a FITS header against the BeSS keyword contract.