File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 2929
3030from autoarray .operators import transformer_util as transformer
3131from autoarray .util import misc_util as misc
32+ from autoarray .util import dataset_util as dataset
Original file line number Diff line number Diff line change 1+ import os
2+ import shutil
3+
4+
5+ def should_simulate (dataset_path ):
6+ """
7+ Returns True if the dataset at ``dataset_path`` needs to be simulated.
8+
9+ When ``PYAUTO_WORKSPACE_SMALL_DATASETS=1`` is active, any existing dataset
10+ is deleted so the simulator re-creates it at the reduced resolution. This
11+ avoids shape mismatches between full-resolution FITS files on disk and the
12+ 15x15 mask/grid cap applied by the env var.
13+
14+ Use this as a drop-in replacement for ``not path.exists(dataset_path)`` in
15+ the workspace auto-simulation pattern::
16+
17+ if aa.util.dataset.should_simulate(dataset_path):
18+ subprocess.run([sys.executable, "scripts/.../simulator.py"], check=True)
19+ """
20+ if os .environ .get ("PYAUTO_WORKSPACE_SMALL_DATASETS" ) == "1" :
21+ if os .path .exists (dataset_path ):
22+ shutil .rmtree (dataset_path )
23+
24+ return not os .path .exists (dataset_path )
You can’t perform that action at this time.
0 commit comments