kinextract.build_parameter_xscale

kinextract.build_parameter_xscale(st: FitState) ndarray[source]

Build a per-parameter scale vector to precondition the L-BFGS-B fit.

L-BFGS-B (like most quasi-Newton methods) performs best when all parameters have comparable magnitude and sensitivity. The fit vector mixes LOSVD bin heights, template weights, continuum offsets, an optional global amplitude, and an optional polynomial coefficient, which naturally live on very different scales; this function returns a divisor for each parameter so that the optimizer works internally in rescaled units u = a / xscale (see _fit_map_once()), improving convergence without changing the physical solution.

Parameters:

st (FitState) – Fit state describing the parameter layout: number of LOSVD bins (nl), number of templates (nt), continuum-offset mode (icoff), and whether a global amplitude and/or polynomial continuum term are being fit.

Returns:

Scale vector with the same length and ordering as the flat parameter vector a used throughout this module: nl LOSVD scales, nt template-weight scales, continuum-offset scales, an optional amplitude scale, and an optional polynomial-coefficient scale.

Return type:

ndarray