feat(DatasetModel): add grid_rotation_angle for multi-band rotation#312
Merged
Conversation
Mirrors the existing grid_offset pattern so each band in a multi-band fit can be rotated as well as shifted relative to a reference dataset. Adds Grid2D / Grid2DIrregular.subtracted_and_rotated_from helpers (shift then rotate CCW about the offset point) and wires FitDataset.grids through them so lp / pixelization / blurring grids all carry the transform into the fit. Refs PyAutoLens#511, prototype by @qiuhan06 on dev_Q. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
grid_rotation_angle: float = 0.0toaa.DatasetModel, in degrees, default0.0.Grid2D.subtracted_and_rotated_from(offset, angle, xp)andGrid2DIrregular.subtracted_and_rotated_from(...)— shift-then-rotate (CCW about the offset point).FitDataset.gridsnow applies both transforms tolp/pixelization/blurringgrids when building per-iteration grids.Grid2DIrregular.subtracted_fromfor API parity withGrid2D.subtracted_from.Mirrors the existing
grid_offsetpattern. Default behaviour (no rotation, no offset) is exactly backwards-compatible.Why
For multi-band fits (e.g. JWST NIRCam at slightly different roll angles), each band's image-plane grid needs to be rotated as well as shifted relative to a reference band before model evaluation. Prototype by @qiuhan06 on
dev_Q; this PR is the cleaned-up forward-port. See PyAutoLens#511 for the full diagnosis.API Changes
aa.DatasetModel(..., grid_rotation_angle: float = 0.0)— new optional kwarg.Grid2D.subtracted_and_rotated_from(offset, angle, xp=np)— new method.Grid2DIrregular.subtracted_from(offset, xp=np)— new method (parity).Grid2DIrregular.subtracted_and_rotated_from(offset, angle, xp=np)— new method.Test plan
python -m pytest test_autoarray/— 767 tests pass on this branchsubtracted_and_rotated_fromonGrid2D(zero-angle, 90deg, 180deg, shift-first-then-rotate)Grid2DIrregulartest_fit_dataset.pycoveringFitDataset.gridswith rotation, combined offset+rotation, and rotation=0 identityRefs PyAutoLens#511.