Skip to content

fix: make the PYAUTO_SMALL_DATASETS fast-mode cap even (15×15 → 16×16)#396

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/pyautoconf-pyautonerves-rename-ik0cgu
Jul 19, 2026
Merged

fix: make the PYAUTO_SMALL_DATASETS fast-mode cap even (15×15 → 16×16)#396
Jammy2211 merged 1 commit into
mainfrom
claude/pyautoconf-pyautonerves-rename-ik0cgu

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Problem

The fast-mode cap (PYAUTO_SMALL_DATASETS=1) shrank masks/grids/arrays to an odd 15×15. Any feature requiring even mask dimensions then failed under fast-mode — notably PyAutoLens' potential-correction dpsi mesh (RegularDpsiMesh(factor=2)PairRegularDpsiMesh), which enforces:

raise ValueError("both mask dimensions must be divisible by dpsi_factor")

This failed the interferometer/features/potential_correction/{start_here,likelihood_function}.py scripts in PyAutoHeart's release-fidelity validation (and the nightly it feeds), even though they run fine at full resolution (their real-space mask is 72×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_from preserves shape (it only toggles pixels to masked), so the odd shape reaches the divisibility check unchanged.

Fix

Cap to an even 16×16 across 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×16 vs 15×15 is 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-existing nufft_pynufft transformer tests that also fail on clean main in this env (unpinned pynufft), unrelated to this change. Cap-value assertions updated to 16×16; test_dataset_util.py now derives the crop from the constant rather than hardcoding 15.

Downstream

Workspace smoke suites run with PYAUTO_SMALL_DATASETS=1, so they'll use 16×16 after 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

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
@Jammy2211
Jammy2211 merged commit 656be94 into main Jul 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants