Repository navigation
feat: mge_model_from order_bases option and ell_comps_limit (#610) - #611
Merged
Merged
Conversation
mge_model_from(gaussian_per_basis=K>1) builds K bases with identical sigma ladders, iid ell_comps priors and a shared centre, so swapping two bases' ell_comps is an exact label symmetry and an unseeded search lands on either labelling at random (euclid_strong_lens_modeling_pipeline#54). order_bases=True adds one assertion per consecutive pair to the returned Basis model, ell_comps_1[j] > ell_comps_1[j+1], enforced on the NumPy path by exception + resample and on the JAX path by the traced penalty PyAutoFit#1583 introduced. The key is ell_comps_1 rather than the magnitude: on the Euclid phase-4 tiles the two bases often sit at the ±0.5 edge with opposite signs, equal in magnitude, where a magnitude key would slice both modes. Default off until validated on production runs (human direction 2026-09-08); the Euclid pipeline turns it on. ell_comps_limit sets the TruncatedGaussian ell_comps bounds (default ±1.0 unchanged) so callers can tighten the box without replacing the prior objects the assertions reference. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015RALRY9yekWDTtbVfok64a
Collaborator
Author
|
Workspace PR: PyAutoLabs/euclid_strong_lens_modeling_pipeline#58 |
…g corrections (#610) Review follow-up: ell_comps_limit and order_bases move after sigma_min so positional callers are unchanged (pinned by a test); the ordering docstring now states the mode-separation-versus-posterior-width argument correctly, notes that Result.model drops assertions, and qualifies the identifier claim on the PyAutoFit identifier fix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015RALRY9yekWDTtbVfok64a
3 tasks done
Collaborator
Author
|
Prerequisite: PyAutoLabs/PyAutoFit#1586 (assertions now enter the identifier; without it order_bases=True reuses the unordered fit's output directory). |
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.
Summary
mge_model_from(gaussian_per_basis=K>1)builds K bases with identical sigma ladders, iidell_compspriors and a shared centre, so swapping two bases'ell_compsis an exact label symmetry and an unseeded search lands on either labelling at random (PyAutoLabs/euclid_strong_lens_modeling_pipeline#54,docs/mge_label_degeneracy.mdthere). With PyAutoLabs/PyAutoFit#1583 an assertion on the returned Basis model is enforced on both backends, so the ordering now lives in the library as an option. Human direction 2026-09-08: default off for now, used by the Euclid pipeline with it on, default on once properly tested.The ordering key is
ell_comps_1(the cos 2φ component), not the magnitude: the Euclid phase-4 tiles show the two bases often pinned at the ±0.5 edge with opposite signs, equal in magnitude to 0.003, where a magnitude key would slice both modes. No single continuous key is exact for every configuration; a small |Δe1| between bases in a result means the ordering did not resolve on that dataset, which the docstring records.API Changes
Two new keyword arguments on
autogalaxy.analysis.model_util.mge_model_from, both defaulting to the previous behaviour:order_bases: bool = False— consecutive-pair assertionsell_comps_1[j] > ell_comps_1[j+1]on the returned Basis model (no-op for one basis;ValueErrorwithuse_spherical).ell_comps_limit: float = 1.0— TruncatedGaussianell_compsbounds ±limit.No removals, no signature changes to existing arguments, no behaviour change by default.
See full details below.
Test Plan
pytest test_autogalaxy/analysis/test_model_util.py -q: default off adds no assertions; K=2 one assertion, K=3 two, spherical raises, K=1 no-op; ordered vector satisfies and its swap fails (FitExceptionon NumPy);ell_comps_limitbounds; model pickles with assertionspytest test_autogalaxy -qgreen in the task worktreeell_comps_limit=0.5, order_bases=True, then the witness reruns on tile 102005065Full API Changes (for automation & release notes)
Added
autogalaxy.analysis.model_util.mge_model_from(..., ell_comps_limit=1.0, order_bases=False)— see aboveChanged Behaviour
order_bases=Truethe returnedaf.Model(Basis)carries assertions: it is then not a validtake_attributestarget (PyAutoFit refuses targets with assertions), and the assertions are part of the search identifier.Migration
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_015RALRY9yekWDTtbVfok64a