Skip to content

refactor: use auto back-rotation in deflection methods#347

Merged
Jammy2211 merged 1 commit intomainfrom
feature/transform-decorator
Apr 13, 2026
Merged

refactor: use auto back-rotation in deflection methods#347
Jammy2211 merged 1 commit intomainfrom
feature/transform-decorator

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Update all deflection methods to use the new @aa.grid_dec.transform(rotate_back=True) decorator from PyAutoArray, removing manual self.rotated_grid_from_reference_frame_from(...) calls. Net reduction of ~47 lines across 12 profile files.

Depends on: PyAutoLabs/PyAutoArray#272

Shear methods (which use angle=self.angle(xp) * 2) and the MGE abstract class (which rotates via self.mass_profile) are left unchanged — these use non-standard rotation that the decorator doesn't cover.

API Changes

None — internal changes only. All deflection methods produce identical numerical results.

Test Plan

  • 834 PyAutoGalaxy tests pass
  • 12 new regression tests with exact numerical values for Isothermal, NFW, PowerLaw
  • All existing profile tests (494) continue to pass
Full API Changes (for automation & release notes)

Changed (internal only)

  • 13 deflection methods across 12 files now use @aa.grid_dec.transform(rotate_back=True) instead of manually calling self.rotated_grid_from_reference_frame_from(...)
  • Files changed: isothermal.py, power_law.py, power_law_core.py, power_law_broken.py, dual_pseudo_isothermal_mass.py, dual_pseudo_isothermal_potential.py, nfw.py, gaussian.py, chameleon.py, external_shear.py, cse.py, sersic.py

Added (tests)

  • test_autogalaxy/profiles/mass/test_transform_rotate_back.py — 12 regression tests covering Isothermal, NFW, PowerLaw, ExternalShear, Gaussian with exact numerical values

🤖 Generated with Claude Code

Replace manual rotated_grid_from_reference_frame_from calls in deflection
methods with the new automatic back-rotation decorator parameter. Net
reduction of ~47 lines across 12 profile files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit c838c80 into main Apr 13, 2026
2 of 4 checks passed
@Jammy2211 Jammy2211 deleted the feature/transform-decorator branch April 13, 2026 09:57
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.

1 participant