Skip to content

match_lamp_lines

Auto-identify arc-lamp lines against the bundled NIST atlas.

Category Wavelength calibration
Backend scipy - implemented here on top of scipy primitives
Version 1.0.2
Reads -
Writes extras.lamp_identifications, extras.lamp_polynomial_coefficients, metrics.rms_angstrom, metrics.n_matched, metrics.dispersion_a_per_px

Global brute-force seed (linear λ(x) grid scored by atlas-match count) followed by σ-clipped polynomial refinement. The atlas comes from spectro_kernel.algorithms.wavelength_calibration.lamp_atlas (NIST ASD persistent lines for Ne / Ar / NeAr / ThAr). Output goes to ctx.extras[output_key] in the same dict shape wavelength_calibrate_polynomial expects: {'pixel_positions': [...], 'wavelengths_angstrom': [...]}. For night-to-night re-anchoring of an already-identified instrument set-up (IRAF reidentify), use the companion brick reidentify_arc_features — it conserves a stored empirical feature list instead of re-matching the atlas.

Parameters

Parameter Default Required Description
lamp 'NeAr' yes Arc-lamp identifier. One of ('Ar', 'Ne', 'NeAr', 'ThAr').
wave_min None - Lower bound (Å) of the expected spectral domain. Strongly recommended — used to bound the linear-seed grid.
wave_max None - Upper bound (Å) of the expected spectral domain.
dispersion_hint None - Expected dispersion (Å / pixel). Optional but accelerates and constrains the linear seed.
detection_sigma 5.0 - Peak prominence threshold expressed as a multiple of the median-absolute-deviation noise (DER_SNR style).
min_prominence 0.01 - Floor on the prominence as a fraction of peak amplitude (prevents detection_sigma from going to 0 on flat regions).
min_distance_px 5 - Minimum spacing between detected peaks (pixels).
poly_order 3 - Polynomial order of the fitted λ(x).
match_tol_px 2.0 - Maximum residual (pixels) between an observed peak and the nearest atlas line for the match to count.
sigma_clip 3.0 - σ-clip threshold during the polyfit refinement.
max_lines 30 - Cap on the number of detected peaks fed to matching.
source_key 'lamp_spectrum' - ctx.extras key holding the lamp Spectrum1D (pixel axis).
output_key 'lamp_identifications' - ctx.extras key receiving the identifications dict {'pixel_positions': [...], 'wavelengths_angstrom': [...]}.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("match_lamp_lines", ctx, {
    "lamp": "NeAr",
    "wave_min": None,
    "wave_max": None,
    "dispersion_hint": None,
    "detection_sigma": 5.0,
    "min_prominence": 0.01,
    "min_distance_px": 5,
    "poly_order": 3,
    "match_tol_px": 2.0,
    "sigma_clip": 3.0,
    "max_lines": 30,
    "source_key": "lamp_spectrum",
    "output_key": "lamp_identifications"
})
spectro run match_lamp_lines --input spectrum.fits \
  --param lamp=NeAr \
  --param wave_min=none \
  --param wave_max=none \
  --param dispersion_hint=none \
  --param detection_sigma=5.0 \
  --param min_prominence=0.01 \
  --param min_distance_px=5 \
  --param poly_order=3 \
  --param match_tol_px=2.0 \
  --param sigma_clip=3.0 \
  --param max_lines=30 \
  --param source_key=lamp_spectrum \
  --param output_key=lamp_identifications
{
  "tool": "match_lamp_lines",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "lamp": "NeAr",
      "wave_min": null,
      "wave_max": null,
      "dispersion_hint": null,
      "detection_sigma": 5.0,
      "min_prominence": 0.01,
      "min_distance_px": 5,
      "poly_order": 3,
      "match_tol_px": 2.0,
      "sigma_clip": 3.0,
      "max_lines": 30,
      "source_key": "lamp_spectrum",
      "output_key": "lamp_identifications"
    }
  }
}

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

References

  • Tody 1986, SPIE 627, 733 — IRAF Data Reduction and Analysis System.
  • Tody 1993, ASP Conf. Ser. 52, 173 — IRAF identify/autoidentify.
  • Murphy et al. 2007, MNRAS 378, 221 — robust ThAr wavelength solution.
  • Kramida, Ralchenko, Reader & NIST ASD Team — NIST Atomic Spectra Database (Ne I / Ar I / Th-Ar persistent lines), https://physics.nist.gov/asd.