Skip to content

Test matrix - #28

Merged
InfinityMonkeyAtWork merged 4 commits into
mainfrom
test-matrix
Apr 29, 2026
Merged

Test matrix#28
InfinityMonkeyAtWork merged 4 commits into
mainfrom
test-matrix

Conversation

@InfinityMonkeyAtWork

Copy link
Copy Markdown
Owner

No description provided.

- tests/roundtrip/: 89-cell single-file matrix (F1-F12 × {B,Sp,SbS,2D}
  × {M,G,C}), project matrix (PF1-PF3, M-only), noisy variants, and
  focused MCMC / W2 / SbS-seed tests
- tests/_utils.py: shared make_project, simulate_clean/noisy,
  extract_truth_pars, assert_recovery_*; rewired across 12 test files
- delete superseded test_roundtrip_basic.py + test_roundtrip_profile.py
  + TestProjectFitClean.test_shared_tau_recovery
- pyproject: add tests/ to pythonpath
- tests/models/project_energy.yaml: add project_glp_expr_base for PF2
Model.__getstate__ nulls Par.parent_model on every parameter to keep
pickles bounded. That broke Par._evaluate_dynamic_expression, which
resolves cross-component references via parent_model.get_all_parameters():
any model whose expression on one Par references a t_vary or p_vary Par
on a different component (e.g. roundtrip F12) raised NameError after
unpickling. Latent until now because the matrix runs SbS at n_workers=1
and MCMC focused tests didn't cover that shape.

Model.__setstate__ rewires the intra-Model back-refs from self:
comp.parent_model, par.parent_model, and par.t_model / par.p_model
parent_model on attached sub-Models. Dynamics/Profile inherit the hook
and recurse for their internal pars. parent_file stays nulled — that's
a cross-File relationship the caller still owns.

- tests/roundtrip/test_pickle.py: pickle + deepcopy value_2d byte-equality
  parametrized over F3/F6/F8/F12. F12 caught the bug.
- tests/roundtrip/test_focused.py: test_w2_sbs_f6_profile exercises SbS
  n_workers=2 on a profile-bearing family; existing test_w2_sbs_f1 only
  covered a static model.
Both invariants share the pickle work's topology-sensitive surface:
they walk the whole Par graph along the parameter_names flattening,
so single_glp coverage doesn't surface ordering / dropped-par /
cache-invalidation bugs that appear once Components grow Dynamics or
Profile sub-Models.

tests/roundtrip/test_update_value.py — 4 cases × F3/F6/F8/F12:
- update_value(current, 'all') is a no-op on the value list
- update_value(current, par_select=[names]) matches the 'all' no-op
- no-op update_value preserves value_2d byte-for-byte (stale-cache guard)
- perturbing one vary non-expr par propagates to value_2d (dropped-par guard)

tests/roundtrip/test_par_ordering.py — 2 cases × F3/F6/F8/F12:
- list(model.lmfit_pars) == model.parameter_names (positional contract
  shared by update_value, par_extract, SbS seed templates, GIR
  theta_indices)
- parameter_names is deterministic across rebuild

All pass on current main; these are regression guards, not bug
discoveries.
@InfinityMonkeyAtWork
InfinityMonkeyAtWork merged commit 67d578e into main Apr 29, 2026
3 checks passed
@InfinityMonkeyAtWork
InfinityMonkeyAtWork deleted the test-matrix branch April 29, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant