Skip to content

Fix mge_model_from ignoring the centre_fixed value - #552

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/howtolens-tutorial-restructure-f19y9d
Aug 6, 2026
Merged

Fix mge_model_from ignoring the centre_fixed value#552
Jammy2211 merged 1 commit into
mainfrom
claude/howtolens-tutorial-restructure-f19y9d

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

mge_model_from's _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 centre=(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: return centre_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 used centre_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

_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
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.

2 participants