diff --git a/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb b/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb index 17ac577..952769c 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb @@ -484,8 +484,17 @@ "cell_type": "code", "metadata": {}, "source": [ + "# `PYAUTO_SMALL_DATASETS=1` (the CI smoke harness) caps the data to a 16 x 16 image, where a\n", + "# 40 x 40 mesh reconstructs 1600 source pixels from a few dozen image pixels. The mesh is\n", + "# capped alongside the data; a normal full-resolution run keeps the 40 x 40 grid described above.\n", + "mesh_shape = (\n", + " al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE\n", + " if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE\n", + " else (40, 40)\n", + ")\n", + "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb b/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb index b6644f6..75ad0f3 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb @@ -196,8 +196,17 @@ "cell_type": "code", "metadata": {}, "source": [ + "# `PYAUTO_SMALL_DATASETS=1` (the CI smoke harness) caps the data to a 16 x 16 image, where a\n", + "# 40 x 40 mesh reconstructs 1600 source pixels from a few dozen image pixels. The mesh is\n", + "# capped alongside the data; a normal full-resolution run keeps the 40 x 40 grid described above.\n", + "mesh_shape = (\n", + " al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE\n", + " if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE\n", + " else (40, 40)\n", + ")\n", + "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", @@ -227,7 +236,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=0.0),\n", ")\n", "\n", @@ -300,7 +309,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=100.0),\n", ")\n", "\n", @@ -422,7 +431,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb b/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb index bad296d..5aad03d 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb @@ -250,8 +250,17 @@ "cell_type": "code", "metadata": {}, "source": [ + "# `PYAUTO_SMALL_DATASETS=1` (the CI smoke harness) caps the data to a 16 x 16 image, where a\n", + "# 40 x 40 mesh reconstructs 1600 source pixels from a few dozen image pixels. The mesh is\n", + "# capped alongside the data; a normal full-resolution run keeps the 40 x 40 grid described above.\n", + "mesh_shape = (\n", + " al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE\n", + " if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE\n", + " else (40, 40)\n", + ")\n", + "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/scripts/chapter_3_pixelizations/tutorial_3_inversions.py b/scripts/chapter_3_pixelizations/tutorial_3_inversions.py index ddee2cf..d84d4dc 100644 --- a/scripts/chapter_3_pixelizations/tutorial_3_inversions.py +++ b/scripts/chapter_3_pixelizations/tutorial_3_inversions.py @@ -283,8 +283,17 @@ giving the source galaxy a light profile, we simply pass it a `Pixelization` and regularization, and pass it to a tracer. """ +# `PYAUTO_SMALL_DATASETS=1` (the CI smoke harness) caps the data to a 16 x 16 image, where a +# 40 x 40 mesh reconstructs 1600 source pixels from a few dozen image pixels. The mesh is +# capped alongside the data; a normal full-resolution run keeps the 40 x 40 grid described above. +mesh_shape = ( + al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE + if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE + else (40, 40) +) + pixelization = al.Pixelization( - mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py b/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py index 69bd8df..3ab4846 100644 --- a/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py +++ b/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py @@ -106,8 +106,17 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): Okay, so lets look at our fit from the previous tutorial in more detail. we'll use a higher resolution 40 x 40 grid. """ +# `PYAUTO_SMALL_DATASETS=1` (the CI smoke harness) caps the data to a 16 x 16 image, where a +# 40 x 40 mesh reconstructs 1600 source pixels from a few dozen image pixels. The mesh is +# capped alongside the data; a normal full-resolution run keeps the 40 x 40 grid described above. +mesh_shape = ( + al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE + if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE + else (40, 40) +) + pixelization = al.Pixelization( - mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=1.0), ) @@ -126,7 +135,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): 1.0. If we reduce this `coefficient` to zero, the source reconstruction goes *very* weird. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=0.0), ) @@ -177,7 +186,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): So, what happens if we apply a high value for the regularization coefficient? """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=100.0), ) @@ -266,7 +275,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): from the value above by changing these parameters, I've set you up with a code to do so below. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_6_borders.py b/scripts/chapter_3_pixelizations/tutorial_6_borders.py index c433d43..28f5ebf 100644 --- a/scripts/chapter_3_pixelizations/tutorial_6_borders.py +++ b/scripts/chapter_3_pixelizations/tutorial_6_borders.py @@ -138,8 +138,17 @@ def perform_fit_with_source_galaxy_mask_and_border( Note how we control the border via the `al.Settings` object's `use_border_relocator` input. """ +# `PYAUTO_SMALL_DATASETS=1` (the CI smoke harness) caps the data to a 16 x 16 image, where a +# 40 x 40 mesh reconstructs 1600 source pixels from a few dozen image pixels. The mesh is +# capped alongside the data; a normal full-resolution run keeps the 40 x 40 grid described above. +mesh_shape = ( + al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE + if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE + else (40, 40) +) + pixelization = al.Pixelization( - mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=1.0), )