kinextract.objective_map
- kinextract.objective_map(a: ndarray, st: FitState) float[source]
Scalar objective function minimised by the MAP LOSVD/template fit.
Evaluates the forward model via
evaluate_model_gp()and combines the chi2 goodness-of-fit with the LOSVD smoothness penalty, an optional wing-shrinkage penalty, and a soft normalization constraint:- objective = chi2 + smoothness_penalty + wing_shrinkage_penalty
0.1 *
|sum(b) - 1|
where
chi2is computed by_compute_chi2()over the good (unmasked, finite, non-clipped) pixels,smoothness_penaltyis the wing-tapered second-derivative roughness penalty on the LOSVD b computed by_compute_smoothness()with regularization strengthst.xlam, andwing_shrinkage_penalty(_compute_wing_shrinkage(), strengthst.xlam_wing_shrink, off by default) is an L2 amplitude penalty active only in the wings – see that function’s docstring for why the roughness penalty alone can leave a non-zero pedestal there. The normalization term softly enforces that the LOSVD histogram integrates to 1 (i.e. represents a normalized probability distribution) without a hard constraint, so the optimizer remains a simple bound- constrained problem solvable by L-BFGS-B. This is the function (or, whenuse_jax_objective=True, its JAX-autodiff counterpart built by_build_jax_objective_value_and_grad()) minimised inkinextract.fitting.- Parameters:
a (ndarray) – Flat trial parameter vector; see
evaluate_model_gp()for its layout.st (FitState) – Fit state providing the data, errors, velocity grid, and regularization settings. Its
ntotcounter (total objective evaluations) andtime_eval_model(cumulative model-evaluation wall time) are incremented as a side effect, for diagnostics.
- Returns:
The scalar objective value to be minimised.
- Return type: