kinextract.plot_continuum

kinextract.plot_continuum(fit: dict, cfg=None, mark_prominent_lines: bool = True) None[source]

Diagnostic plot for a continuum-cofit fit (kinextract.joint).

Produces a three-panel figure for fits run with cfg.fit_continuum = True: the top panel shows the observed spectrum, the full best-fit model, and the fitted continuum baseline, with shaded spans marking detected-emission pixel regions and labeled reference lines; the middle panel shows the same data and model divided by the continuum (continuum-normalized view, useful for judging line depths independent of the baseline shape); the bottom panel shows fractional residuals (data - model) / model. Individual rejected pixels (masked for reasons other than detected emission, e.g. bad regions, template coverage gaps, or sigma-clipping) are overplotted as translucent red points in all three panels. If fit["state"] was not run in continuum-cofit mode, this function prints a notice and returns without plotting.

Parameters:
  • fit (dict) – Output of run_spectral_fit(). Must contain fit["state"], fit["outputs"]["gp"] (model spectrum), and fit["outputs"]["continuum"] (fitted continuum baseline).

  • cfg (FitConfig, optional) – When supplied, the plot additionally overlays masked regions and line labels for detected emission lines. Labels are drawn ONLY for lines whose pixels are actually masked, so labeling is always consistent with the shaded regions shown. If omitted, only the curated prominent-line reference ticks (see mark_prominent_lines) are drawn.

  • mark_prominent_lines (bool, optional) – When True (default), draw thin gray reference ticks and labels for the curated list of strongest stellar/nebular lines (PROMINENT_STELLAR_LINES) that fall within the fit wavelength window, regardless of masking status.

Returns:

Displays the figure via plt.show(); does not return a value.

Return type:

None