fix: make the PYAUTO_SMALL_DATASETS fast-mode cap even (15×15 → 16×16)#396
Merged
Merged
Conversation
The fast-mode cap (`PYAUTO_SMALL_DATASETS=1`) shrank masks/grids/arrays to an odd 15x15. Any feature that requires even mask dimensions then failed under fast-mode — notably PyAutoLens' potential-correction dpsi mesh (`dpsi_factor=2`, `PairRegularDpsiMesh`), which raises `ValueError: both mask dimensions must be divisible by dpsi_factor`. This broke the `interferometer/features/ potential_correction` scripts (start_here.py + likelihood_function.py) in the Heart release-fidelity validation, even though they run fine at full resolution (their real-space mask is 72x72). Cap to an even 16x16 instead across all three cap sites (`mask_2d.circular`, `grid_2d.uniform`, `cap_array_2d_for_small_datasets`) plus the `SMALL_DATASETS_SHAPE_NATIVE` constant, so fast-mode shapes stay compatible with even-divisibility requirements. Fast-mode is a CI-speed convenience only (16x16 vs 15x15 is negligible) and real runs are unaffected. Tests asserting the cap updated to 16x16; the divisibility invariant in the potential-correction mesh is left strict. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ciVftxvYpefh59wSkR7jN
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.
Problem
The fast-mode cap (
PYAUTO_SMALL_DATASETS=1) shrank masks/grids/arrays to an odd15×15. Any feature requiring even mask dimensions then failed under fast-mode — notably PyAutoLens' potential-correction dpsi mesh (RegularDpsiMesh(factor=2)→PairRegularDpsiMesh), which enforces:This failed the
interferometer/features/potential_correction/{start_here,likelihood_function}.pyscripts in PyAutoHeart's release-fidelity validation (and the nightly it feeds), even though they run fine at full resolution (their real-space mask is72×72, divisible by 2). Surfaced while auditing the nightly reds; it is not related to the autoconf→autonerves rename.Root cause
(72,72)real-space mask → capped to(15,15)→15 % 2 != 0→ mesh rejects it.cleaned_mask_frompreserves shape (it only toggles pixels to masked), so the odd shape reaches the divisibility check unchanged.Fix
Cap to an even
16×16across all three cap sites and the shared constant:Mask2D.circular(mask/mask_2d.py)Grid2D.uniform(structures/grids/uniform_2d.py)cap_array_2d_for_small_datasets+SMALL_DATASETS_SHAPE_NATIVE(util/dataset_util.py)Fast-mode is a CI-speed convenience only (
16×16vs15×15is negligible) and real runs are unaffected. The potential-correction mesh keeps its strict even-divisibility invariant — the fast-mode cap simply no longer violates it.Validation
python -m pytest test_autoarray/→ all small-datasets tests pass; full suite green apart from 3 pre-existingnufft_pynuffttransformer tests that also fail on cleanmainin this env (unpinned pynufft), unrelated to this change. Cap-value assertions updated to16×16;test_dataset_util.pynow derives the crop from the constant rather than hardcoding15.Downstream
Workspace smoke suites run with
PYAUTO_SMALL_DATASETS=1, so they'll use16×16after this merges — the change that makes the potential-correction scripts pass. No API change.🤖 Generated with Claude Code
https://claude.ai/code/session_013ciVftxvYpefh59wSkR7jN
Generated by Claude Code