Skip to content

feat(AnalysisImaging): plumb dataset_model into adapt_images_via_instance_from#512

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/dataset-model-grid-rotation
May 15, 2026
Merged

feat(AnalysisImaging): plumb dataset_model into adapt_images_via_instance_from#512
Jammy2211 merged 1 commit into
mainfrom
feature/dataset-model-grid-rotation

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

  • AnalysisImaging.fit_from now passes the per-iteration dataset_model and self._xp through adapt_images_via_instance_from, so adaptive pixelization mesh grids stay in the same rotated/shifted frame as the data grid in multi-band fits.

This is the small but load-bearing PyAutoLens-side change to complete the multi-band grid-rotation feature. Adds 3 chi^2 = 0 simulate-and-fit regression tests at the full lensing chain (Tracer + DatasetModel rotation).

Depends on

PyAutoArray#312 and PyAutoGalaxy#416 (the latter is what defines the new dataset_model kwarg on AnalysisDataset.adapt_images_via_instance_from). CI will be red on this PR until both merge.

Scripts Changed

None beyond the test file.

Test plan

  • python -m pytest test_autolens/ — 277 tests pass on this branch
  • 3 new chi^2=0 self-consistency tests in test_simulate_and_fit_imaging.py covering the strong-lens use case (Hannah's actual JWST scenario):
    • test__perfect_fit__sim_offset_lens_and_source__fit_with_dataset_model_grid_offset__chi_squared_zero
    • test__perfect_fit__sim_rotated_lens_mass__fit_with_dataset_model_grid_rotation__chi_squared_zero
    • test__perfect_fit__sim_offset_and_rotated_lens__fit_with_dataset_model_offset_and_rotation__chi_squared_zero

Each one simulates a strong-lens system with shifted/rotated mass and source profiles, fits with identity-frame profiles + matching DatasetModel parameters, and asserts chi_squared = pytest.approx(0.0, abs=1e-4).

Refs PyAutoLens#511.

…ance_from

Threads the per-iteration dataset_model and xp backend into
adapt_images_via_instance_from so AdaptImages can rotate its cached
image-plane mesh grid alongside the data grid for multi-band fits.

Adds 3 chi^2=0 simulate-and-fit tests in test_simulate_and_fit_imaging.py
exercising the full lensing chain (Tracer + DatasetModel rotation):
offset-only, rotated mass, and combined offset+rotation.

Refs PyAutoLens#511, PyAutoArray#312, PyAutoGalaxy#416.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit 694285c into main May 15, 2026
6 of 8 checks passed
@Jammy2211 Jammy2211 deleted the feature/dataset-model-grid-rotation branch May 15, 2026 15:09
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