Overview
Design phase (1 of 4) for oversampled PSF convolution. The Convolver currently requires the PSF to share the image's pixel scale; for modeling we want to evaluate images on an oversampled grid, convolve with an oversampled PSF at that higher resolution, and bin down to the observed resolution. This phase produces the design note and a brute-force numerical ground truth that later phases implement and test against — it makes no library source edits.
Parent task: PyAutoMind/issued/oversampling.md (scored too-large, split 2026-07-08 into design → core API → workspace examples → docs). This run is --auto at effective level supervised (checkpoint-and-continue per PyAutoBrain/AUTONOMY.md): the plan below is the plan-approval record; ship sign-off will park with a batched question on this issue.
Plan
- Survey how
Convolver/ConvolverState performs same-resolution PSF convolution today, and how the over_sampling package defines uniform oversampled grids and bins them down.
- Design the
convolve_over_sample_size API on Convolver: relationship between the oversampled evaluation grid, the oversampled PSF kernel, and the bin-down step (size 2 = PSF at 2× image resolution).
- Design the
Imaging extension: convolve_over_sample_size_lp and convolve_over_sample_size_pixelization, mirroring the existing over_sample_size_lp / over_sample_size_pixelization pattern.
- Trace how PSF convolution enters the inversion and confirm or correct the hypothesis that wiring lands in
mapping.py (initial reading shows the actual PSF application lives in abstract.py via psf.convolved_mapping_matrix_from); record why sparse.py is deferred.
- Survey how
PyAutoGalaxy/autogalaxy/operate/image.py model-image blurring will consume the new behaviour (design only).
- Specify the adaptive-over-sampling guard: adaptive sub-sizes make 2D convolution ill-defined — raise loudly, no silent fallback.
- Build a standalone brute-force ground-truth computation with a simple analytic oversampled PSF and record the reference numbers.
- Write the design note (
oversampling_design.md alongside the phase prompts in PyAutoMind) and post it to this issue.
Detailed implementation plan
Affected Repositories
- PyAutoArray (primary — read/survey only this phase)
- PyAutoGalaxy (read/survey only)
- PyAutoMind (design note + ground-truth script are the shipped artifacts)
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoArray |
main |
clean |
| ./PyAutoGalaxy |
main |
clean |
| ./PyAutoMind |
main |
1 modified (parent-prompt split annotation, rides with registration push) |
Suggested branch: feature/psf-oversample-design
Worktree root: ~/Code/PyAutoLabs-wt/psf-oversample-design/
Implementation Steps
- Read
autoarray/operators/convolver.py (~1000 lines: ConvolverState, Convolver) — document how the kernel is embedded/padded and applied at image resolution, and every public entry point (convolve_over_sample_size must serve all of them or explicitly scope which).
- Read
autoarray/operators/over_sampling/ (over_sampler.py, over_sample_util.py, decorator.py) — document how uniform over-sampled grids are constructed and binned down, and which pieces oversampled convolution can reuse.
- Read
autoarray/dataset/imaging/dataset.py — document how over_sample_size_lp / over_sample_size_pixelization flow from the constructor into grids, and design the analogous convolve_over_sample_size_lp / convolve_over_sample_size_pixelization plumbing into the Convolver(s).
- Read
autoarray/inversion/inversion/imaging/{abstract,mapping,sparse}.py and inversion_imaging_util.py — map the actual PSF entry points (convolved_mapping_matrix_from calls in abstract.py, w-tilde kernel use) and decide where oversampled convolution is wired; record the sparse.py deferral rationale.
- Read
autogalaxy/operate/image.py — document the model-image blurring path (blurred_image_2d_from and friends) and what phase 2 must change there.
- Specify adaptive-guard behaviour: requesting oversampled convolution with an adaptive (per-pixel
Array2D) over-sample size raises a clear error.
- Write the brute-force ground truth: simple analytic PSF (e.g. Gaussian) at over-sample sizes 1 and 2, tiny mask, direct high-resolution convolution + bin-down computed with plain numpy loops; record numbers in the design note. Size 1 must match the existing
Convolver output exactly.
- Write
oversampling_design.md covering all of the above with file/line grounding; check it into PyAutoMind next to the phase prompts; post the note to this issue.
Key Files
PyAutoArray/autoarray/operators/convolver.py — current same-resolution convolution (ConvolverState, Convolver)
PyAutoArray/autoarray/operators/over_sampling/over_sampler.py — uniform over-sampling + bin-down machinery
PyAutoArray/autoarray/dataset/imaging/dataset.py — Imaging constructor to extend in phase 2
PyAutoArray/autoarray/inversion/inversion/imaging/abstract.py — actual PSF application in the inversion (convolved_mapping_matrix_from)
PyAutoArray/autoarray/inversion/inversion/imaging/mapping.py / sparse.py — wiring target / deferred
PyAutoGalaxy/autogalaxy/operate/image.py — model-image blurring consumer (phase 2 scope, surveyed here)
Acceptance
- Design note answers every scope point with file/line grounding.
- Ground-truth script runs; its reference numbers are recorded in the note.
- No edits to PyAutoArray/PyAutoGalaxy source.
Original Prompt
Click to expand starting prompt
Oversampled PSF convolution — phase 1: design note + numerical ground truth
Type: feature
Target: PyAutoArray
Repos:
- PyAutoArray
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Phase 1 of 4 of feature/autoarray/oversampling.md (split by the Feature Agent
on 2026-07-08 — the parent scored too-large). This phase produces the design
and the numerical reference result; no source-code edits to the libraries.
Background (from the parent prompt)
A point spread function blurs images via 2D convolution, implemented in
@PyAutoArray/autoarray/operators/convolver.py. The source code currently
requires PSF blurring to occur at the same resolution (pixel scale) as the
image. For modeling, convolution can instead be performed at a higher
resolution: evaluate the image on an oversampled grid, blur with an
oversampled PSF, then downsample (bin) to the observed image resolution.
Oversampling machinery lives in @PyAutoArray/autoarray/operators/over_sampling.
Adaptive (per-pixel) over-sample sizes make 2D PSF convolution ill-defined —
this design assumes uniform (non-adaptive) over sampling only.
Deliverables
- Design note (posted to the phase GitHub issue, and saved alongside this
prompt as oversampling_design.md) covering:
- How
Convolver gains a convolve_over_sample_size integer: the mapping
between the oversampled evaluation grid, the oversampled PSF kernel, and
the binning-down step to image resolution (e.g. size 2 = PSF at 2× the
image resolution).
- How
Imaging (@PyAutoArray/autoarray/dataset/imaging/dataset.py) gains
convolve_over_sample_size_lp and convolve_over_sample_size_pixelization
attributes for the light-profile and pixelization operations respectively,
alongside the existing over_sample_size_lp / over_sample_size_pixelization.
- How PSF convolution enters the inversion path: read
@PyAutoArray/autoarray/inversion/inversion/imaging and its parents.
The working hypothesis is that oversampled convolution can be wired into
mapping.py; sparse.py is explicitly deferred to future work — confirm
or correct this and record why.
- How model-image blurring in
@PyAutoGalaxy/autogalaxy/operate/image.py
consumes the new Convolver behaviour (survey only — implementation is
phase 2).
- How the code should behave when adaptive over sampling is requested
together with oversampled convolution (expect: raise loudly, no silent
fallback).
- Numerical ground truth: a standalone brute-force reference computation
(script or notebook-style scratch, checked in with this phase) using a
simple analytic oversampled PSF, producing the number(s) the phase-2 unit
tests and phase-3 workspace test will assert against.
Acceptance
- Design note answers every point above with file/line grounding.
- Ground-truth script runs and its result is recorded in the design note.
- No edits to PyAutoArray/PyAutoGalaxy source.
Parent: feature/autoarray/oversampling.md. Next: oversampling_phase_2_core_api.md.
Overview
Design phase (1 of 4) for oversampled PSF convolution. The
Convolvercurrently requires the PSF to share the image's pixel scale; for modeling we want to evaluate images on an oversampled grid, convolve with an oversampled PSF at that higher resolution, and bin down to the observed resolution. This phase produces the design note and a brute-force numerical ground truth that later phases implement and test against — it makes no library source edits.Parent task:
PyAutoMind/issued/oversampling.md(scored too-large, split 2026-07-08 into design → core API → workspace examples → docs). This run is--autoat effective levelsupervised(checkpoint-and-continue perPyAutoBrain/AUTONOMY.md): the plan below is the plan-approval record; ship sign-off will park with a batched question on this issue.Plan
Convolver/ConvolverStateperforms same-resolution PSF convolution today, and how theover_samplingpackage defines uniform oversampled grids and bins them down.convolve_over_sample_sizeAPI onConvolver: relationship between the oversampled evaluation grid, the oversampled PSF kernel, and the bin-down step (size 2 = PSF at 2× image resolution).Imagingextension:convolve_over_sample_size_lpandconvolve_over_sample_size_pixelization, mirroring the existingover_sample_size_lp/over_sample_size_pixelizationpattern.mapping.py(initial reading shows the actual PSF application lives inabstract.pyviapsf.convolved_mapping_matrix_from); record whysparse.pyis deferred.PyAutoGalaxy/autogalaxy/operate/image.pymodel-image blurring will consume the new behaviour (design only).oversampling_design.mdalongside the phase prompts in PyAutoMind) and post it to this issue.Detailed implementation plan
Affected Repositories
Branch Survey
Suggested branch:
feature/psf-oversample-designWorktree root:
~/Code/PyAutoLabs-wt/psf-oversample-design/Implementation Steps
autoarray/operators/convolver.py(~1000 lines:ConvolverState,Convolver) — document how the kernel is embedded/padded and applied at image resolution, and every public entry point (convolve_over_sample_sizemust serve all of them or explicitly scope which).autoarray/operators/over_sampling/(over_sampler.py,over_sample_util.py,decorator.py) — document how uniform over-sampled grids are constructed and binned down, and which pieces oversampled convolution can reuse.autoarray/dataset/imaging/dataset.py— document howover_sample_size_lp/over_sample_size_pixelizationflow from the constructor into grids, and design the analogousconvolve_over_sample_size_lp/convolve_over_sample_size_pixelizationplumbing into the Convolver(s).autoarray/inversion/inversion/imaging/{abstract,mapping,sparse}.pyandinversion_imaging_util.py— map the actual PSF entry points (convolved_mapping_matrix_fromcalls inabstract.py, w-tilde kernel use) and decide where oversampled convolution is wired; record thesparse.pydeferral rationale.autogalaxy/operate/image.py— document the model-image blurring path (blurred_image_2d_fromand friends) and what phase 2 must change there.Array2D) over-sample size raises a clear error.Convolveroutput exactly.oversampling_design.mdcovering all of the above with file/line grounding; check it into PyAutoMind next to the phase prompts; post the note to this issue.Key Files
PyAutoArray/autoarray/operators/convolver.py— current same-resolution convolution (ConvolverState,Convolver)PyAutoArray/autoarray/operators/over_sampling/over_sampler.py— uniform over-sampling + bin-down machineryPyAutoArray/autoarray/dataset/imaging/dataset.py—Imagingconstructor to extend in phase 2PyAutoArray/autoarray/inversion/inversion/imaging/abstract.py— actual PSF application in the inversion (convolved_mapping_matrix_from)PyAutoArray/autoarray/inversion/inversion/imaging/mapping.py/sparse.py— wiring target / deferredPyAutoGalaxy/autogalaxy/operate/image.py— model-image blurring consumer (phase 2 scope, surveyed here)Acceptance
Original Prompt
Click to expand starting prompt
Oversampled PSF convolution — phase 1: design note + numerical ground truth
Type: feature
Target: PyAutoArray
Repos:
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Phase 1 of 4 of
feature/autoarray/oversampling.md(split by the Feature Agenton 2026-07-08 — the parent scored too-large). This phase produces the design
and the numerical reference result; no source-code edits to the libraries.
Background (from the parent prompt)
A point spread function blurs images via 2D convolution, implemented in
@PyAutoArray/autoarray/operators/convolver.py. The source code currentlyrequires PSF blurring to occur at the same resolution (pixel scale) as the
image. For modeling, convolution can instead be performed at a higher
resolution: evaluate the image on an oversampled grid, blur with an
oversampled PSF, then downsample (bin) to the observed image resolution.
Oversampling machinery lives in
@PyAutoArray/autoarray/operators/over_sampling.Adaptive (per-pixel) over-sample sizes make 2D PSF convolution ill-defined —
this design assumes uniform (non-adaptive) over sampling only.
Deliverables
prompt as
oversampling_design.md) covering:Convolvergains aconvolve_over_sample_sizeinteger: the mappingbetween the oversampled evaluation grid, the oversampled PSF kernel, and
the binning-down step to image resolution (e.g. size 2 = PSF at 2× the
image resolution).
Imaging(@PyAutoArray/autoarray/dataset/imaging/dataset.py) gainsconvolve_over_sample_size_lpandconvolve_over_sample_size_pixelizationattributes for the light-profile and pixelization operations respectively,
alongside the existing
over_sample_size_lp/over_sample_size_pixelization.@PyAutoArray/autoarray/inversion/inversion/imagingand its parents.The working hypothesis is that oversampled convolution can be wired into
mapping.py;sparse.pyis explicitly deferred to future work — confirmor correct this and record why.
@PyAutoGalaxy/autogalaxy/operate/image.pyconsumes the new Convolver behaviour (survey only — implementation is
phase 2).
together with oversampled convolution (expect: raise loudly, no silent
fallback).
(script or notebook-style scratch, checked in with this phase) using a
simple analytic oversampled PSF, producing the number(s) the phase-2 unit
tests and phase-3 workspace test will assert against.
Acceptance
Parent:
feature/autoarray/oversampling.md. Next:oversampling_phase_2_core_api.md.