Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions config/build/env_vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ defaults:
MPLCONFIGDIR: "/tmp/matplotlib" # Writable config dir for matplotlib

overrides:
# Non-simulator scripts that load committed FITS data need full-size
# datasets to avoid shape mismatch with pre-existing 100x100 data.
- pattern: "howtogalaxy/"
unset: [PYAUTO_SMALL_DATASETS]
- pattern: "guides/"
unset: [PYAUTO_SMALL_DATASETS]
# (Removed the dead `howtogalaxy/` + `guides/` PYAUTO_SMALL_DATASETS-unset
# workarounds: they matched no files here, and the tutorials now use
# `ag.util.dataset.should_simulate` which deletes + re-simulates stale data
# under the cap, so the chapters run correctly at 16x16.)
# guides/results/start_here.py must produce real samples so the example
# scripts that read from `output/results_folder` afterwards
# (data_fitting, queries, models, samples_via_aggregator) find a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
18 changes: 14 additions & 4 deletions notebooks/chapter_1_introduction/tutorial_3_fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,21 @@
"source": [
"__Dataset Auto-Simulation__\n",
"\n",
"If the dataset does not already exist on your system, it will be created by running the corresponding\n",
"simulator script. This ensures that all example scripts can be run without manually simulating data first."
"The `howtogalaxy` dataset is the one built up and saved in tutorial 2 (`tutorial_2_data.py`). If it\n",
"does not already exist on your system, it is created by running that script. This ensures every\n",
"example script can be run without manually simulating data first."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
" subprocess.run(\n",
" [sys.executable, \"scripts/simulators/simple.py\"],\n",
" [sys.executable, \"scripts/chapter_1_introduction/tutorial_2_data.py\"],\n",
" check=True,\n",
" )\n",
"\n",
Expand Down Expand Up @@ -984,6 +985,15 @@
"dataset_name = \"simple\"\n",
"dataset_path = Path(\"dataset\") / \"imaging\" / dataset_name\n",
"\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
" subprocess.run(\n",
" [sys.executable, \"scripts/simulators/simple.py\"],\n",
" check=True,\n",
" )\n",
"\n",
"dataset = ag.Imaging.from_fits(\n",
" data_path=dataset_path / \"data.fits\",\n",
" psf_path=dataset_path / \"psf.fits\",\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/chapter_2_modeling/tutorial_6_masking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/chapter_2_modeling/tutorial_7_results.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/chapter_4_pixelizations/tutorial_2_mappers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/chapter_optional/tutorial_searches.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"cell_type": "code",
"metadata": {},
"source": [
"if not dataset_path.exists():\n",
"if ag.util.dataset.should_simulate(str(dataset_path)):\n",
" import subprocess\n",
" import sys\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_1_introduction/tutorial_0_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
18 changes: 14 additions & 4 deletions scripts/chapter_1_introduction/tutorial_3_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@
"""
__Dataset Auto-Simulation__

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.
The `howtogalaxy` dataset is the one built up and saved in tutorial 2 (`tutorial_2_data.py`). If it
does not already exist on your system, it is created by running that script. This ensures every
example script can be run without manually simulating data first.
"""
if not dataset_path.exists():
if ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

subprocess.run(
[sys.executable, "scripts/simulators/simple.py"],
[sys.executable, "scripts/chapter_1_introduction/tutorial_2_data.py"],
check=True,
)

Expand Down Expand Up @@ -574,6 +575,15 @@
dataset_name = "simple"
dataset_path = Path("dataset") / "imaging" / dataset_name

if ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

subprocess.run(
[sys.executable, "scripts/simulators/simple.py"],
check=True,
)

dataset = ag.Imaging.from_fits(
data_path=dataset_path / "data.fits",
psf_path=dataset_path / "psf.fits",
Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_2_modeling/tutorial_1_non_linear_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_2_modeling/tutorial_2_practicalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_2_modeling/tutorial_5_linear_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_2_modeling/tutorial_6_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_2_modeling/tutorial_7_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 dataset_path.exists():
if ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_4_pixelizations/tutorial_2_mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_4_pixelizations/tutorial_3_inversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_4_pixelizations/tutorial_5_model_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 dataset_path.exists():
if ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_optional/tutorial_searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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 ag.util.dataset.should_simulate(str(dataset_path)):
import subprocess
import sys

Expand Down
4 changes: 3 additions & 1 deletion workspace_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
"Model Fitting",
"Wrap Up"
],
"cross_refs": [],
"cross_refs": [
"tutorial_2_data.py"
],
"notebook": "notebooks/chapter_1_introduction/tutorial_3_fitting.ipynb",
"path": "scripts/chapter_1_introduction/tutorial_3_fitting.py",
"summary": "In previous tutorials, we used light profiles to create simulated images of galaxies and visualized how these images would appear when captured by a CCD detector on a telescope like the Hubble Space Telescope.",
Expand Down
Loading