kinextract.objective_components

kinextract.objective_components(a: ndarray, st: FitState) dict[source]

Break down the MAP objective into its individual terms.

Re-evaluates the forward model at a and reports the chi2, smoothness penalty, LOSVD normalization penalty, and their sum separately, rather than only the combined scalar returned by objective_map(). Useful for diagnosing whether a fit is dominated by data mismatch or by regularization, e.g. when tuning xlam or investigating a poor fit.

Parameters:
  • a (ndarray) – Trial parameter vector; see evaluate_model_gp() for its layout.

  • st (FitState) – Fit state providing the data, errors, velocity grid, and regularization settings.

Returns:

Dictionary with keys:

"chi2"

The chi-squared term (float).

"smooth"

The LOSVD smoothness penalty term (float).

"wing_shrink"

The wing-shrinkage amplitude penalty term (float); zero unless st.xlam_wing_shrink is set.

"losvd_norm_penalty"

The 0.1 * |sum(b) - 1| normalization penalty term (float).

"total"

Sum of the terms above; equal to the value objective_map() would return for the same a and st.

"smooth_over_chi2"

Ratio of the smoothness penalty to chi2, a quick diagnostic of how strongly regularization is influencing the fit relative to the data (nan if chi2 is zero).

Return type:

dict