Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2a1ebcd
Propose minimizer input/output split ADR
AndrewSazonov May 24, 2026
520585a
Address review 1 findings on minimizer input/output split
AndrewSazonov May 24, 2026
93ddcea
Address review 2: demote credible intervals; clarify context table
AndrewSazonov May 24, 2026
e946d2f
Address review 3: fix context list for credible-interval fields
AndrewSazonov May 24, 2026
1ec867d
Reply to review 4: all findings already addressed in earlier replies
AndrewSazonov May 24, 2026
1a0a303
Reply to review 5: both findings already addressed
AndrewSazonov May 24, 2026
8b82af0
Reply to review 6: single finding already addressed in reply 3
AndrewSazonov May 24, 2026
9fdc888
Reply to review 7: clean signoff, no findings
AndrewSazonov May 24, 2026
b686771
Draft minimizer input/output split implementation plan
AndrewSazonov May 24, 2026
731ca20
Address plan review 1: reset paths, defaults, imports, factory
AndrewSazonov May 24, 2026
8471d0e
Address plan review 2: migration map, reset hooks, CIF ordering
AndrewSazonov May 24, 2026
317d901
Address plan review 3: lead P1.11 with no-reordering rule
AndrewSazonov May 24, 2026
5f3491a
Rename FitResult to FitResultBase, add reset hooks
AndrewSazonov May 24, 2026
23e56db
Add LeastSquaresFitResult class
AndrewSazonov May 24, 2026
0f625f7
Add BayesianFitResult class
AndrewSazonov May 24, 2026
fe072fb
Register fit-result family classes with factory
AndrewSazonov May 24, 2026
31a0ca6
Declare paired _fit_result_class on minimizer bases
AndrewSazonov May 24, 2026
090c1e3
Wire fit_result swap and reset paths to paired class
AndrewSazonov May 24, 2026
078c769
Route LSQ result writers to fit_result
AndrewSazonov May 24, 2026
558ec9d
Route Bayesian result writers to fit_result
AndrewSazonov May 24, 2026
1047369
Remove LSQ output descriptors from minimizer base
AndrewSazonov May 24, 2026
d298e5c
Remove Bayesian output descriptors from minimizer base
AndrewSazonov May 24, 2026
451280a
Serialize fit outputs to _fit_result.* tags
AndrewSazonov May 24, 2026
b48cf0a
Confirm fit_result paired instance flows through serializer
AndrewSazonov May 24, 2026
dcc4d1b
Add settings-used block to fit.results display
AndrewSazonov May 24, 2026
5599bc6
Amend affected ADRs for minimizer input/output split
AndrewSazonov May 24, 2026
85494ba
Update tutorials to read outputs from fit_result
AndrewSazonov May 24, 2026
c5da0b0
Remove essdiffraction dependency
AndrewSazonov May 24, 2026
5d5c5b7
Promote minimizer-input-output-split ADR
AndrewSazonov May 24, 2026
46f1eba
Complete Phase 1 minimizer split review gate
AndrewSazonov May 24, 2026
60788b2
Propose IUCr CIF tag alignment for fit outputs
AndrewSazonov May 24, 2026
6e24d62
Add review 4 of input/output split post-Phase 1
AndrewSazonov May 24, 2026
9878c9f
Reply to minimizer input-output review 4
AndrewSazonov May 24, 2026
a2857d9
Complete minimizer input-output Phase 2
AndrewSazonov May 24, 2026
cf7c973
Reply to minimizer input-output review 5
AndrewSazonov May 24, 2026
d5c03b0
Reply to minimizer input-output review 6
AndrewSazonov May 24, 2026
dda94b3
Reply to minimizer input-output review 7
AndrewSazonov May 24, 2026
288178d
Drop minimizer-input-output-split review/reply files
AndrewSazonov May 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions docs/dev/adrs/accepted/analysis-cif-fit-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Analysis-owned fit state needs to persist:
- 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
- minimizer-specific fit outputs on the paired `_fit_result.*` category
- per-parameter posterior summaries on `_fit_parameter`
- large posterior arrays and plot caches in `analysis/results.h5`

Expand All @@ -47,8 +47,7 @@ Persist analysis-owned fit state as explicit analysis categories in

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.*`.
`_fit_result`, `_fit_parameter`, and `_fit_parameter_correlation`.

### Common fit-state categories

Expand Down Expand Up @@ -77,7 +76,8 @@ pre-fit scalar snapshots:
- `posterior_gelman_rubin`
- `posterior_effective_sample_size_bulk`

`_fit_result` stores the latest saved fit header:
`_fit_result` stores the latest saved fit header and scalar
family-specific fit outputs:

- `result_kind`
- `success`
Expand All @@ -92,9 +92,9 @@ pairs are stored.

### Minimizer fit projection

The active `_minimizer.*` category stores both user-selected solver
inputs and fit-filled outputs. Deterministic minimizer classes store
compact fit output counts:
The active `_minimizer.*` category stores user-selected solver inputs
only. Scalar outputs are written to the paired `_fit_result.*` category.
Deterministic fit-result classes add compact fit output counts:

- `objective_name`
- `objective_value`
Expand All @@ -104,17 +104,14 @@ compact fit output counts:
- `degrees_of_freedom`
- `covariance_available`
- `correlation_available`
- `runtime_seconds`
- `iterations_performed`
- `exit_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:
Bayesian minimizer classes store sampler inputs under `_minimizer.*`:

- `sampling_steps`
- `burn_in_steps`
Expand All @@ -123,7 +120,9 @@ Bayesian minimizer classes store sampler inputs and fit outputs under
- `parallel_workers`
- `initialization_method`
- `random_seed`
- `runtime_seconds`

Bayesian fit-result classes store scalar outputs under `_fit_result.*`:

- `point_estimate_name`
- `sampler_completed`
- `credible_interval_inner`
Expand Down Expand Up @@ -170,10 +169,10 @@ posterior displays.
Load order is:

1. standard analysis configuration
2. common fit-state categories
3. `_minimizer.*` fit-output fields according to the active
`_minimizer.type`
4. posterior sidecar arrays when a Bayesian result is expected
2. `_minimizer.*` settings according to the active `_minimizer.type`
3. common and family-specific `_fit_result.*` fields on the paired class
4. `_fit_parameter` and `_fit_parameter_correlation`
5. posterior sidecar arrays when a Bayesian result is expected

Persist backend runtime objects, optimizer instances, and raw driver
payloads nowhere in this design.
Expand Down
6 changes: 6 additions & 0 deletions docs/dev/adrs/accepted/display-ux.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ Use these naming rules:
path for `versus`.
- `posterior.*` names are used only when posterior samples are required.

`project.display.fit.results()` also prints a "Settings used" block
above the result tables. The block is sourced from
`analysis.minimizer.*` so the minimizer inputs and paired
`analysis.fit_result.*` outputs are visible from the accepted display
facade without adding a new `Analysis`-level display method.

## Rejected Alternatives

Flat display facade:
Expand Down
41 changes: 23 additions & 18 deletions docs/dev/adrs/accepted/minimizer-category-consolidation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,34 @@ samplers.

## Decision

### 1. Unified `minimizer` category replaces all sampler-input and fit-result categories
### 1. Unified `minimizer` category replaces sampler-input categories

Introduce a single switchable category `minimizer` on `Analysis`. Its
concrete class is determined by `Analysis.minimizer_type`. The category
holds both user-writable inputs and fit-filled outputs in one place.
now holds user-writable minimizer inputs only. The later
[`minimizer-input-output-split.md`](minimizer-input-output-split.md) ADR
reverses the fit-output half of this rule: scalar fit outputs live on
the paired `fit_result` category instead of on `minimizer`.

The following categories are removed:

- `bayesian_sampler` — fields move into the Bayesian concrete classes of
`minimizer`.
- `bayesian_result`, `bayesian_convergence` — fields move into the
Bayesian concrete classes of `minimizer` (`runtime_seconds`,
Bayesian concrete classes of `fit_result` (`fitting_time`,
`acceptance_rate_mean`, `gelman_rubin_max`,
`effective_sample_size_min`, `best_log_posterior`, …).
- `deterministic_result` — fields move into the deterministic concrete
classes of `minimizer` (`runtime_seconds`, `iterations_performed`,
`exit_reason`, …).
classes of `fit_result` (`fitting_time`, `iterations`,
`objective_value`, `exit_reason`, …).
- `bayesian_parameter_posterior` — replaced by `Parameter.posterior`
(see §3).
- `bayesian_distribution_cache`, `bayesian_pair_cache`,
`bayesian_predictive_dataset` — replaced by HDF5 sidecar (see §4).

`fit_result` and `fit_parameter` (analysis-owned bounds, success flag,
reduced chi-square, message, fit time, iterations) remain unchanged as
fit-mode-agnostic header categories.
`fit_parameter` (analysis-owned bounds) remains a fit-state category.
`fit_result` remains the common fit header category and is extended by
the input/output split ADR with family-specific scalar outputs.

### 2. Selectors move to the `Analysis` owner

Expand Down Expand Up @@ -388,10 +391,11 @@ category's class-level `_engine_metadata` dict.

### Trade-offs

- `minimizer` is the first category that mixes writable user inputs and
writable fit-filled outputs in the same scope. This is a small new
convention but is the natural generalization of how `Parameter`
already holds both user input and refined value on the same object.
- `minimizer` no longer mixes writable user inputs and fit-filled
outputs in the same scope. That stricter boundary is recorded by
[`minimizer-input-output-split.md`](minimizer-input-output-split.md);
`Parameter` remains the refinement-in-place precedent for model values
rather than minimizer diagnostics.
- The set of `_minimizer.*` tags present in CIF depends on the active
`_fitting.minimizer_type`. Loading a CIF whose tags don't match the
minimizer's allowed set raises (clear validation, not silent
Expand Down Expand Up @@ -461,9 +465,10 @@ category count for each new sampler and entrenches the convention break.

### D. Strict input-only `minimizer` plus a separate `fit_result`

Keep the categories single-concept (inputs xor outputs) at the cost of
two-place lookup for related info. Rejected in favour of the
one-category-mixes-both shape (§1, §"Trade-offs") because the existing
`Parameter` model already mixes input and refined value on the same
object, and one-place discoverability is more valuable than strict
purity.
Originally rejected in favour of the one-category-mixes-both shape (§1,
§"Trade-offs"). Reversed by
[`minimizer-input-output-split.md`](minimizer-input-output-split.md)
after implementation showed the `Parameter` analogy does not hold for
minimizer settings versus fit diagnostics. The current design keeps
`minimizer` input-only and moves scalar fit outputs to the paired
`fit_result` category.
Loading
Loading