Test matrix - #28
Merged
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.