Skip to content

fix(convolver): build from_gaussian kernel at full size under PYAUTO_SMALL_DATASETS#398

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/convolver-gaussian-small-datasets-cap
Jul 22, 2026
Merged

fix(convolver): build from_gaussian kernel at full size under PYAUTO_SMALL_DATASETS#398
Jammy2211 merged 1 commit into
mainfrom
feature/convolver-gaussian-small-datasets-cap

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Convolver.from_gaussian raised ArrayException for any kernel larger than 16x16 when
PYAUTO_SMALL_DATASETS=1 (the smoke/fast-mode dataset cap).

It evaluates its Gaussian on a Grid2D.uniform, which the cap silently shrinks to
(16, 16), then wraps the resulting 256 values in an Array2D at the caller's uncapped
shape_native — a self-inconsistent construction:

ArrayException: array_2d_slim.shape = 256  vs  mask_2d.pixels_in_mask = 961, shape_native (31, 31)

A convolution kernel's shape is intrinsic to the operator, not a dataset size (a 31x31
kernel convolving a 16x16 image is perfectly valid), so the dataset cap must not reach it.
Fixed by passing the existing Grid2D.uniform(respect_small_datasets=False) opt-out.

This unblocks scripts/imaging/data_preparation/manual/mask_irregular.py in both
autolens_workspace and autogalaxy_workspace, which were failing in fast-mode runs.
No workspace changes are needed. Closes #397.

API Changes

None — internal changes only. Behaviour changes only under PYAUTO_SMALL_DATASETS=1,
a smoke-test-only flag never set in normal use: kernels above 16x16 now build correctly
instead of raising. Full-resolution behaviour is byte-identical.
See full details below.

Test Plan

  • New regression test test__from_gaussian__small_datasets__kernel_keeps_full_requested_shape
    — fails on main with the exact production ArrayException, passes with the fix
  • Full PyAutoArray suite: 927 passed
  • mask_irregular.py runs clean under the smoke env in autolens_workspace + autogalaxy_workspace
  • Same scripts with PYAUTO_SMALL_DATASETS unset still pass (full-res path untouched)
  • 11x11 consumer autolens_workspace/scripts/imaging/simulator.py unchanged under smoke env
Full API Changes (for automation & release notes)

Changed Behaviour

  • autoarray.Convolver.from_gaussian(shape_native=...) — the kernel grid no longer honours
    the PYAUTO_SMALL_DATASETS cap. Previously, with the env var set, shape_native above
    16x16 raised ArrayException; it now builds the kernel at the full requested size.
    Unaffected when the env var is unset, and for kernels at or below 16x16.

Migration

None required.

Generated by the PyAutoLabs agent workflow.

…SMALL_DATASETS

`Convolver.from_gaussian` evaluates its Gaussian on a `Grid2D.uniform`, which
the `PYAUTO_SMALL_DATASETS` fast-mode cap silently shrinks to 16x16, and then
wraps those values in an `Array2D` at the caller's uncapped `shape_native`.
For any kernel above 16x16 the two disagree and construction raises:

    ArrayException: array_2d_slim.shape = 256
                    mask_2d.pixels_in_mask = 961, shape_native (31, 31)

A kernel's shape is intrinsic to the convolution operator rather than a
dataset size, so the dataset cap must not reach it. Pass the existing
`Grid2D.uniform(respect_small_datasets=False)` opt-out.

Unblocks `imaging/data_preparation/manual/mask_irregular.py` in both the
autolens and autogalaxy workspaces, which failed in fast-mode runs. No
workspace changes needed.

Closes #397

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 22, 2026
@Jammy2211
Jammy2211 merged commit 77027d3 into main Jul 22, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/convolver-gaussian-small-datasets-cap branch July 22, 2026 09:55
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.

fix(convolver): from_gaussian kernel grid must not honour PYAUTO_SMALL_DATASETS cap

1 participant