Skip to content

measure_line_offsets

Measured − reference wavelength of known emission lines, never applied.

Category Quality / SNR
Backend scipy - implemented here on top of scipy primitives
Version 1.0.0
Reads ctx.spectrum (a Spectrum1D)
Writes metrics.n_lines_detected, metrics.mean_offset_angstrom, metrics.line_<λ>_detected, metrics.line_<λ>_snr, metrics.line_<λ>_offset_angstrom

Per reference line (metric prefix line_): _detected (1 or 0), _snr (amplitude / residual rms, 0 when the amplitude is ≤ 0, capped at 1e6) and, when detected, _offset_angstrom = λ_measured − λ_reference. A line is detected when its S/N ≥ min_snr and its fitted centre stays inside the window. A window with fewer than 6 samples, or a fit that does not converge, gives _detected = 0 only. Totals: n_lines_detected and, when at least one line is detected, mean_offset_angstrom. Same fit as refine_wavelength_zeropoint, which applies the shift of one line ; this brick only measures. Fails on a pixel axis or when meta['needs_wavelength_calibration'] is set. Which lines to measure is the caller's choice: reference_wavelengths has no default.

Parameters

Parameter Default Required Description
reference_wavelengths None yes Catalogue wavelengths (Å, same convention as the axis) of the lines to locate; non-empty list. Required.
search_halfwidth_angstrom 15.0 - Half-width (Å) of the fit window around each line.
min_snr 5.0 - Minimum amplitude / residual rms for a line to count as detected.
initial_sigma_angstrom 4.0 - Seed of the Gaussian width (Å) for each fit.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("measure_line_offsets", ctx, {
    "reference_wavelengths": "<value>",
    "search_halfwidth_angstrom": 15.0,
    "min_snr": 5.0,
    "initial_sigma_angstrom": 4.0
})
spectro run measure_line_offsets --input spectrum.fits \
  --param reference_wavelengths=<value> \
  --param search_halfwidth_angstrom=15.0 \
  --param min_snr=5.0 \
  --param initial_sigma_angstrom=4.0
{
  "tool": "measure_line_offsets",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "reference_wavelengths": "<value>",
      "search_halfwidth_angstrom": 15.0,
      "min_snr": 5.0,
      "initial_sigma_angstrom": 4.0
    }
  }
}

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

References

  • Osterbrock, Fulbright, Martel, Keane, Trager & Basri 1996, PASP 108, 277, DOI 10.1086/133722 — night-sky emission lines as wavelength standards.
  • Osterbrock, Fulbright & Bida 1997, PASP 109, 614, DOI 10.1086/133920 — night-sky OH line atlas II.
  • compare_snr_methods - Run every SNR estimator on ctx.spectrum and collect their numbers.
  • measure_resolving_power - Resolving power R = λ/FWHM from Gaussian fits of the strongest isolated lamp / sky lines.
  • 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.