diff --git a/notebooks/chapter_2_modeling/tutorial_1_non_linear_search.ipynb b/notebooks/chapter_2_modeling/tutorial_1_non_linear_search.ipynb index 0055296..8596adf 100644 --- a/notebooks/chapter_2_modeling/tutorial_1_non_linear_search.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_1_non_linear_search.ipynb @@ -227,8 +227,9 @@ "`log_likelihood_function` returns the score that guides the search.\n", "\n", "This is the same comparison you performed using `FitImaging` in chapter 1, now repeated automatically.\n", - "`use_jax=True` enables the numerical engine that accelerates these repeated calculations on a CPU or a compatible\n", - "GPU. You do not need to know how JAX works to use it." + "The analysis chooses the numerical engine that accelerates these repeated calculations on a CPU or a compatible\n", + "GPU for you (pass `use_jax=True` or `use_jax=False` to choose it yourself). You do not need to know how JAX works\n", + "to use it." ] }, { @@ -236,7 +237,7 @@ "metadata": {}, "source": [ "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)" + "analysis = ag.AnalysisImaging(dataset=dataset)" ], "outputs": [], "execution_count": null diff --git a/notebooks/chapter_2_modeling/tutorial_2_practicalities.ipynb b/notebooks/chapter_2_modeling/tutorial_2_practicalities.ipynb index a9b9806..03d857a 100644 --- a/notebooks/chapter_2_modeling/tutorial_2_practicalities.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_2_practicalities.ipynb @@ -230,7 +230,7 @@ "metadata": {}, "source": [ "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)" + "analysis = ag.AnalysisImaging(dataset=dataset)" ], "outputs": [], "execution_count": null diff --git a/notebooks/chapter_2_modeling/tutorial_3_why_modeling_is_hard.ipynb b/notebooks/chapter_2_modeling/tutorial_3_why_modeling_is_hard.ipynb index 6c741a3..0fa8492 100644 --- a/notebooks/chapter_2_modeling/tutorial_3_why_modeling_is_hard.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_3_why_modeling_is_hard.ipynb @@ -170,7 +170,7 @@ " )\n", " )\n", ")\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "search = af.Nautilus(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_2\"),\n", " name=\"tutorial_2_practicalities\",\n", diff --git a/notebooks/chapter_2_modeling/tutorial_4_linear_profiles.ipynb b/notebooks/chapter_2_modeling/tutorial_4_linear_profiles.ipynb index 8e067b2..755ad6b 100644 --- a/notebooks/chapter_2_modeling/tutorial_4_linear_profiles.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_4_linear_profiles.ipynb @@ -201,7 +201,7 @@ "metadata": {}, "source": [ "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "\n", "search = af.Nautilus(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_2\"),\n", diff --git a/notebooks/chapter_2_modeling/tutorial_5_data_and_likelihoods.ipynb b/notebooks/chapter_2_modeling/tutorial_5_data_and_likelihoods.ipynb index e51bd27..556f33f 100644 --- a/notebooks/chapter_2_modeling/tutorial_5_data_and_likelihoods.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_5_data_and_likelihoods.ipynb @@ -169,7 +169,7 @@ " galaxy=af.Model(ag.Galaxy, redshift=0.5, bulge=ag.lp_linear.Sersic)\n", " )\n", ")\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "\n", "search = af.Nautilus(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_2\"),\n", @@ -285,7 +285,7 @@ "metadata": {}, "source": [ "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "\n", "search = af.Nautilus(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_2\"),\n", diff --git a/notebooks/chapter_2_modeling/tutorial_6_search_chaining.ipynb b/notebooks/chapter_2_modeling/tutorial_6_search_chaining.ipynb index 088a80c..544adf0 100644 --- a/notebooks/chapter_2_modeling/tutorial_6_search_chaining.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_6_search_chaining.ipynb @@ -236,7 +236,7 @@ "metadata": {}, "source": [ "\n", - "analysis_1 = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis_1 = ag.AnalysisImaging(dataset=dataset)\n", "search_1 = af.MultiStartProdigy(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_2\"),\n", " name=\"tutorial_6_search_1\",\n", @@ -337,7 +337,7 @@ "metadata": {}, "source": [ "\n", - "analysis_2 = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis_2 = ag.AnalysisImaging(dataset=dataset)\n", "search_2 = af.Nautilus(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_2\"),\n", " name=\"tutorial_6_search_2\",\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_5_model_fit.ipynb b/notebooks/chapter_3_pixelizations/tutorial_5_model_fit.ipynb index 37c3ec9..ac7751f 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_5_model_fit.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_5_model_fit.ipynb @@ -157,9 +157,7 @@ " n_live=100,\n", " n_batch=50,\n", ")\n", - "result_1 = search_1.fit(\n", - " model=model_1, analysis=ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", - ")\n", + "result_1 = search_1.fit(model=model_1, analysis=ag.AnalysisImaging(dataset=dataset))\n", "aplt.subplot_fit_imaging(fit=result_1.max_log_likelihood_fit)" ], "outputs": [], @@ -214,9 +212,7 @@ " n_live=50,\n", " n_batch=50,\n", ")\n", - "result_2 = search_2.fit(\n", - " model=model_2, analysis=ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", - ")\n", + "result_2 = search_2.fit(model=model_2, analysis=ag.AnalysisImaging(dataset=dataset))\n", "fit_2 = result_2.max_log_likelihood_fit\n", "aplt.subplot_fit_imaging(fit=fit_2)\n", "mapper_2 = fit_2.inversion.cls_list_from(ag.Mapper)[0]\n", @@ -266,9 +262,7 @@ " n_live=100,\n", " n_batch=50,\n", ")\n", - "result_3 = search_3.fit(\n", - " model=model_3, analysis=ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", - ")\n", + "result_3 = search_3.fit(model=model_3, analysis=ag.AnalysisImaging(dataset=dataset))\n", "fit_3 = result_3.max_log_likelihood_fit\n", "aplt.subplot_fit_imaging(fit=fit_3)\n", "mapper_3 = fit_3.inversion.cls_list_from(ag.Mapper)[0]\n", diff --git a/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb b/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb index 0dc41d3..f296a7c 100644 --- a/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb +++ b/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb @@ -350,7 +350,7 @@ " n_batch=50, # GPU batching and VRAM use explained in chapter 2 tutorial 2.\n", ")\n", "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "\n", "print(\n", " \"The non-linear search has begun running - checkout the HowToGalaxy/output/howtogalaxy/chapter_4/tutorial_1_extra_galaxies_noise_scaling\"\n", @@ -565,7 +565,7 @@ " n_batch=50, # GPU batching and VRAM use explained in chapter 2 tutorial 2.\n", ")\n", "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "\n", "print(\n", " \"The non-linear search has begun running - checkout the HowToGalaxy/output/howtogalaxy/chapter_4/tutorial_1_extra_galaxies_model\"\n", diff --git a/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb b/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb index 00e08b3..98a37ff 100644 --- a/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb +++ b/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb @@ -441,7 +441,7 @@ " n_batch=50, # GPU batching and VRAM use explained in chapter 2 tutorial 2.\n", ")\n", "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "\n", "print(\n", " \"The non-linear search has begun running - checkout the HowToGalaxy/output/howtogalaxy/chapter_4/tutorial_2_multi_galaxy\"\n", diff --git a/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb b/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb index 517a11b..6697372 100644 --- a/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb +++ b/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb @@ -419,7 +419,7 @@ " n_batch=50,\n", ")\n", "\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)" + "analysis = ag.AnalysisImaging(dataset=dataset)" ], "outputs": [], "execution_count": null diff --git a/notebooks/chapter_optional/tutorial_searches.ipynb b/notebooks/chapter_optional/tutorial_searches.ipynb index d8f97e6..33ab2b1 100644 --- a/notebooks/chapter_optional/tutorial_searches.ipynb +++ b/notebooks/chapter_optional/tutorial_searches.ipynb @@ -150,7 +150,7 @@ " galaxy=af.Model(ag.Galaxy, redshift=0.5, bulge=ag.lp_linear.Sersic)\n", " )\n", ")\n", - "analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)\n", + "analysis = ag.AnalysisImaging(dataset=dataset)\n", "search = af.MultiStartProdigy(\n", " path_prefix=Path(\"howtogalaxy\", \"chapter_optional\"),\n", " name=\"tutorial_searches_prodigy\",\n", diff --git a/scripts/chapter_2_modeling/tutorial_1_non_linear_search.py b/scripts/chapter_2_modeling/tutorial_1_non_linear_search.py index 5dad7b5..5425907 100644 --- a/scripts/chapter_2_modeling/tutorial_1_non_linear_search.py +++ b/scripts/chapter_2_modeling/tutorial_1_non_linear_search.py @@ -129,11 +129,12 @@ `log_likelihood_function` returns the score that guides the search. This is the same comparison you performed using `FitImaging` in chapter 1, now repeated automatically. -`use_jax=True` enables the numerical engine that accelerates these repeated calculations on a CPU or a compatible -GPU. You do not need to know how JAX works to use it. +The analysis chooses the numerical engine that accelerates these repeated calculations on a CPU or a compatible +GPU for you (pass `use_jax=True` or `use_jax=False` to choose it yourself). You do not need to know how JAX works +to use it. """ -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) """ __Nested Sampling__ diff --git a/scripts/chapter_2_modeling/tutorial_2_practicalities.py b/scripts/chapter_2_modeling/tutorial_2_practicalities.py index 0199c79..fc0a953 100644 --- a/scripts/chapter_2_modeling/tutorial_2_practicalities.py +++ b/scripts/chapter_2_modeling/tutorial_2_practicalities.py @@ -128,7 +128,7 @@ dataset. The search itself does not need to know how a galaxy image is calculated. """ -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) """ __Run Times__ diff --git a/scripts/chapter_2_modeling/tutorial_3_why_modeling_is_hard.py b/scripts/chapter_2_modeling/tutorial_3_why_modeling_is_hard.py index 7573a29..ceee5b9 100644 --- a/scripts/chapter_2_modeling/tutorial_3_why_modeling_is_hard.py +++ b/scripts/chapter_2_modeling/tutorial_3_why_modeling_is_hard.py @@ -90,7 +90,7 @@ ) ) ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) search = af.Nautilus( path_prefix=Path("howtogalaxy", "chapter_2"), name="tutorial_2_practicalities", diff --git a/scripts/chapter_2_modeling/tutorial_4_linear_profiles.py b/scripts/chapter_2_modeling/tutorial_4_linear_profiles.py index c957ea9..88fd9cd 100644 --- a/scripts/chapter_2_modeling/tutorial_4_linear_profiles.py +++ b/scripts/chapter_2_modeling/tutorial_4_linear_profiles.py @@ -110,7 +110,7 @@ model. Overall runtime depends on the data, hardware and search; there is no universal speed-up factor. """ -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) search = af.Nautilus( path_prefix=Path("howtogalaxy", "chapter_2"), diff --git a/scripts/chapter_2_modeling/tutorial_5_data_and_likelihoods.py b/scripts/chapter_2_modeling/tutorial_5_data_and_likelihoods.py index 9d870a3..d5e210f 100644 --- a/scripts/chapter_2_modeling/tutorial_5_data_and_likelihoods.py +++ b/scripts/chapter_2_modeling/tutorial_5_data_and_likelihoods.py @@ -89,7 +89,7 @@ galaxy=af.Model(ag.Galaxy, redshift=0.5, bulge=ag.lp_linear.Sersic) ) ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) search = af.Nautilus( path_prefix=Path("howtogalaxy", "chapter_2"), @@ -172,7 +172,7 @@ the model comparison. A search sees the returned score, not the reasons we chose a mask or excluded a neighbour. """ -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) search = af.Nautilus( path_prefix=Path("howtogalaxy", "chapter_2"), diff --git a/scripts/chapter_2_modeling/tutorial_6_search_chaining.py b/scripts/chapter_2_modeling/tutorial_6_search_chaining.py index 5c45948..02486ff 100644 --- a/scripts/chapter_2_modeling/tutorial_6_search_chaining.py +++ b/scripts/chapter_2_modeling/tutorial_6_search_chaining.py @@ -134,7 +134,7 @@ `batch_size=4` limits how many starts are evaluated together to keep memory use manageable. """ -analysis_1 = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis_1 = ag.AnalysisImaging(dataset=dataset) search_1 = af.MultiStartProdigy( path_prefix=Path("howtogalaxy", "chapter_2"), name="tutorial_6_search_1", @@ -202,7 +202,7 @@ likelihood definition are unchanged; the model and search have different roles in this second stage. """ -analysis_2 = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis_2 = ag.AnalysisImaging(dataset=dataset) search_2 = af.Nautilus( path_prefix=Path("howtogalaxy", "chapter_2"), name="tutorial_6_search_2", diff --git a/scripts/chapter_3_pixelizations/tutorial_5_model_fit.py b/scripts/chapter_3_pixelizations/tutorial_5_model_fit.py index 2ff708d..eba8bfe 100644 --- a/scripts/chapter_3_pixelizations/tutorial_5_model_fit.py +++ b/scripts/chapter_3_pixelizations/tutorial_5_model_fit.py @@ -99,9 +99,7 @@ n_live=100, n_batch=50, ) -result_1 = search_1.fit( - model=model_1, analysis=ag.AnalysisImaging(dataset=dataset, use_jax=True) -) +result_1 = search_1.fit(model=model_1, analysis=ag.AnalysisImaging(dataset=dataset)) aplt.subplot_fit_imaging(fit=result_1.max_log_likelihood_fit) """ @@ -145,9 +143,7 @@ n_live=50, n_batch=50, ) -result_2 = search_2.fit( - model=model_2, analysis=ag.AnalysisImaging(dataset=dataset, use_jax=True) -) +result_2 = search_2.fit(model=model_2, analysis=ag.AnalysisImaging(dataset=dataset)) fit_2 = result_2.max_log_likelihood_fit aplt.subplot_fit_imaging(fit=fit_2) mapper_2 = fit_2.inversion.cls_list_from(ag.Mapper)[0] @@ -186,9 +182,7 @@ n_live=100, n_batch=50, ) -result_3 = search_3.fit( - model=model_3, analysis=ag.AnalysisImaging(dataset=dataset, use_jax=True) -) +result_3 = search_3.fit(model=model_3, analysis=ag.AnalysisImaging(dataset=dataset)) fit_3 = result_3.max_log_likelihood_fit aplt.subplot_fit_imaging(fit=fit_3) mapper_3 = fit_3.inversion.cls_list_from(ag.Mapper)[0] diff --git a/scripts/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.py b/scripts/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.py index 1ada9ef..74554ca 100644 --- a/scripts/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.py +++ b/scripts/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.py @@ -214,7 +214,7 @@ n_batch=50, # GPU batching and VRAM use explained in chapter 2 tutorial 2. ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) print( "The non-linear search has begun running - checkout the HowToGalaxy/output/howtogalaxy/chapter_4/tutorial_1_extra_galaxies_noise_scaling" @@ -352,7 +352,7 @@ n_batch=50, # GPU batching and VRAM use explained in chapter 2 tutorial 2. ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) print( "The non-linear search has begun running - checkout the HowToGalaxy/output/howtogalaxy/chapter_4/tutorial_1_extra_galaxies_model" diff --git a/scripts/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.py b/scripts/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.py index 1c813d4..43fe571 100644 --- a/scripts/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.py +++ b/scripts/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.py @@ -294,7 +294,7 @@ n_batch=50, # GPU batching and VRAM use explained in chapter 2 tutorial 2. ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) print( "The non-linear search has begun running - checkout the HowToGalaxy/output/howtogalaxy/chapter_4/tutorial_2_multi_galaxy" diff --git a/scripts/chapter_4_scaling_up_galaxies/tutorial_3_cluster.py b/scripts/chapter_4_scaling_up_galaxies/tutorial_3_cluster.py index c12a7a7..b9d1cd8 100644 --- a/scripts/chapter_4_scaling_up_galaxies/tutorial_3_cluster.py +++ b/scripts/chapter_4_scaling_up_galaxies/tutorial_3_cluster.py @@ -272,7 +272,7 @@ n_batch=50, ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) """ __Model Fit__ diff --git a/scripts/chapter_optional/tutorial_searches.py b/scripts/chapter_optional/tutorial_searches.py index 1e8652c..b671d5d 100644 --- a/scripts/chapter_optional/tutorial_searches.py +++ b/scripts/chapter_optional/tutorial_searches.py @@ -80,7 +80,7 @@ galaxy=af.Model(ag.Galaxy, redshift=0.5, bulge=ag.lp_linear.Sersic) ) ) -analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True) +analysis = ag.AnalysisImaging(dataset=dataset) search = af.MultiStartProdigy( path_prefix=Path("howtogalaxy", "chapter_optional"), name="tutorial_searches_prodigy",