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
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,17 @@
"`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."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"\n",
"analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)"
"analysis = ag.AnalysisImaging(dataset=dataset)"
],
"outputs": [],
"execution_count": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"metadata": {},
"source": [
"\n",
"analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)"
"analysis = ag.AnalysisImaging(dataset=dataset)"
],
"outputs": [],
"execution_count": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions notebooks/chapter_2_modeling/tutorial_6_search_chaining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 3 additions & 9 deletions notebooks/chapter_3_pixelizations/tutorial_5_model_fit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions scripts/chapter_2_modeling/tutorial_1_non_linear_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
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 @@ -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__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/chapter_2_modeling/tutorial_4_linear_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions scripts/chapter_2_modeling/tutorial_5_data_and_likelihoods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions scripts/chapter_2_modeling/tutorial_6_search_chaining.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 3 additions & 9 deletions scripts/chapter_3_pixelizations/tutorial_5_model_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

"""
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
n_batch=50,
)

analysis = ag.AnalysisImaging(dataset=dataset, use_jax=True)
analysis = ag.AnalysisImaging(dataset=dataset)

"""
__Model Fit__
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 @@ -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",
Expand Down
Loading