Skip to content

measure_resolving_power

Resolving power R = λ/FWHM from Gaussian fits of the strongest isolated lamp / sky lines.

Category Quality / SNR
Backend scipy - implemented here on top of scipy primitives
Version 2.0.0
Reads ctx.spectrum (a Spectrum1D)
Writes metrics.resolving_power_median, metrics.resolving_power_std, metrics.instrumental_fwhm_aa_median, metrics.instrumental_fwhm_kms_median, metrics.n_lines_used, extras.resolving_power_lines

R_i = λ_i / FWHM_i for each of the n_lines most prominent emission peaks (scipy.signal.find_peaks with height and prominence above prominence_sigma × 1.4826·MAD of the residual after a continuum_window running median) that have no other detection within min_separation_aa (both members of a closer pair are dropped) ; each peak is fitted with a Gaussian + linear pedestal in ± window_aa (lines/_profiles.fit_line, as fit_gaussian_line) and kept when its FWHM lies in (1 pixel, window_aa), its centre within window_aa/2 of the detection and its amplitude above the threshold. resolving_power_median / _std summarise the per-line values, instrumental_fwhm_aa_median is the median fitted FWHM and instrumental_fwhm_kms_median the median of c·FWHM_i/λ_i. Per-line results (wavelength, fwhm, R, amplitude, prominence) are in extras['resolving_power_lines']. Use on an arc lamp or a sky spectrum whose lines are intrinsically unresolved ; blends bias R low (raise min_separation_aa). The Gaussian approximation reads a few per cent low on boxy fibre profiles. On a dense forest raise continuum_window so the running median stays on the pedestal. Fails when no peak is detected, when no detection is isolated, or when every fit is rejected. v2.0.0: masked samples (Spectrum1D.mask) are dropped like non-finite ones before detection and fitting.

Parameters

Parameter Default Required Description
n_lines 10 - Maximum number of strongest isolated lines to fit.
min_separation_aa 5.0 - Minimum distance (Å) to any other detection for a line to count as isolated ; both members of a closer pair are dropped.
window_aa 3.0 - Half-width (Å) of the Gaussian fit window around each line.
prominence_sigma 5.0 - Peak prominence threshold in units of the MAD noise.
continuum_window 101 - Running-median window (samples, odd ≥ 3) used to remove the pedestal before peak detection.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("measure_resolving_power", ctx, {
    "n_lines": 10,
    "min_separation_aa": 5.0,
    "window_aa": 3.0,
    "prominence_sigma": 5.0,
    "continuum_window": 101
})
spectro run measure_resolving_power --input spectrum.fits \
  --param n_lines=10 \
  --param min_separation_aa=5.0 \
  --param window_aa=3.0 \
  --param prominence_sigma=5.0 \
  --param continuum_window=101
{
  "tool": "measure_resolving_power",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "n_lines": 10,
      "min_separation_aa": 5.0,
      "window_aa": 3.0,
      "prominence_sigma": 5.0,
      "continuum_window": 101
    }
  }
}

Every algorithm is an MCP tool of the same name; describe_algorithm returns this page's metadata as JSON.

References

  • Gray 2005, The Observation and Analysis of Stellar Photospheres, 3rd ed., Cambridge UP — ch. 3 and ch. 12 : R = λ/Δλ with Δλ the FWHM of the instrumental profile.
  • Tody 1986, Proc. SPIE 627, 733 — IRAF splot Gaussian line measurement (the per-line fit).
  • compare_snr_methods - Run every SNR estimator on ctx.spectrum and 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.
  • snr_linear_fit - Estimate SNR from the scatter around a linear fit of a continuum region.
  • validate_bess_header - Check a FITS header against the BeSS keyword contract.