From 50e176f51770f31578799358f714686f12076c8e Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 20:56:35 +0100 Subject: [PATCH] Use al.util.dataset.should_simulate in JAX auto-simulation blocks Replace path.exists checks with should_simulate so that datasets are automatically deleted and re-created when PYAUTO_WORKSPACE_SMALL_DATASETS is toggled, preventing shape mismatches between FITS files and masks. Co-Authored-By: Claude Sonnet 4.6 --- scripts/jax_likelihood_functions/imaging/delaunay.py | 2 +- scripts/jax_likelihood_functions/imaging/delaunay_mge.py | 2 +- scripts/jax_likelihood_functions/imaging/lp.py | 2 +- scripts/jax_likelihood_functions/imaging/mge.py | 2 +- scripts/jax_likelihood_functions/imaging/mge_group.py | 2 +- scripts/jax_likelihood_functions/imaging/rectangular.py | 2 +- scripts/jax_likelihood_functions/imaging/rectangular_dspl.py | 2 +- scripts/jax_likelihood_functions/imaging/rectangular_mge.py | 2 +- scripts/jax_likelihood_functions/interferometer/mge.py | 2 +- scripts/jax_likelihood_functions/interferometer/mge_group.py | 2 +- scripts/jax_likelihood_functions/interferometer/rectangular.py | 2 +- scripts/jax_likelihood_functions/multi/mge.py | 2 +- scripts/jax_likelihood_functions/point_source/point.py | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/jax_likelihood_functions/imaging/delaunay.py b/scripts/jax_likelihood_functions/imaging/delaunay.py index d5508cc..d0333ac 100644 --- a/scripts/jax_likelihood_functions/imaging/delaunay.py +++ b/scripts/jax_likelihood_functions/imaging/delaunay.py @@ -56,7 +56,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/delaunay_mge.py b/scripts/jax_likelihood_functions/imaging/delaunay_mge.py index 17347cf..657c375 100644 --- a/scripts/jax_likelihood_functions/imaging/delaunay_mge.py +++ b/scripts/jax_likelihood_functions/imaging/delaunay_mge.py @@ -55,7 +55,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/lp.py b/scripts/jax_likelihood_functions/imaging/lp.py index 7b1e0e5..4866e72 100644 --- a/scripts/jax_likelihood_functions/imaging/lp.py +++ b/scripts/jax_likelihood_functions/imaging/lp.py @@ -53,7 +53,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/mge.py b/scripts/jax_likelihood_functions/imaging/mge.py index 31458ac..01ba3ac 100644 --- a/scripts/jax_likelihood_functions/imaging/mge.py +++ b/scripts/jax_likelihood_functions/imaging/mge.py @@ -54,7 +54,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/mge_group.py b/scripts/jax_likelihood_functions/imaging/mge_group.py index 638dbdf..6a0fcda 100644 --- a/scripts/jax_likelihood_functions/imaging/mge_group.py +++ b/scripts/jax_likelihood_functions/imaging/mge_group.py @@ -54,7 +54,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/rectangular.py b/scripts/jax_likelihood_functions/imaging/rectangular.py index def99f8..10642a4 100644 --- a/scripts/jax_likelihood_functions/imaging/rectangular.py +++ b/scripts/jax_likelihood_functions/imaging/rectangular.py @@ -53,7 +53,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/rectangular_dspl.py b/scripts/jax_likelihood_functions/imaging/rectangular_dspl.py index 8935287..84573bb 100644 --- a/scripts/jax_likelihood_functions/imaging/rectangular_dspl.py +++ b/scripts/jax_likelihood_functions/imaging/rectangular_dspl.py @@ -56,7 +56,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/imaging/rectangular_mge.py b/scripts/jax_likelihood_functions/imaging/rectangular_mge.py index 36c44a4..0153e04 100644 --- a/scripts/jax_likelihood_functions/imaging/rectangular_mge.py +++ b/scripts/jax_likelihood_functions/imaging/rectangular_mge.py @@ -55,7 +55,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/interferometer/mge.py b/scripts/jax_likelihood_functions/interferometer/mge.py index 1eebfe3..3da5fc2 100644 --- a/scripts/jax_likelihood_functions/interferometer/mge.py +++ b/scripts/jax_likelihood_functions/interferometer/mge.py @@ -68,7 +68,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/interferometer/mge_group.py b/scripts/jax_likelihood_functions/interferometer/mge_group.py index 25ef21d..4408a21 100644 --- a/scripts/jax_likelihood_functions/interferometer/mge_group.py +++ b/scripts/jax_likelihood_functions/interferometer/mge_group.py @@ -29,7 +29,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/interferometer/rectangular.py b/scripts/jax_likelihood_functions/interferometer/rectangular.py index a60fd54..c1f3e16 100644 --- a/scripts/jax_likelihood_functions/interferometer/rectangular.py +++ b/scripts/jax_likelihood_functions/interferometer/rectangular.py @@ -67,7 +67,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/multi/mge.py b/scripts/jax_likelihood_functions/multi/mge.py index 7128e5a..dfe8ed3 100644 --- a/scripts/jax_likelihood_functions/multi/mge.py +++ b/scripts/jax_likelihood_functions/multi/mge.py @@ -26,7 +26,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not path.exists(dataset_path): +if al.util.dataset.should_simulate(dataset_path): import subprocess import sys diff --git a/scripts/jax_likelihood_functions/point_source/point.py b/scripts/jax_likelihood_functions/point_source/point.py index ce7b5d4..2b996fc 100644 --- a/scripts/jax_likelihood_functions/point_source/point.py +++ b/scripts/jax_likelihood_functions/point_source/point.py @@ -56,7 +56,7 @@ If the dataset does not already exist on your system, it will be created by running the corresponding simulator script. This ensures that all example scripts can be run without manually simulating data first. """ -if not dataset_path.exists(): +if al.util.dataset.should_simulate(str(dataset_path)): import subprocess import sys