Skip to content

refine_wavelength_zeropoint

Zero-point correction of a calibrated axis from one emission line of the spectrum itself.

Category Wavelength calibration
Backend scipy - implemented here on top of scipy primitives
Version 1.0.0
Reads ctx.spectrum (a Spectrum1D)
Writes spectrum, metrics.applied, metrics.delta_angstrom, metrics.measured_center_angstrom, metrics.fitted_sigma_angstrom, metrics.snr

Pure zero-point shift from a line fitted on ctx.spectrum, on an axis that is already calibrated (the brick fails on a pixel axis or when meta['needs_wavelength_calibration'] is set). Model A·exp(−½((λ−μ)/σ)²) + slope·λ + b, seeded on the window's peak with σ = initial_sigma_angstrom, fitted by scipy.optimize.curve_fit (maxfev 10 000). S/N = A / rms of the fit residuals (1e6 on a noiseless fit). Skips, with applied = 0 and the measured centre, shift and S/N: fewer than 6 samples in the window, a fit that does not converge, A ≤ 0 or S/N < min_snr, a centre outside the window, |Δλ| > max_shift_angstrom (default: the half-width). Applied: wavelength + Δλ with flux, uncertainty and mask untouched, meta zeropoint_refined_on and zeropoint_delta_angstrom. Which line to use is the caller's choice: reference_wavelength has no default. Companions: wavelength_calibration_in_situ refits the dispersion in pixels against a sky spectrum in ctx.extras ; measure_line_offsets reports where several lines land without moving the axis.

Parameters

Parameter Default Required Description
reference_wavelength None yes Catalogue wavelength (Å, same convention as the axis) of the emission line to fit, e.g. 5577.34 for [O I] in air. Required.
search_halfwidth_angstrom 25.0 - Half-width (Å) of the fit window around the reference.
max_shift_angstrom None - Largest |Δλ| the brick applies; null means the search half-width.
min_snr 5.0 - Skip when the fitted amplitude is below this × the residual rms.
initial_sigma_angstrom 4.0 - Seed of the Gaussian width (Å) for the fit.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("refine_wavelength_zeropoint", ctx, {
    "reference_wavelength": "<value>",
    "search_halfwidth_angstrom": 25.0,
    "max_shift_angstrom": None,
    "min_snr": 5.0,
    "initial_sigma_angstrom": 4.0
})
spectro run refine_wavelength_zeropoint --input spectrum.fits \
  --param reference_wavelength=<value> \
  --param search_halfwidth_angstrom=25.0 \
  --param max_shift_angstrom=none \
  --param min_snr=5.0 \
  --param initial_sigma_angstrom=4.0
{
  "tool": "refine_wavelength_zeropoint",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "reference_wavelength": "<value>",
      "search_halfwidth_angstrom": 25.0,
      "max_shift_angstrom": null,
      "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.