Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
aea80d3
Draft minimizer category consolidation ADR
AndrewSazonov May 23, 2026
1ba9f2b
Add plans for minimizer consolidation and emcee
AndrewSazonov May 23, 2026
84186f7
Add agent instructions and plan review workflow
AndrewSazonov May 23, 2026
1c33b16
Update minimizer consolidation plan after reviews
AndrewSazonov May 23, 2026
9725852
Move PosteriorParameterSummary to core
AndrewSazonov May 23, 2026
a8af67b
Add Parameter.posterior attribute
AndrewSazonov May 23, 2026
1ae53a7
Add InitializationMethodEnum for samplers
AndrewSazonov May 23, 2026
bfdd503
Add MinimizerCategoryBase
AndrewSazonov May 23, 2026
af238db
Add concrete minimizer category classes
AndrewSazonov May 23, 2026
f3c502d
Resolve CIF '?' to descriptor default on load
AndrewSazonov May 23, 2026
89cf296
Wire minimizer selector on Analysis owner
AndrewSazonov May 23, 2026
d0af603
Serialize minimizer category to _minimizer.* CIF tags
AndrewSazonov May 23, 2026
73cbf3b
Persist parameter posterior via _fit_parameter columns
AndrewSazonov May 23, 2026
5e3355f
Use Analysis.minimizer_type in non-analysis modules
AndrewSazonov May 23, 2026
a324c4c
Overwrite results.h5 on new fit with user warning
AndrewSazonov May 23, 2026
3f72c82
Absorb deterministic_result fields into LSQ minimizers
AndrewSazonov May 23, 2026
e495b33
Read posterior plots from results.h5 groups
AndrewSazonov May 23, 2026
43cd3d7
Remove obsolete Bayesian and fitting categories
AndrewSazonov May 23, 2026
1c23bf8
Update tutorials for analysis.minimizer API
AndrewSazonov May 23, 2026
550fc9a
Promote minimizer-category-consolidation ADR
AndrewSazonov May 23, 2026
e6b593a
Complete Phase 1 review gate
AndrewSazonov May 23, 2026
a05069b
Limit random seed category field to Bayesian minimizers
AndrewSazonov May 23, 2026
ed6e2af
Prune unsupported LSQ minimizer descriptors
AndrewSazonov May 23, 2026
3797103
Address minimizer consolidation review comments
AndrewSazonov May 23, 2026
47d2556
Remove obsolete minimizer category tests
AndrewSazonov May 23, 2026
7babb66
Migrate tests to analysis minimizer selectors
AndrewSazonov May 23, 2026
70fcdfe
Migrate project-load tests to minimizer state
AndrewSazonov May 23, 2026
195a7e4
Assert Bayesian projection sidecar payloads
AndrewSazonov May 23, 2026
71aed40
Rewrite sidecar tests for consolidated results
AndrewSazonov May 23, 2026
80afc6e
Migrate fit-state tests to consolidated categories
AndrewSazonov May 23, 2026
20ba10c
Add minimizer category unit tests
AndrewSazonov May 23, 2026
f3dda76
Update Phase 2 test migration status
AndrewSazonov May 23, 2026
d0ab858
Apply Phase 2 fix and check updates
AndrewSazonov May 23, 2026
f31a6a4
Update Phase 2 unit-test status
AndrewSazonov May 23, 2026
f0f6d81
Stabilize DREAM integration tests
AndrewSazonov May 23, 2026
6d3e5b4
Update Phase 2 script-test status
AndrewSazonov May 23, 2026
7d2c323
Plan Phase-2 follow-ups P2.6-P2.10 from Review 8
AndrewSazonov May 23, 2026
ab488d9
Compare FitResultKindEnum member in _should_use_sidecar
AndrewSazonov May 23, 2026
a81ecb4
Default LSQ result descriptors to None for clean round-trip
AndrewSazonov May 23, 2026
679a9f9
Add reviewer constraint: no tests
AndrewSazonov May 23, 2026
2c79114
Format minimizer-swap warning as removed/added lines
AndrewSazonov May 23, 2026
c134934
Validate Bayesian minimizer matches result_kind on restore
AndrewSazonov May 23, 2026
5e3a63f
Tidy review-8 follow-ups (lint, hoisted F5 guard)
AndrewSazonov May 23, 2026
b468a4c
Reformat review-8 markdown files with prettier
AndrewSazonov May 23, 2026
0af0eb5
Mark P2.10 verification complete
AndrewSazonov May 23, 2026
c023a29
Propose switchable-category-owned-selectors ADR
AndrewSazonov May 23, 2026
3746d41
Exempt review files from formatting pass
AndrewSazonov May 23, 2026
dad690e
Incorporate switchable-category ADR review responses
AndrewSazonov May 23, 2026
2d6dee2
Accept switchable category selector plan
AndrewSazonov May 23, 2026
a356054
Record accepted selector plan reply
AndrewSazonov May 23, 2026
cdecf67
Add SwitchableCategoryBase behavior-only mixin
AndrewSazonov May 23, 2026
b825a07
Support collection-level scalar descriptors
AndrewSazonov May 23, 2026
2749163
Add owner-side switchable hook scaffolding
AndrewSazonov May 23, 2026
d3e9190
Wire analysis.minimizer to category-owned selector
AndrewSazonov May 23, 2026
67364c3
Wire experiment.peak to category-owned selector
AndrewSazonov May 23, 2026
51c0ab7
Wire experiment.background to category-owned selector
AndrewSazonov May 23, 2026
d8ad2a5
Wire experiment.extinction to category-owned selector
AndrewSazonov May 23, 2026
f0456d5
Rename Calculation to Calculator and wire to mixin
AndrewSazonov May 23, 2026
2e46d32
Split Rendering into Chart and Table sibling categories
AndrewSazonov May 23, 2026
ba19b04
Promote fitting_mode to FittingMode category
AndrewSazonov May 23, 2026
119f70e
Drop persisted optimizer_name/method_name; add metadata dict
AndrewSazonov May 23, 2026
8996082
Remove owner-level selector shims and obsolete CIF tags
AndrewSazonov May 23, 2026
ea4b48f
Update tutorials for category-owned selectors
AndrewSazonov May 23, 2026
55f604b
Promote switchable-category-owned-selectors ADR
AndrewSazonov May 23, 2026
e4009a4
Complete Phase 1 review gate
AndrewSazonov May 23, 2026
31f7346
Finalize fit timer before projecting result categories
AndrewSazonov May 24, 2026
9c25077
Migrate tests to category-owned selectors
AndrewSazonov May 24, 2026
dc01633
Run Phase 2 static fixes
AndrewSazonov May 24, 2026
1a67b40
Mark Phase 2 unit tests complete
AndrewSazonov May 24, 2026
4d6b366
Mark Phase 2 integration tests complete
AndrewSazonov May 24, 2026
dc7ac39
Mark Phase 2 script tests complete
AndrewSazonov May 24, 2026
f197149
Collapse owner shadow state onto category descriptors
AndrewSazonov May 24, 2026
400ebc7
Simplify help() tables: drop # column, hide ✗, drop title
AndrewSazonov May 24, 2026
ccb606d
Raise on invalid category.type assignment
AndrewSazonov May 24, 2026
d579123
Validate chart/table types up-front and require parent on from_cif
AndrewSazonov May 24, 2026
4c079e6
Dispatch experiment filter context per switchable category
AndrewSazonov May 24, 2026
9205624
Narrow ed-24 archive normaliser to ID 35 with deletion roadmap
AndrewSazonov May 24, 2026
b786cd1
Delete completed consolidation and selector plan files
AndrewSazonov May 24, 2026
a01269d
Delete obsolete switchable-selector ADR review/reply files
AndrewSazonov May 24, 2026
81f9175
Apply formatting
AndrewSazonov May 24, 2026
56e8fee
Update tests to expect raise on invalid category.type
AndrewSazonov May 24, 2026
1a16396
Adjust help-table tests for simplified row structure
AndrewSazonov May 24, 2026
29baed1
Update pixi dependencies
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
29 changes: 29 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,25 @@
tests, tutorials, docs). Use `git grep -n` because all contributors
have Git; do not assume `rg` is installed. If `git grep` is
unavailable, fall back to `find ... -type f` plus `grep -n`.
- When asked to review a plan, save the review next to that plan using
`<plan-stem>_review-N.md`, where `N` is one greater than the highest
existing review number for that plan. For example,
`docs/dev/plans/background-refactor.md` is reviewed in
`docs/dev/plans/background-refactor_review-1.md`, then
`docs/dev/plans/background-refactor_review-2.md`. A reviewer must not
run tests, `pixi run fix`, `pixi run check`, or any other build or
verification command; reviews are static reads of code, plan, and
documentation only. Note in the review which checks were skipped so
the next implementer knows the gap.
- Writing a review or a reply to a review does **not** require running
any formatter (`prettier`, `pixi run fix`, `ruff format`, …) or any
lint/check/test command on the review/reply file itself or any
surrounding documentation. Review and reply files are markdown-only,
written by hand, and committed as-is. Formatting passes happen later,
during implementation Phase 2 verification — not in the review cycle.
This rule applies to both `_review-N.md` and `_reply-N.md` files
regardless of where they live (`docs/dev/plans/`, `docs/dev/adrs/…/`,
etc.).
- Each change is atomic and single-commit-sized: make one change,
suggest the commit message, then stop and wait for confirmation.
- When in doubt, ask.
Expand Down Expand Up @@ -222,3 +241,13 @@ When asked to create a plan:
understand the benefit. Update it during implementation if extra
approved changes become important enough to mention in the PR title or
description.
- When replying to a plan review, save the reply alongside the review.
Reviews live at `docs/dev/plans/<feature-name>_review-<N>.md`; the
matching reply goes to `docs/dev/plans/<feature-name>_reply-<N>.md`
(same slug, same number, swap `review` → `reply`). One reply file per
review file; do not bundle replies to multiple reviews into one
document. Structure the reply with one section per finding, each
containing a verdict (agree / disagree / partial), the action taken in
the plan, and a pointer to the affected plan section. After updating
the plan, also update the reply if a numbered step shifts so that
cross-references stay accurate.
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Agent Instructions

Follow
[`.github/copilot-instructions.md`](.github/copilot-instructions.md) for
this repository.
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@.github/copilot-instructions.md
138 changes: 71 additions & 67 deletions docs/dev/adrs/accepted/analysis-cif-fit-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Analysis and fitting.
## Context

`analysis/analysis.cif` already persists analysis configuration such as
`_fitting.minimizer_type`, `_fitting.mode_type`, aliases, constraints,
and active fit-mode settings. That configuration alone is not enough to
`_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.

Expand All @@ -26,9 +26,9 @@ 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
- Bayesian summary metadata and manifests for bulk array sidecars
- plot-ready Bayesian caches so restored posterior displays do not need
to recompute on first use
- 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
Expand All @@ -41,13 +41,14 @@ projection. This ADR defines that narrower saved projection.

## Decision

Persist analysis-owned fit state as explicit sibling categories in
`analysis/analysis.cif`, with large Bayesian arrays stored in
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` and the related fit-state categories.
`_fit_result`, `_fit_parameter`, `_fit_parameter_correlation`, and
fit-output fields on `_minimizer.*`.

### Common fit-state categories

Expand All @@ -66,6 +67,15 @@ pre-fit scalar snapshots:
- `fit_bounds_uncertainty_multiplier`
- `start_value`
- `start_uncertainty`
- `posterior_best_sample_value`
- `posterior_median`
- `posterior_uncertainty`
- `posterior_interval_68_low`
- `posterior_interval_68_high`
- `posterior_interval_95_low`
- `posterior_interval_95_high`
- `posterior_gelman_rubin`
- `posterior_effective_sample_size_bulk`

`_fit_result` stores the latest saved fit header:

Expand All @@ -80,15 +90,12 @@ pre-fit scalar snapshots:
correlation summaries keyed by a persisted `id`. Only unique parameter
pairs are stored.

### Deterministic fit projection
### Minimizer fit projection

Deterministic fits persist `_deterministic_result` in addition to the
common categories above.
The active `_minimizer.*` category stores both user-selected solver
inputs and fit-filled outputs. Deterministic minimizer classes store
compact fit output counts:

`_deterministic_result` stores compact optimizer metadata and counts:

- `optimizer_name`
- `method_name`
- `objective_name`
- `objective_value`
- `n_data_points`
Expand All @@ -97,60 +104,56 @@ common categories above.
- `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 fit projection

Bayesian fits persist these additional categories:

- `_bayesian_result`
- `_bayesian_sampler`
- `_bayesian_convergence`
- `_bayesian_parameter_posterior`
- `_bayesian_distribution_cache`
- `_bayesian_pair_cache`
- `_bayesian_predictive_dataset`

`_bayesian_result` stores the saved Bayesian header and sidecar flags,
including `sidecar_file`, `has_posterior_samples`,
`has_distribution_cache`, `has_pair_cache`, and
`has_posterior_predictive`.

`_bayesian_sampler` stores the resolved sampler settings used for the
run. `parallel` persists the resolved non-negative worker count as an
integer.

`_bayesian_convergence` stores convergence metadata and posterior array
shape counts.

`_bayesian_parameter_posterior` stores one summary row per sampled
parameter, including credible intervals, uncertainty, ESS, and R-hat.
Its row order defines the saved posterior parameter order.

`_bayesian_distribution_cache`, `_bayesian_pair_cache`, and
`_bayesian_predictive_dataset` store manifest rows for plot-ready
posterior caches. Distribution and predictive caches are persisted for
any Bayesian fit with posterior samples, including single-parameter
fits. Pair caches and posterior correlation summaries are only persisted
when more than one parameter was sampled.

`parameter.posterior` is not part of this accepted design. This ADR
persists analysis-level posterior summaries and caches only. Any future
parameter-level posterior API remains a separate decision.

### Bayesian sidecar

Persist large Bayesian arrays in `analysis/results.h5` using `h5py`.
This includes canonical posterior arrays and any saved distribution,
pair, and predictive cache arrays referenced by the CIF manifests.

The persisted `sidecar_file` value is a local file name only. It must
resolve to a basename inside the project `analysis/` directory. Absolute
paths and traversal paths are rejected and fall back to `results.h5`.
Bayesian minimizer classes store sampler inputs and fit outputs under
`_minimizer.*`, including:

- `sampling_steps`
- `burn_in_steps`
- `thinning_interval`
- `population_size`
- `parallel_workers`
- `initialization_method`
- `random_seed`
- `runtime_seconds`
- `point_estimate_name`
- `sampler_completed`
- `credible_interval_inner`
- `credible_interval_outer`
- `acceptance_rate_mean`
- `gelman_rubin_max`
- `effective_sample_size_min`
- `best_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.*`.

### Posterior sidecar

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
Expand All @@ -168,9 +171,9 @@ Load order is:

1. standard analysis configuration
2. common fit-state categories
3. deterministic or Bayesian fit-specific categories according to
`_fit_result.result_kind`
4. Bayesian sidecar arrays when a Bayesian sidecar is expected
3. `_minimizer.*` fit-output fields according to the active
`_minimizer.type`
4. posterior sidecar arrays when a Bayesian result is expected

Persist backend runtime objects, optimizer instances, and raw driver
payloads nowhere in this design.
Expand All @@ -186,7 +189,8 @@ 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 manifest rows and bulk datasets.
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
Expand Down
12 changes: 7 additions & 5 deletions docs/dev/adrs/accepted/category-owner-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ Project-level configuration follows the same pattern via a private
Its current children are:

- `ProjectInfo`
- `Rendering`
- `Chart`
- `Table`

The public API stays flat and user-facing:

- `project.info`
- `project.rendering`
- `project.chart`
- `project.table`

Saved `project.cif` remains a section file without a `data_` header. It
serializes the `_project.*` metadata category and the `_rendering.*`
configuration category without pretending that the project config is a
real datablock.
serializes the `_project.*` metadata category plus the `_chart.*` and
`_table.*` configuration categories without pretending that the project
config is a real datablock.

### 4. CIF serialization is split by responsibility

Expand Down
17 changes: 8 additions & 9 deletions docs/dev/adrs/accepted/display-ux.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,22 @@ defaults.
## Decision

Use `project.display` as the user-facing facade for display actions.
Move serialized renderer settings out of that facade and into a separate
project category named `project.rendering`.
Move serialized renderer settings out of that facade and into separate
project categories named `project.chart` and `project.table`.

Renderer settings:

```python
project.rendering.chart_engine = 'plotly'
project.rendering.table_engine = 'pandas'
project.rendering.show_chart_engines()
project.rendering.show_table_engines()
project.rendering.show_config()
project.chart.type = 'plotly'
project.table.type = 'pandas'
project.chart.show_supported()
project.table.show_supported()
```

CIF names:

- `_rendering.chart_engine`
- `_rendering.table_engine`
- `_chart.type`
- `_table.type`

No legacy loader is required for `_display.plotter_type` or
`_display.tabler_type`. The project is in beta, so this cleanup may
Expand Down
Loading
Loading