Accepted current design.
2026-05-18
Analysis and fitting.
analysis/analysis.cif already persists analysis configuration such as
_minimizer.type, _fitting_mode.type, aliases, constraints, and
active fit-mode settings. That configuration alone is not enough to
reopen a saved project and continue the same fit-result, plotting, and
command-line workflow.
Analysis-owned fit state needs to persist:
- fit bounds and bound provenance
- pre-fit scalar snapshots for recovery workflows
- compact status metadata for the latest saved fit projection
- deterministic correlation summaries
- minimizer-specific fit outputs on the active
_minimizer.*category - per-parameter posterior summaries on
_fit_parameter - large posterior arrays and plot caches in
analysis/results.h5
Committed model parameter values and uncertainties already persist in structure and experiment CIF files through the accepted free-flag CIF encoding. Those committed values must remain the source of truth for the current model state.
The accepted runtime fit-results ADR keeps backend runtime objects runtime-only unless a narrower persistence ADR defines a saved projection. This ADR defines that narrower saved projection.
Persist analysis-owned fit state as explicit analysis categories in
analysis/analysis.cif, with large posterior arrays stored in
analysis/results.h5.
Do not add a dedicated _fit_state category or
_fit_state.schema_version. Persisted fit state is detected from
_fit_result, _fit_parameter, _fit_parameter_correlation, and
fit-output fields on _minimizer.*.
Persist these common categories for any saved fit projection:
_fit_parameter_fit_result_fit_parameter_correlation
_fit_parameter stores analysis-owned per-parameter fit controls and
pre-fit scalar snapshots:
param_unique_namefit_minfit_maxfit_bounds_uncertainty_multiplierstart_valuestart_uncertaintyposterior_best_sample_valueposterior_medianposterior_uncertaintyposterior_interval_68_lowposterior_interval_68_highposterior_interval_95_lowposterior_interval_95_highposterior_gelman_rubinposterior_effective_sample_size_bulk
_fit_result stores the latest saved fit header:
result_kindsuccessmessageiterationsfitting_timereduced_chi_square
_fit_parameter_correlation stores pairwise deterministic or posterior
correlation summaries keyed by a persisted id. Only unique parameter
pairs are stored.
The active _minimizer.* category stores both user-selected solver
inputs and fit-filled outputs. Deterministic minimizer classes store
compact fit output counts:
objective_nameobjective_valuen_data_pointsn_parametersn_free_parametersdegrees_of_freedomcovariance_availablecorrelation_availableruntime_secondsiterations_performedexit_reason
Do not persist a _deterministic_parameter_result category. Final
deterministic parameter values and uncertainties already persist in the
model CIF files, and restored deterministic ordering comes from
_fit_parameter.
Bayesian minimizer classes store sampler inputs and fit outputs under
_minimizer.*, including:
sampling_stepsburn_in_stepsthinning_intervalpopulation_sizeparallel_workersinitialization_methodrandom_seedruntime_secondspoint_estimate_namesampler_completedcredible_interval_innercredible_interval_outeracceptance_rate_meangelman_rubin_maxeffective_sample_size_minbest_log_posterior
Bayesian per-parameter posterior summaries are stored on the
corresponding _fit_parameter rows. Their row order defines the saved
posterior parameter order.
FitResults.optimizer_name and FitResults.method_name are restored
from the active minimizer category class instead of being persisted as
independent CIF fields. Each concrete minimizer category declares a
class-level _engine_metadata: ClassVar[dict[str, str]] containing
those two display values. This keeps the persisted projection to the
user-selected _minimizer.type and removes duplicated deterministic
metadata from _minimizer.*.
Persist large posterior arrays in analysis/results.h5 using h5py.
This includes canonical posterior arrays and saved distribution, pair,
and predictive cache arrays. The HDF5 file is self-describing; no CIF
manifest rows or sidecar filename tags are persisted.
The sidecar filename is fixed to results.h5 inside the project
analysis/ directory.
If the sidecar is missing on load, summary rows in
analysis/analysis.cif still restore fit tables and metadata. Features
that require missing bulk arrays must warn clearly instead of failing
silently.
After a fit completes, project save writes the fit-state projection before the project is considered fully persisted. For Bayesian fits, that includes the prepared summaries and saved plot caches used by posterior displays.
Load order is:
- standard analysis configuration
- common fit-state categories
_minimizer.*fit-output fields according to the active_minimizer.type- posterior sidecar arrays when a Bayesian result is expected
Persist backend runtime objects, optimizer instances, and raw driver payloads nowhere in this design.
Saved projects reopen with enough fit-state context to display the last saved result and rerun fits without rebuilding analysis-owned bounds by hand.
Deterministic persistence stays compact because committed parameter values remain in the model CIF files instead of being duplicated in a second deterministic per-parameter result loop.
Bayesian persistence spans CIF metadata and an HDF5 sidecar, so save and
load must validate consistency between _fit_parameter rows and bulk
datasets.
The accepted runtime fit-results ADR should now be read as runtime-only except where this narrower projection explicitly persists fit-state metadata, summaries, and cache arrays.