slv.inversion.sweep.collect_metrics#

slv.inversion.sweep.collect_metrics(post, config, swept_params=None)[source]#

Extract goodness-of-fit and flux metrics from a solved inversion.

The primary target metric is reduced_chi2 — ideally close to 1.0, which indicates the error covariances are well-specified.

The prior_conc_* and posterior_conc_* columns summarize the residual observed concentration - modeled concentration (the model is H x + background) with its root mean square (*_rmse) and mean (*_bias, positive when the model is below the observations), in the units of the observations. R2 is fips’s Posterior.r2, the R² of the enhancement: corr(obs - background, H x_hat)².

Parameters:
  • post (Posterior) – The posterior the pipeline returned (run()).

  • config (InversionConfig) – InversionConfig used for this run.

  • swept_params (list[str] | None) – Config field names to capture as cfg_* columns in the output row. If None, all non-scientific fields are excluded and the rest included.

Return type:

Flat dict ready to append as a row to the results CSV.