Skip to content

Commit 7768667

Browse files
Jammy2211claude
authored andcommitted
feat: add PYAUTO_WORKSPACE_SMALL_DATASETS env var to cap grid/mask size
When PYAUTO_WORKSPACE_SMALL_DATASETS=1, Grid2D.uniform() and Mask2D.circular() override shape_native to (15, 15) and pixel_scales to 0.6 for any grid larger than 15x15. This makes workspace smoke tests dramatically faster by reducing all downstream computations (DFT, ray-tracing, plotting) without any changes to workspace scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e27efb5 commit 7768667

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

autoarray/mask/mask_2d.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22
import logging
3+
import os
34
from enum import Enum
45
import numpy as np
56
from pathlib import Path
@@ -359,6 +360,11 @@ def circular(
359360
and visa versa.
360361
"""
361362

363+
if os.environ.get("PYAUTO_WORKSPACE_SMALL_DATASETS") == "1":
364+
if shape_native[0] > 15 or shape_native[1] > 15:
365+
shape_native = (15, 15)
366+
pixel_scales = 0.6
367+
362368
pixel_scales = geometry_util.convert_pixel_scales_2d(pixel_scales=pixel_scales)
363369

364370
mask = mask_2d_util.mask_2d_circular_from(

autoarray/structures/grids/uniform_2d.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
import os
23
import numpy as np
34
from pathlib import Path
45
from typing import List, Optional, Tuple, Union
@@ -486,6 +487,11 @@ def uniform(
486487
origin
487488
The origin of the grid's mask.
488489
"""
490+
if os.environ.get("PYAUTO_WORKSPACE_SMALL_DATASETS") == "1":
491+
if shape_native[0] > 15 or shape_native[1] > 15:
492+
shape_native = (15, 15)
493+
pixel_scales = 0.6
494+
489495
pixel_scales = geometry_util.convert_pixel_scales_2d(pixel_scales=pixel_scales)
490496

491497
grid_slim = grid_2d_util.grid_2d_slim_via_shape_native_from(

0 commit comments

Comments
 (0)