Skip to content

fix: off-by-one in test__lp_linear_func_galaxy_dict_from exposed by LightProfileLinear eq - #449

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/linear-light-profile-intensity-dict-pytree
Apr 19, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/linear-light-profile-intensity-dict-pytree

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Fixes a pre-existing off-by-one bug in test__lp_linear_func_galaxy_dict_from that was hidden by the old structural __dict__-based __eq__ on LightProfileLinear. The companion PyAutoGalaxy PR introduces token-based __eq__ on LightProfileLinear which exposes the bug — without this fix the test suite goes red under that change.

The test sets up galaxy_linear_2 with lp_linear_2 and galaxy_linear_3's basis with [lp_linear_3, lp_linear_4], but asserted lp_linear_3 and lp_linear_4 at positions that should reference lp_linear_2 and lp_linear_3. Structural eq on parameter-less LightProfileLinear() instances made the wrong assertions pass.

Companion PR: PyAutoLabs/PyAutoGalaxy#360

API Changes

None — internal test-only fix.

See full details below.

Test Plan

  • PyAutoLens test suite: 252 passed (against the PyAutoGalaxy companion PR)
Full API Changes (for automation & release notes)

Changed Behaviour

  • None.

Migration

  • None.

Closes #448

The test sets up galaxy_linear_2 with lp_linear_2 and galaxy_linear_3's
basis with [lp_linear_3, lp_linear_4], but asserted lp_linear_3 and
lp_linear_4 at positions that should be lp_linear_2 and lp_linear_3.
The bug was hidden because GeometryProfile.__eq__ compared __dict__
structurally and parameter-less LightProfileLinear() instances were
all equal to each other.

Exposed by the LightProfileLinear pytree_token-based __eq__ in
PyAutoGalaxy which makes each instance uniquely equal only to itself.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace_test#34

@Jammy2211
Jammy2211 merged commit f2d5cd6 into main Apr 19, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/linear-light-profile-intensity-dict-pytree branch April 19, 2026 16:25
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
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.

feat: re-key linear_light_profile_intensity_dict to survive jax.jit round-trip

1 participant