fix(convolver): build from_gaussian kernel at full size under PYAUTO_SMALL_DATASETS#398
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Convolver.from_gaussianraisedArrayExceptionfor any kernel larger than 16x16 whenPYAUTO_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
Array2Dat the caller's uncappedshape_native— a self-inconsistent construction: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.pyin bothautolens_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
test__from_gaussian__small_datasets__kernel_keeps_full_requested_shape— fails on
mainwith the exact productionArrayException, passes with the fixmask_irregular.pyruns clean under the smoke env in autolens_workspace + autogalaxy_workspacePYAUTO_SMALL_DATASETSunset still pass (full-res path untouched)autolens_workspace/scripts/imaging/simulator.pyunchanged under smoke envFull API Changes (for automation & release notes)
Changed Behaviour
autoarray.Convolver.from_gaussian(shape_native=...)— the kernel grid no longer honoursthe
PYAUTO_SMALL_DATASETScap. Previously, with the env var set,shape_nativeabove16x16 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.