slv.inversion.sweep.SweepResults#

class slv.inversion.sweep.SweepResults(path)[source]#

Wraps sweep_results.csv for post-sweep analysis.

Variables:
  • path (pathlib.Path) – Path to the results CSV.

  • df (pandas.DataFrame) – All completed rows, sorted by chi2_distance (closest to 1 first).

Examples

results = SweepResults("/scratch/my_sweep/sweep_results.csv")

# Best-fitting configs (chi² ∈ [0.9, 1.1])
results.best(tol=0.1)

# Which values of prior_base_std give a stable posterior flux?
results.stability("cfg_prior_base_std")

# Are results more sensitive to prior or MDM params?
results.sensitivity()

# 1-D scatter: chi² vs a single parameter
results.plot_chi2("cfg_prior_base_std")

# 2-D heatmap: chi² over two parameters
results.plot_heatmap("cfg_prior_base_std", "cfg_prior_std_frac")

# Rehydrate best config for a reproduction run
cfg, cls = results.to_config(results.best().iloc[0])

Methods

best([target, tol])

Return rows where |reduced_chi2 - target| < tol, best first.

failed()

Return rows that errored during the sweep.

plot_chi2(param[, ax, target_band])

Scatter plot of reduced chi² vs a swept parameter.

plot_heatmap(param_x, param_y[, metric, ax])

Heatmap of metric over two swept parameters.

plot_sensitivity([metric, ax])

Horizontal bar chart of parameter sensitivity (range of group means).

reload()

Re-read from disk (useful while a sweep is still running).

sensitivity([metric, target])

Rank swept parameters by their effect on metric.

stability(groupby_params[, metric])

Standard deviation of metric grouped by groupby_params.

to_config(row[, pipeline, cache])

Rehydrate an InversionConfig from a results row.