kinextract.run_joint_fit

kinextract.run_joint_fit(st: FitState, cfg, write_outputs: bool = False, outdir: str = '.', prefix: str | None = None) dict[source]

Run the joint fit and package results in the same shape as kinextract.fitting.run_spectral_fit()’s "outputs" dict.

This is the entry point kinextract.fitting.run_spectral_fit() dispatches to whenever cfg.fit_continuum=True or cfg.joint_prenorm=True. Whether a continuum is actually co-fit is controlled by cfg.fit_continuum: if True, a free P-spline continuum is co-fit; if False (the pre-normalized-mode convention), the continuum is fixed at 1.0 (see fit_joint()’s fit_continuum parameter) – there is nothing genuine for a free continuum to fit once the data’s own continuum has already been divided out, and the sigl0/v_center/xlam-selection improvements apply identically either way. It reuses the corresponding FitConfig fields with equivalent semantics (cfg.sigl as the initial sigl0 guess, cfg.xlam_auto_grid/xlam_chi2_tolerance/ xlam_max_peaks/xlam_peak_min_prominence for the xlam search, cfg.use_jax_objective, cfg.map_maxiter/map_ftol/ map_maxfun) plus the joint_*-prefixed fields for concepts that have no shipped-pipeline analogue (P-spline knot count/degree/roughness weight, the sigl0 fixed-point iteration count/tolerance, whether to recenter v_center).

Parameters:
  • st (FitState) – Fit state to optimize (mutated: continuum_mult is set to the recovered P-spline continuum so downstream plotting/ascii output reflects it).

  • cfg (FitConfig) – Run configuration.

  • write_outputs (bool, optional) – If True, write legacy-format output files via kinextract.io.write_fitlov_outputs_from_model().

  • outdir (optional) – Passed through when write_outputs is True.

  • prefix (optional) – Passed through when write_outputs is True.

Returns:

Same keys as the shipped pipeline’s outputs dict ("gp", "b", "w", "wfrac", "tt", "coff", "coff2", "A", "rms", "chi2_red", "chi2_total", "nrms", "continuum", "paths"), with "coff"=0.0, "coff2"=0.0, "A"=1.0 as neutral placeholders (the joint model has no analogous parameters – its continuum is the P-spline baked directly into "gp"/"continuum"), plus "result", "design", "best_xlam", and "sigl0_trace" for the joint fit’s own diagnostics.

Return type:

dict