Skip to content

feat: oversampled PSF blurred images — operate/image consumer (phase 2c) #480

Closed

Description

@Jammy2211

Overview

Phase 2c of oversampled PSF convolution: the PyAutoGalaxy consumer switch, per §5 of the approved design (PyAutoMind/feature/autoarray/oversampling_design.md, approved in PyAutoLabs/PyAutoArray#353). When the dataset's PSF is oversampled, operate/image.py must evaluate images at the fine resolution before convolving — today the over_sample decorator bins immediately, so the Convolver only ever sees image-resolution arrays.

Depends on PyAutoArray phase 2a (#354, merged as #355). Independent of phase 2b (#356 / PR #357, inversion path).

Design refinement at implementation: instead of threading a binned= kwarg through every image_2d_from signature (Galaxy → Galaxies → light profiles, plus Tracer in PyAutoLens), the oversampled branch evaluates on aa.Grid2DIrregular(grid.over_sampled) — the decorator already passes irregular grids through unbinned, and grid.over_sampled is in per-pixel sub-block order, exactly the oversampled Convolver's input format. No signature changes anywhere; Tracer inherits the behaviour through OperateImage unchanged.

Plan

  • blurred_image_2d_from: when psf.convolve_over_sample_size > 1, evaluate the image and blurring image on the over-sampled irregular grids and pass them to psf.convolved_image_from(..., mask=grid.mask); the LightProfileOperated branch is unchanged (operated images are added at image resolution, unblurred).
  • blurred_image_2d_list_from and galaxy_blurred_image_2d_dict_from: same switch per galaxy image.
  • padded_image_2d_from / unmasked_blurred_image_2d_from stay at image resolution (visualization-only; documented limitation per the design, revisited in the docs phase).
  • Tests (numpy-only): s=1 strict parity; s=2 blurred image through operate/image.py equals the same computation done directly through the phase-2a Convolver API; list/dict variants consistent with the scalar path.

Original Prompt

Click to expand starting prompt

See PyAutoMind/issued/oversampling_phase_2c_autogalaxy_consumer.md (phase 2c split of oversampling_phase_2_core_api.md; design approved in PyAutoArray#353).

Activity

  1. Jammy2211 commented on Jul 8, 2026

    @Jammy2211
    CollaboratorAuthor

    Phase 2c implemented — at the ship sign-off checkpoint

    Committed locally on feature/psf-oversample-galaxy (a4e6561c, not pushed). Diff: 2 files, +154/−21.

    Verification

    Leg Result
    Tests PyAutoGalaxy 943 passed (2 new); PyAutoLens 335 against the branch (Tracer inherits OperateImage, so its suite exercises the changed base class)
    Equivalence s=2 through operate/image.py equals the direct phase-2a Convolver call to 1e-14; list/dict variants match the scalar path exactly
    s=1 parity Untouched code paths; existing 12 operate-image tests unchanged and green
    Review Verdict: CLEAN
    Design note Implemented via the Grid2DIrregular(grid.over_sampled) pass-through instead of threading a binned= kwarg — no signature changes anywhere, Tracer gets the behaviour for free (recorded as a design refinement on this issue's opening post)

    Awaiting ship approval (supervised --auto): on approval the branch is pushed and the pending-release PR opens. This is the last code phase — after it, phase 3 (workspace tests + simulator example, including the autolens_workspace_test numerical tests deferred earlier today) and phase 4 (docs) remain, plus the filed refactor follow-up.

    🤖 Generated with Claude Code

  2. Jammy2211 commented on Jul 8, 2026

    @Jammy2211
    CollaboratorAuthor

    ➕ Scope addition shipped to PR #481 (user-directed): linear light profile support under an oversampled PSF. Their operated_mapping_matrix_override was convolving binned image-resolution evaluations — at s>1 it hit the phase-2a binned-input guard. It now evaluates each profile on the over-sampled coordinates and convolves at the fine resolution (same pattern as the consumer switch). Column-level test vs the direct Convolver to 1e-14; suites re-run green: PyAutoGalaxy 944, PyAutoLens 335.

    Support matrix at convolve_over_sample_size > 1 after this PR: standard light profiles ✅ · linear light profiles ✅ · operated light profiles ✅ (unblurred by definition) · pixelized via mapping formalism ✅ (2b, merged) · sparse formalism / data_linear_func_matrix preload / adaptive over sampling ❌ raise loudly (deferred by design). Phase 3 workspace tests will cover all four supported surfaces plus the guard assertions (prompt updated).

    🤖 Generated with Claude Code

  3. Jammy2211 commented on Jul 8, 2026

    @Jammy2211
    CollaboratorAuthor

    ✅ Merged as PR #481 (squash). Phase 2c complete — all four model surfaces (light / linear-light / operated / pixelized-mapping) now support oversampled PSF convolution on main. Phase 3 (workspace tests + simulator) is next.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions