Skip to content

feat: PreloadsImaging + shared source-plane mesh fields (multi-exposure shared-state, phase 2/4)#380

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/multi-shared-state-core-api
Jul 10, 2026
Merged

feat: PreloadsImaging + shared source-plane mesh fields (multi-exposure shared-state, phase 2/4)#380
Jammy2211 merged 1 commit into
mainfrom
feature/multi-shared-state-core-api

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Adds the imaging half of the multi-exposure shared-state feature (PyAutoArray#379; design locked on PyAutoLens#599 D1–D6 + the regularization amendment): AbstractPreloads gains mesh-geometry fields so exposures of the same lens — same or different wavelengths, with per-exposure pixel offsets — can share one source-plane mesh, and a new PreloadsImaging sibling documents the imaging invariance contract.

The contract differs from the datacube case (#344): datacube channels share one real-space grid, so the whole mapper and curvature matrix F are preloadable. Imaging exposures have per-exposure PSFs and pixel offsets, so only the source-plane mesh geometry is exposure-invariant — the mapper, mapping matrix, blurred mapping matrix and regularization matrix (per user amendment: regularization may be data-adaptive) are deliberately NOT preloadable this way. Each exposure maps its own (offset) data grid onto the shared mesh.

The new fields live on AbstractPreloads (not PreloadsImaging) because the mesh is dataset-type-agnostic: in a joint imaging + interferometer graph, either dataset type can be the lead factor.

API Changes

All additive and backward compatible — no removals or renames.

  • aa.AbstractPreloads(... , source_plane_mesh_grid=None, image_plane_mesh_grid=None) — the shared source-plane mesh geometry (traced mesh centres) and its image-plane counterpart (lead-exposure frame, carried as metadata).
  • Added aa.PreloadsImaging(source_plane_mesh_grid=None, image_plane_mesh_grid=None) (new autoarray/preloads/imaging.py), with the invariance-contract docstring.
  • mapper_galaxy_dict docstring now states its grid-identity validity condition explicitly.

The consumer (mesh-preload reuse path in TracerToInversion, AnalysisImaging.shared_state_from) is the paired PyAutoLens PR — this PR must merge first.

Test Plan

  • python -m pytest test_autoarray/ — full suite passes (896 tests)
  • New test_autoarray/preloads/test_preloads.py — field defaults + container semantics for all three classes
  • Downstream: test_autogalaxy/ full suite against this branch (962 passed); test_autolens/ full suite against both branches
  • End-to-end (in the PyAutoLens PR): 2-factor FactorGraphModel shared-vs-unshared log-likelihood bit-identical; shared_state_from computed once (lead factor only)
Full API Changes (for automation & release notes)

Added

  • autoarray.preloads.imaging.PreloadsImaging(source_plane_mesh_grid=None, image_plane_mesh_grid=None) (exported as aa.PreloadsImaging).

Changed Signature (backward compatible — new optional kwargs, default None)

  • AbstractPreloads.__init__(... , source_plane_mesh_grid=None, image_plane_mesh_grid=None) (inherited by PreloadsInterferometer).

Migration

  • None required. To opt in, construct via AnalysisImaging(shared_preloads=True) (PyAutoLens PR) or pass aa.PreloadsImaging(source_plane_mesh_grid=...) explicitly.

Autonomy

--auto run (Autonomy: safe, feature/medium): four-leg ship gate — tests ✅ (896 + 962 + full autolens suite), smoke ✅ (curated subsets, see issue), review ✅ CLEAN, Heart 🟡 YELLOW acknowledged by user (reason set on issue #379). Ends at PR-open; merge stays human.

Part of the multi_shared_state_examples epic (phase 2/4). Closes #379 on merge of the pair.

🤖 Generated with Claude Code

…eloads

The imaging sibling of PreloadsInterferometer (PyAutoArray#379): AbstractPreloads gains
source_plane_mesh_grid + image_plane_mesh_grid (dataset-type-agnostic, so either dataset
type can lead an imaging+interferometer graph). PreloadsImaging documents the imaging
invariance contract: mesh geometry is shareable across exposures under one lens model;
mapper / curvature matrix / blurred mapping matrix / regularization matrix are NOT
(per-exposure PSFs + offsets; regularization may be data-adaptive).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 10, 2026
@Jammy2211 Jammy2211 merged commit f8a32d4 into main Jul 10, 2026
4 checks passed
@Jammy2211 Jammy2211 deleted the feature/multi-shared-state-core-api branch July 10, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: imaging shared-state consumer — PreloadsImaging + shared source-plane mesh (phase 2/4)

1 participant