Skip to content

Commit 46aa3c7

Browse files
Jammy2211claude
authored andcommitted
perf: skip radial bins computation when PYAUTO_WORKSPACE_SMALL_DATASETS=1
Early-return a uniform size-2 array from over_sample_size_via_radial_bins_from(), avoiding the numba JIT compilation and radial distance computation on small test grids. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b93cdf0 commit 46aa3c7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

autoarray/operators/over_sampling/over_sample_util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ def over_sample_size_via_radial_bins_from(
232232
"""
233233
Returns an adaptive sub-grid size based on the radial distance of every pixel from the centre of the mask.
234234
235+
When ``PYAUTO_WORKSPACE_SMALL_DATASETS=1`` returns a uniform size-2 array
236+
immediately, skipping the expensive radial-bin computation and numba JIT.
237+
235238
The adaptive sub-grid size is computed as follows:
236239
237240
1) Compute the radial distance of every pixel in the mask from the centre of the mask (or input centres).
@@ -264,6 +267,11 @@ def over_sample_size_via_radial_bins_from(
264267
the centre of the mask.
265268
"""
266269

270+
import os
271+
272+
if os.environ.get("PYAUTO_WORKSPACE_SMALL_DATASETS") == "1":
273+
return Array2D(values=np.full(grid.shape_slim, 2.0), mask=grid.mask)
274+
267275
if centre_list is None:
268276
centre_list = [grid.mask.mask_centre]
269277

0 commit comments

Comments
 (0)