Fix mge_model_from ignoring the centre_fixed value - #552
Merged
Conversation
_make_centre_priors returned centre[0], centre[1] when centre_fixed was set, silently ignoring the centre_fixed value — any caller passing only centre_fixed=(y, x) got Gaussians fixed at the default (0.0, 0.0) centre. Surfaced while writing the HowToLens scaling-relation tutorial; the workspace scaling-relation scripts pass only centre_fixed and are affected. Existing tests never caught it because they always used centre_fixed=(0.0, 0.0), which coincides with the default centre; a regression test with a non-zero fixed centre now pins the behaviour. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
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's_make_centre_priorsreturnedcentre[0], centre[1]whencentre_fixedwas set, silently ignoring thecentre_fixedvalue. Any caller passing onlycentre_fixed=(y, x)got Gaussians fixed at the defaultcentre=(0.0, 0.0)— the docstring's documented behaviour ("fix all Gaussian centres to this (y, x) value") was never honoured.Surfaced while writing the HowToLens scaling-relation tutorial; the autolens_workspace scaling-relation modeling scripts (imaging and multi_galaxy variants) pass only
centre_fixed=tuple(centre)and are affected.Changes
autogalaxy/analysis/model_util.py: returncentre_fixed[0], centre_fixed[1].test_autogalaxy/analysis/test_model_util.py: regression test with a non-zero fixed centre asserting it lands on the instance — the existing tests only ever usedcentre_fixed=(0.0, 0.0), which coincides with the default centre, which is why the bug was invisible.Validation
Full suite: 1007 passed, 1 skipped (Python 3.12).
No public API change — behaviour now matches the existing docstring.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Generated by Claude Code