Skip to content

fit_gaussian_line

Fit a single Gaussian (plus a linear continuum) to one spectral line.

Category Line fitting
Backend scipy - implemented here on top of scipy primitives
Version 1.1.0
Reads ctx.spectrum (a Spectrum1D)
Writes line_fits, metrics.fwhm_angstrom

Equivalent width follows the convention EW > 0 for absorption and EW < 0 for emission. The Gaussian is the right choice for instrument- or thermally-broadened lines.

Parameters

Parameter Default Required Description
line_center_angstrom None yes Approximate line centre in Å (required).
window_angstrom 20.0 - Half-width of the fit window on each side of the line (Å).
label '' - Key under which to store the result; defaults to the rounded centre.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("fit_gaussian_line", ctx, {
    "line_center_angstrom": "<value>",
    "window_angstrom": 20.0,
    "label": ""
})
spectro run fit_gaussian_line --input spectrum.fits \
  --param line_center_angstrom=<value> \
  --param window_angstrom=20.0 \
  --param label=
{
  "tool": "fit_gaussian_line",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "line_center_angstrom": "<value>",
      "window_angstrom": 20.0,
      "label": ""
    }
  }
}

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

References

  • scipy.optimize.curve_fit — Levenberg-Marquardt / Trust Region Reflective
  • compare_line_fits - Fit one spectral line with every profile in turn and pick the best one.
  • equivalent_width - Measure a line's equivalent width without assuming a profile shape.
  • fit_lorentzian_line - Fit a single Lorentzian (plus a linear continuum) to one spectral line.
  • fit_voigt_line - Fit a single Voigt profile (plus a linear continuum) to one spectral line.
  • vr_ratio - Violet/Red intensity ratio of a double-peaked emission line.