diff --git a/docs/howtolens/chapter_1_introduction.md b/docs/howtolens/chapter_1_introduction.md index 401ba77a8..ffbf78423 100644 --- a/docs/howtolens/chapter_1_introduction.md +++ b/docs/howtolens/chapter_1_introduction.md @@ -1,31 +1,10 @@ -# Chapter 1: Strong Lensing - -In chapter 1, we introduce you to strong gravitational lensing and the core **PyAutoLens** API. - -**Colab** links to every tutorial are included. - -The chapter contains the following tutorials: - -[Tutorial 0: Visualization](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) -\- Setting up **PyAutoLens**'s visualization library. - -[Tutorial 1: Grids And Galaxies](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) -\- Using grids of (y,x) coordinates with galaxies made up of light profiles. +--- +orphan: true +--- -[Tutorial 2: Ray Tracing](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_2_ray_tracing.ipynb) -\- Using grids, galaxies and mass profiles to perform strong lens ray-tracing. - -[Tutorial 3: More Ray Tracing](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_3_more_ray_tracing.ipynb) -\- Advanced strong lens ray-tracing. - -[Tutorial 4: Point Sources](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_4_point_sources.ipynb) -\- How lensing calculations change when the source galaxy is a point source (e.g. a quasar). - -[Tutorial 5: Data](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_5_data.ipynb) -\- Loading and inspecting telescope imaging data of a strong lens. - -[Tutorial 6: Fitting](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_6_fitting.ipynb) -\- Fitting data with a strong lens model. +# Chapter 1: Strong Lensing -[Tutorial 7: Summary](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_7_summary.ipynb) -\- A summary of the chapter. +```{raw} html + +

This chapter is now on the HowToLens tutorials page.

+``` diff --git a/docs/howtolens/chapter_2_lens_modeling.md b/docs/howtolens/chapter_2_lens_modeling.md index 56737febf..371fbe0d1 100644 --- a/docs/howtolens/chapter_2_lens_modeling.md +++ b/docs/howtolens/chapter_2_lens_modeling.md @@ -1,26 +1,10 @@ -# Chapter 2: Lens Modeling - -In chapter 2, we model strong lenses using a non-linear search, learn why fits can fail, and chain searches to fit different components in stages. - -The chapter contains the following tutorials: - -[Tutorial 1: Non-linear Search](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb) -\- Use a non-linear search to explore model parameters and priors. - -[Tutorial 2: Practicalities](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb) -\- Configure a search, follow its progress and inspect its saved results. +--- +orphan: true +--- -[Tutorial 3: Why Modeling Is Hard](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_3_why_modeling_is_hard.ipynb) -\- Investigate difficult parameter spaces by adjusting priors, simplifying models and searching more thoroughly. - -[Tutorial 4: Linear Profiles](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_4_linear_profiles.ipynb) -\- Solve light-profile intensities with linear algebra and build flexible multi-Gaussian expansions. - -[Tutorial 5: Data and Likelihoods](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_5_data_and_likelihoods.ipynb) -\- Understand how datasets, masks and likelihoods determine which observations constrain the model. Use a positions likelihood penalty to guide lens modeling. - -[Tutorial 6: Search Chaining](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_6_search_chaining.ipynb) -\- Fit components in stages, using earlier results to fix their geometry in later searches. +# Chapter 2: Lens Modeling -[Tutorial 7: Summary](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_7_summary.ipynb) -\- Review the modeling workflow and choose what to explore next. +```{raw} html + +

This chapter is now on the HowToLens tutorials page.

+``` diff --git a/docs/howtolens/chapter_3_pixelizations.md b/docs/howtolens/chapter_3_pixelizations.md index 535e38829..b095bd577 100644 --- a/docs/howtolens/chapter_3_pixelizations.md +++ b/docs/howtolens/chapter_3_pixelizations.md @@ -1,23 +1,10 @@ -# Chapter 3: Pixelizations - -In chapter 3, we reconstruct complex source light on pixelized grids. We use Bayesian evidence to choose the smoothing strength, investigate fits that remain inadequate, and adapt the mesh and regularization to the light distribution. - -The chapter contains the following tutorials: - -[Tutorial 1: Pixelizations, Mappers and Inversions](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb) -\- Connect mesh points to image pixels and reconstruct complex source light with a linear inversion. +--- +orphan: true +--- -[Tutorial 2: Bayesian Regularization](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_2_bayesian_regularization.ipynb) -\- Compare log evidences to choose the regularization strength and examine its dependence on mesh resolution. - -[Tutorial 3: Borders](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_3_borders.ipynb) -\- Explore how masks and border relocation affect the extent and resolution of the source mesh. - -[Tutorial 4: Lens Modeling](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_4_lens_modeling.ipynb) -\- Fit lens mass and foreground light alongside a pixelized source, using search chaining and the positions likelihood penalty introduced in chapter 2. - -[Tutorial 5: Fit Problems](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_5_fit_problems.ipynb) -\- See why compact source light challenges mesh resolution and constant regularization, even after choosing the coefficient using evidence. +# Chapter 3: Pixelizations -[Tutorial 6: Adaptive Reconstruction](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_6_adaptive_reconstruction.ipynb) -\- Combine Delaunay meshes, Hilbert brightness adaptation and adaptive Split regularization in a chained lens-model fit. +```{raw} html + +

This chapter is now on the HowToLens tutorials page.

+``` diff --git a/docs/howtolens/chapter_4_scaling_up_lensing.md b/docs/howtolens/chapter_4_scaling_up_lensing.md index b6eb47f00..1b2281605 100644 --- a/docs/howtolens/chapter_4_scaling_up_lensing.md +++ b/docs/howtolens/chapter_4_scaling_up_lensing.md @@ -1,24 +1,10 @@ -# Chapter 4: Scaling Up Lensing - -In chapter 4, we scale lens modeling up beyond a single lens galaxy: extra galaxies, multi-galaxy lenses, -scaling relations, group and cluster scales, and weak lensing. - -The chapter contains the following tutorials: - -[Tutorial 1: Extra Galaxies](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb) -\- Handling nearby galaxies by scaling their light out of the fit or modeling them explicitly. +--- +orphan: true +--- -[Tutorial 2: Multi Galaxy](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb) -\- Modeling lenses with two or more co-dominant lens galaxies and the degeneracies this creates. - -[Tutorial 3: Scaling Relation](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.ipynb) -\- Tying galaxy masses to their luminosities so model complexity stops growing with each galaxy. - -[Tutorial 4: Group Scale](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb) -\- Modeling group-scale lenses with truncated dPIE members and an optional group dark matter halo. - -[Tutorial 5: Cluster Scale](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.ipynb) -\- Modeling cluster-scale lenses with point-source positions, the CSV interface and multi-plane ray tracing. +# Chapter 4: Scaling Up Lensing -[Tutorial 6: Weak Lensing](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.ipynb) -\- Fitting weak-lensing shear catalogues, which probe mass far beyond the strong lensing region. +```{raw} html + +

This chapter is now on the HowToLens tutorials page.

+``` diff --git a/docs/howtolens/chapter_optional.md b/docs/howtolens/chapter_optional.md index e0ad38bb3..2a8b41c21 100644 --- a/docs/howtolens/chapter_optional.md +++ b/docs/howtolens/chapter_optional.md @@ -1,14 +1,10 @@ -# Optional Tutorials - -These tutorials expand on search choices and runtime after the main modeling chapter. Prior passing is retained as historical background. - -The chapter contains the following tutorials: +--- +orphan: true +--- -[Tutorial: Alternative Searches](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_optional/tutorial_searches.ipynb) -\- Explore alternative search settings, optimisation and Markov chain Monte Carlo. - -[Tutorial: Need for Speed](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_optional/tutorial_need_for_speed.ipynb) -\- Understand search effort, likelihood cost, JAX compilation, batching and hardware when assessing runtime. +# Optional Tutorials -[Historical Tutorial: Prior Passing](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_optional/tutorial_prior_passing.ipynb) -\- Read about older workflows that narrowed priors between searches. For the recommended component-separation approach, follow chapter 2 tutorial 6. +```{raw} html + +

This chapter is now on the HowToLens tutorials page.

+``` diff --git a/docs/howtolens/howtolens.md b/docs/howtolens/howtolens.md index 6c7194281..698e005df 100644 --- a/docs/howtolens/howtolens.md +++ b/docs/howtolens/howtolens.md @@ -1,77 +1,37 @@ (howtolens)= -# HowToLens Lectures +# HowToLens -The best way to learn **PyAutoLens** is by going through the **HowToLens** lecture series, which lives in its own -repository at [PyAutoLabs/HowToLens](https://github.com/PyAutoLabs/HowToLens). +Learn gravitational lensing and Bayesian modelling through worked Python notebooks with **PyAutoLens**. The course starts with simple models and builds towards fitting observations and analysing more complex systems. -The lectures are provided as Jupyter notebooks (and Python scripts), and they are linked to via this readthedocs. The -lectures are composed of four chapters: +Basic Python familiarity is useful. You do not need previous experience with lensing or Bayesian statistics. -- **Introduction** - An introduction to strong gravitational lensing and **PyAutolens**. -- **Lens Modeling** - How to model strong lenses, including a primer on Bayesian non-linear analysis and - non-linear search chaining. -- **Pixelizations** - Reconstruct complex source light, choose regularization using Bayesian evidence, - diagnose fit problems and adapt the mesh and smoothing to the light distribution. -- **Scaling Up Lensing** - Extra galaxies, multi-galaxy lenses, scaling relations, group and cluster - scales, and weak lensing. +## Start here -Optional tutorials cover alternative searches and runtime, with prior passing retained as historical background. +**Tutorial 0: Visualization** — [GitHub](https://github.com/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) / [Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) -The tutorial links open the current course on `main`. For the notebooks associated with a particular release, -select that release tag in the [HowToLens repository](https://github.com/PyAutoLabs/HowToLens/tags). +Check your setup and learn how to display figures. In Colab, run the setup cell first, then work through the notebook in order. -## How to Tackle HowToLens +You can also run the notebooks locally or use the [Python scripts](https://github.com/PyAutoLabs/HowToLens/tree/main/scripts). -The HowToLens lecture series currently sits at 4 chapters, and each will take around 3-6 hours to go through thoroughly. -You probably want to be modeling lenses faster than that! Furthermore, the concepts in the -later chapters are pretty challenging, and familiarity and lens modeling is desirable before you -tackle them. +## Choose a chapter -Therefore, we recommend that you complete chapters 1 & 2 and then apply what you've learnt to the modeling of simulated -and real strong lenses imaging, using the scripts found in the -[autolens_workspace](https://github.com/PyAutoLabs/autolens_workspace) `modeling` packages. Once you're -confident with your use of **PyAutoLens**, you can then begin to cover the advanced functionality covered in chapters -3 & 4. +GitHub opens the chapter’s notebook folder. Colab opens its first tutorial; the optional section opens Alternative Searches. -## Lensing Theory +| Chapter | What you’ll learn | Before you start | Open | +| --- | --- | --- | --- | +| 1. Strong Lensing | Build galaxies, trace light, simulate observations and compare model images with data. | Basic Python; lensing concepts are introduced as you go. | [GitHub](https://github.com/PyAutoLabs/HowToLens/tree/main/notebooks/chapter_1_introduction) / [Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) | +| 2. Lens Modeling | Fit lens models with Bayesian searches, inspect results and fit components in stages. | Chapter 1: ray tracing, data, residuals and likelihoods. | [GitHub](https://github.com/PyAutoLabs/HowToLens/tree/main/notebooks/chapter_2_lens_modeling) / [Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb) | +| 3. Pixelizations | Reconstruct background-source light on a mesh; choose smoothing using Bayesian evidence and improve the reconstruction. | Chapter 2, including search chaining and positions constraints. | [GitHub](https://github.com/PyAutoLabs/HowToLens/tree/main/notebooks/chapter_3_pixelizations) / [Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb) | +| 4. Scaling Up Lensing | Model multiple deflectors, groups and clusters; progress from extended images to image positions and weak-lensing shear. | Chapter 2 and the pixelized-source methods introduced in Chapter 3. | [GitHub](https://github.com/PyAutoLabs/HowToLens/tree/main/notebooks/chapter_4_scaling_up_lensing) / [Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb) | +| Optional tutorials | Explore alternative searches and runtime. Prior passing is historical background. | Chapter 2. | [GitHub](https://github.com/PyAutoLabs/HowToLens/tree/main/notebooks/chapter_optional) / [Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_optional/tutorial_searches.ipynb) | -**HowToLens** assumes minimal previous knowledge of gravitational lensing and astronomy. However, it is beneficial to -give yourself a basic theoretical grounding as you go through the lectures. I heartily recommend you have open the -lecture course on gravitational lensing by Massimo Meneghetti below as you go through the tutorials, and refer to it -for anything that isn't clear in **HowToLens**. +Work through Chapters 1 and 2, then practise with the [workspace examples](https://github.com/PyAutoLabs/autolens_workspace#find-your-examples). Return to Chapters 3 and 4 when you need their methods. - +These links follow the current course on `main`. For a particular release, choose its tag in the [course repository](https://github.com/PyAutoLabs/HowToLens/tags). -## Visualization +## Help as you learn -Before beginning the **HowToLens** lecture series, in chapter 1 you should do 'tutorial_0_visualization'. This will -take you through how **PyAutoLens** interfaces with matplotlib to perform visualization and will get you setup such -that images and figures display correctly in your Jupyter notebooks. +If you want AI-guided help, the [PyAutoLens AI Assistant](https://github.com/PyAutoLabs/autolens_assistant) can discuss the concepts, code and figures as you work through the notebooks. -## Jupyter Notebooks - -The tutorials are supplied as Jupyter Notebooks, which come with a '.ipynb' suffix. For those new to Python, Jupyter -Notebooks are a different way to write, view and use Python code. Compared to the traditional Python scripts, they allow: - -- Small blocks of code to be viewed and run at a time -- Images and visualization from a code to be displayed directly underneath it. -- Text script to appear between the blocks of code. - -This makes them an ideal way for us to present the HowToLens lecture series, therefore I recommend you get yourself -a Jupyter notebook viewer () if you haven't done so already. - -If you *really* want to use Python scripts, all tutorials are also supplied as `.py` files in the `scripts` folder -of the [HowToLens repository](https://github.com/PyAutoLabs/HowToLens). - -## Code Style and Formatting - -You may notice the style and formatting of our Python code looks different to what you are used to. For example, it -is common for brackets to be placed on their own line at the end of function calls, the inputs of a function or -class may be listed over many separate lines and the code in general takes up a lot more space then you are used to. - -This is intentional, because we believe it makes the cleanest, most readable code possible. In fact, lots of people do, -which is why we use an auto-formatter to produce the code in a standardized format. If you're interested in the style -and would like to adapt it to your own code, check out the Python auto-code formatter 'black'. - - +For additional theory, refer to [Massimo Meneghetti’s gravitational-lensing lectures](http://www.ita.uni-heidelberg.de/~massimo/sub/Lectures/gl_all.pdf). diff --git a/docs/index.md b/docs/index.md index 53dc75c39..e2242fc79 100644 --- a/docs/index.md +++ b/docs/index.md @@ -103,11 +103,6 @@ general/community :maxdepth: 1 howtolens/howtolens -howtolens/chapter_1_introduction -howtolens/chapter_2_lens_modeling -howtolens/chapter_3_pixelizations -howtolens/chapter_4_scaling_up_lensing -howtolens/chapter_optional ``` ```{toctree}