Skip to content

LineFit

LineFit fits multiple spectral lines in a single spectrum or a stack and extracts a line-core intensity and line-of-sight (LOS) velocity for each requested line. It is designed for dense, evolving spectral windows, including asymmetric profiles, close pairs, and declared split-core candidates.

from WaLSAlib import LineFit

The default model is an asymmetric Voigt-family profile. A symmetric Voigt model is available as fit_func="voigt". The fit operates on a normalised, smoothed, inverted representation of each spectrum, while the returned core intensity is sampled from the original spectrum.

Method at a glance

  1. Normalise and smooth the spectrum; invert it so absorption cores become peaks.
  2. Seed centres near expected reference wavelengths, optionally using an initial search for line centres and separation of close pairs.
  3. Select a bounded per-line fitting window, with optional adaptive expansion and reversal handling.
  4. Fit a bounded profile and iteratively refine the centre.
  5. Convert the fitted shift to LOS velocity and sample the original intensity at its nearest wavelength bin.

See the fitting workflow, window controls, and output interpretation. The repository example uses the supplied spectral testbed.

Scientific scope

A fitted centre is a profile-based diagnostic relative to your supplied reference wavelength. It is not a spectral inversion or a unique formation-height measurement. Check calibration, blends, morphology, fit bounds, and temporal consistency when using the result as an oscillation signal.

WaLSAlib and LineFit are introduced in Jafarzadeh et al. (2026). The repository's Frontiers notebooks provide the associated worked examples.

Implementation sources

WaLSA_LineFit.py