Skip to content

fit_emission_lines_gaussian

Measure sub-pixel centroids of several emission lines at once.

Category Wavelength calibration
Backend astropy - wraps the domain-standard astropy implementation
Version 1.0.0
Reads -
Writes extras.emission_line_centroids, metrics.n_lines

Each line is fit in its own window after a cheap argmax recentring step. Fit failures degrade gracefully to the recentred argmax (warning recorded in the result message); the algorithm never raises mid-batch.

Parameters

Parameter Default Required Description
guess_positions [] yes Approximate pixel positions of the lines to fit.
search_width 40.0 - Full width (pixels) of the fit window around each guess (≥ 4).
initial_sigma 5.0 - Starting Gaussian σ (pixels).
source_key 'sky_spectrum' - ctx.extras key of the spectrum to fit; falls back to ctx.spectrum when the key is absent.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("fit_emission_lines_gaussian", ctx, {
    "guess_positions": [],
    "search_width": 40.0,
    "initial_sigma": 5.0,
    "source_key": "sky_spectrum"
})
spectro run fit_emission_lines_gaussian --input spectrum.fits \
  --param guess_positions=[] \
  --param search_width=40.0 \
  --param initial_sigma=5.0 \
  --param source_key=sky_spectrum
{
  "tool": "fit_emission_lines_gaussian",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "guess_positions": [],
      "search_width": 40.0,
      "initial_sigma": 5.0,
      "source_key": "sky_spectrum"
    }
  }
}

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

References

  • Markwardt 2009, ASP Conf. 411, 251 — Levenberg-Marquardt (MINPACK lmdif) algorithm in astronomy.
  • Robitaille et al. 2013, A&A 558, A33 — Astropy.