Skip to content
Merged
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
54 changes: 40 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
Welcome to **HowToLens** — the tutorial lecture series for [PyAutoLens](https://github.com/PyAutoLabs/PyAutoLens),
an open-source library for strong gravitational lens modeling.

**HowToLens** teaches new users what strong gravitational lensing is and how to model it from scratch. It assumes
minimal prior knowledge of astronomy or statistics and takes you from first principles all the way to using
**PyAutoLens** for professional scientific research.
**PyAutoLens** can be used with an AI coding agent to compose lens models, fit data and explore results
**using natural language**. **HowToLens** teaches the core principles behind this workflow, so you
understand the science and inference being performed rather than treating them as a black box.

The tutorials assume minimal prior knowledge of astronomy or statistics. They start from first principles:
grids, light and mass profiles, and ray-tracing, then progress to Bayesian lens modeling, pixelized
source reconstructions and group- and cluster-scale lenses.

For experienced scientists who already know the fundamentals of strong lensing and Bayesian modeling, the
[autolens_workspace](https://github.com/PyAutoLabs/autolens_workspace) examples will be more appropriate —
Expand All @@ -40,11 +44,33 @@ We recommend completing chapters 1 and 2, then applying what you've learned to r

## Getting Started

### Study with the assistant

Use the [Jupyter notebooks](notebooks/) to run the code (recommended), or read the
available [Markdown lectures](markdown/README.md) directly on GitHub.

For help alongside the lectures, open the [autolens_assistant](https://github.com/PyAutoLabs/autolens_assistant)
repository in your AI coding agent, following its setup instructions, and paste:

```text
Enter teacher mode.

I want to work through the HowToLens lectures. Show me where to find them
and how to use Jupyter Notebook or Markdown, then help me with questions
as I go.
```

The assistant can answer questions about concepts, equations, code and results as you study, and help with
notebook errors. Share the lecture link and section or the cell you are working on; you choose when to move on.

### Run in Google Colab (nothing to install)

Every tutorial opens in Google Colab in one click. There is nothing to install and no local Python
environment to set up — **PyAutoLens** installs itself in the notebook's first cell. In Colab you *run*
the tutorial: edit the code, change the model, and see the output for yourself.
Every tutorial opens in Google Colab in one click. There is nothing to install on your own machine and
no local Python environment to set up — **PyAutoLens** installs itself in the notebook's first cell.
In Colab you *run* the tutorial: edit the code, change the model, and see the output for yourself.

Whilst in Colab, you can use **Gemini** as a study assistant alongside the lecture: ask it to explain an
equation, unpack what a cell is doing, or help interpret the output of a fit.

The `markdown` links are the same tutorial already executed and rendered on GitHub, with its real
output figures inline. Nothing runs and nothing installs — you just read it. They are good for
Expand All @@ -53,17 +79,17 @@ for the chapter 1 tutorials listed with a `markdown` link below; every other tut

**[Start Here](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/start_here.ipynb)** — a one-page overview of the whole series.

- **[Chapter 1: Introduction](scripts/chapter_1_introduction/README.md)** — An introduction to strong gravitational lensing and **PyAutoLens**: grids, light and mass profiles, galaxies, ray-tracing, point sources, the lensing formalism, simulated imaging data, and fitting.
- **[Chapter 1: Introduction](scripts/chapter_1_introduction/README.md)** — Grids, light and mass profiles, galaxies, ray-tracing, point sources, the lensing formalism, data, and fitting.
- Tutorial 0: Visualization — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_0_visualization.md))
- Tutorial 1: Grids And Galaxies — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_1_grids_and_galaxies.md))
- Tutorial 1: Grids and Galaxies — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_1_grids_and_galaxies.md))
- Tutorial 2: Ray Tracing — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_2_ray_tracing.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_2_ray_tracing.md))
- Tutorial 3: More Ray Tracing — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_3_more_ray_tracing.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_3_more_ray_tracing.md))
- Tutorial 4: Point Sources — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_4_point_sources.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_4_point_sources.md))
- Tutorial 5: Lensing Formalism — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_5_lensing_formalism.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_5_lensing_formalism.md))
- Tutorial 6: Data — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_6_data.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_6_data.md))
- Tutorial 7: Fitting — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_7_fitting.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_7_fitting.md))
- Tutorial 8: Summary — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_1_introduction/tutorial_8_summary.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_8_summary.md))
- **[Chapter 2: Lens Modeling](scripts/chapter_2_lens_modeling/README.md)** — Bayesian inference, non-linear searches, and how to fit a lens model to CCD imaging data with **PyAutoLens**, ending with search chaining and automated pipelines.
- **[Chapter 2: Lens Modeling](scripts/chapter_2_lens_modeling/README.md)** — Bayesian inference, non-linear searches, lens modeling, search chaining, prior passing, and SLaM pipelines.
- Tutorial 1: Non-linear Search — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb))
- Tutorial 2: Practicalities — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb))
- Tutorial 3: Realism and Complexity — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_2_lens_modeling/tutorial_3_realism_and_complexity.ipynb))
Expand All @@ -75,7 +101,7 @@ for the chapter 1 tutorials listed with a `markdown` link below; every other tut
- Tutorial 9: Search Chaining — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb))
- Tutorial 10: Prior Passing — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb))
- Tutorial 11: SLaM — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_2_lens_modeling/tutorial_11_slam.ipynb))
- **[Chapter 3: Pixelizations](scripts/chapter_3_pixelizations/README.md)** — Pixelized source reconstructions (inversions) for sources with irregular morphologies, including the Bayesian formalism underpinning them.
- **[Chapter 3: Pixelizations](scripts/chapter_3_pixelizations/README.md)** — Pixelized source reconstructions, inversions, the Bayesian formalism, and adaptive pixelizations and regularization.
- Tutorial 1: Pixelizations — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb))
- Tutorial 2: Mappers — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb))
- Tutorial 3: Inversions — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb))
Expand All @@ -88,17 +114,17 @@ for the chapter 1 tutorials listed with a `markdown` link below; every other tut
- Tutorial 10: Fit Problems — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_3_pixelizations/tutorial_10_fit_problems.ipynb))
- Tutorial 11: Brightness Adaption — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_3_pixelizations/tutorial_11_brightness_adaption.ipynb))
- Tutorial 12: Adaptive Regularization — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_3_pixelizations/tutorial_12_adaptive_regularization.ipynb))
- **[Chapter 4: Scaling Up Lensing](scripts/chapter_4_scaling_up_lensing/README.md)** — Scaling lens modeling up beyond a single lens galaxy: extra galaxies, multi-galaxy lenses, scaling relations, group and cluster scales, and weak lensing.
- **[Chapter 4: Scaling Up Lensing](scripts/chapter_4_scaling_up_lensing/README.md)** — Extra galaxies, multi-galaxy lenses, scaling relations, group and cluster scales, and weak lensing.
- Tutorial 1: Extra Galaxies — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb))
- Tutorial 2: Multi Galaxy — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb))
- Tutorial 3: Scaling Relation — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.ipynb))
- Tutorial 4: Group Scale — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb))
- Tutorial 5: Cluster Scale — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.ipynb))
- Tutorial 6: Weak Lensing — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.ipynb))
- **[Optional Chapter](scripts/chapter_optional/)** — Optional tutorials on alternative non-linear searches and other advanced topics.
- Tutorial: Alternative Searches — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_optional/tutorial_searches.ipynb))
- **[Optional Tutorials](scripts/chapter_optional/)** — Alternative non-linear searches and advanced topics.
- Tutorial Optional: Searches — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/2026.9.27.2/notebooks/chapter_optional/tutorial_searches.ipynb))

Model-fits run considerably faster on a GPU. In Colab, enable one via *Runtime* → *Change runtime type*
Model-fits can run faster on a GPU. In Colab, enable one via *Runtime* → *Change runtime type*
→ *Hardware accelerator* before running a notebook.

### Run on your own machine
Expand Down
Loading