Skip to content

Commit ff0f45e

Browse files
authored
Merge pull request #258 from PyAutoLabs/feature/skip-radial-bins-small-datasets
perf: skip radial bins computation when PYAUTO_WORKSPACE_SMALL_DATASETS=1
2 parents b93cdf0 + 46aa3c7 commit ff0f45e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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)