kinextract.write_fitlov_outputs
- kinextract.write_fitlov_outputs(st, a_best: ndarray, outdir: str = '.', prefix: str | None = None) dict[source]
Write the final LOSVD fit results to legacy-format ASCII files.
Evaluates the best-fit model (LOSVD amplitudes, template weights, and continuum) at the optimizer’s solution a_best and writes it out using the exact file layout expected by the legacy Fortran pipeline’s downstream tools (Schwarzschild orbit modeling,
pspecfitplotting), so this package is a drop-in replacement for the original fitting code:{prefix}.fit: recovered LOSVD, one row per velocity bin.{prefix}.temp: fractional weight of each template star/SSP.{prefix}.ascii: per-pixel wavelength, data, model, continuum, template-only spectrum, and a good/bad pixel flag (for plotting).{prefix}.rms: reduced chi-squared and fit-quality summary.
- Parameters:
st (FitState) – Fit state holding the spectrum, template matrix, and LOSVD grid used to evaluate the model.
a_best (ndarray) – Best-fit parameter vector (LOSVD amplitudes, template weights, and any continuum-offset parameters) as returned by the optimizer.
outdir (str, default ".") – Directory to write the output files into; created if it does not exist.
prefix (str, optional) – Filename prefix for the four output files. Defaults to
"fitlov"if not given; typically produced byinfer_output_prefix().
- Returns:
Dictionary with the evaluated model quantities (
"gp","b","w","wfrac","tt","coff","coff2","A"), fit-quality statistics ("chi2_red","chi2_total","nrms"), the continuum array, and a"paths"dict giving the four output file paths.- Return type: