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
9 changes: 5 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ instructions for this repo.

- `scripts/` — Runnable Python tutorial scripts:
- `chapter_1_introduction/` — Grids, light profiles, galaxies, data, fitting
- `chapter_2_modeling/` — Non-linear searches, Bayesian inference, galaxy modeling
- `chapter_3_pixelizations/` — Pixelized reconstruction, inversions, regularization, the Bayesian
formalism
- `chapter_2_modeling/` — Non-linear searches, practicalities, difficult fits, linear profiles,
data and likelihoods, component-based search chaining
- `chapter_3_pixelizations/` — Pixelized reconstruction, mappings, inversions, evidence-guided
regularization, fit problems, adaptive reconstruction and combined analytic/pixelized fits
- `chapter_4_scaling_up_galaxies/` — Extra galaxies, blended multi-galaxy systems, cluster fields
- `chapter_optional/` — Alternative searches and advanced topics
- `chapter_optional/` — Alternative searches, runtime and historical prior passing
- `simulators/` — Simulator scripts that generate the tutorial datasets at runtime
- `notebooks/` — Jupyter versions, generated from `scripts/` (do not edit directly)
- `config/` — PyAutoGalaxy configuration YAML
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# HowToGalaxy

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/start_here.ipynb)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/start_here.ipynb)

[Start Here on Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/start_here.ipynb) |
[Start Here on Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/start_here.ipynb) |
[Installation Guide](https://pyautogalaxy.readthedocs.io/en/latest/installation/overview.html) |
[PyAutoGalaxy readthedocs](https://pyautogalaxy.readthedocs.io/en/latest/index.html) |
[Browse Chapter 1 With Images](markdown/README.md) |
Expand Down Expand Up @@ -31,8 +31,8 @@ more appropriate — they are concise and assume the concepts taught in **HowToG
profiles, galaxies, simulated imaging data, and fitting.
- `chapter_2_modeling` — Bayesian inference, non-linear searches, and how to fit a galaxy model to CCD
imaging data with **PyAutoGalaxy**, ending with search chaining and automated pipelines.
- `chapter_3_pixelizations` — Pixelized reconstructions (inversions) for galaxies with irregular
morphologies, including the Bayesian formalism underpinning them.
- `chapter_3_pixelizations` — Pixelized reconstructions for galaxies with irregular morphologies, choosing
regularization using Bayesian evidence, fit problems and adaptive reconstruction.
- `chapter_4_scaling_up_galaxies` — Scaling galaxy modeling up beyond a single galaxy: extra galaxies,
blended multi-galaxy systems, and cluster fields.
- `chapter_optional` — Optional tutorials on alternative non-linear searches and other advanced topics.
Expand Down Expand Up @@ -78,15 +78,15 @@ output figures inline. Nothing runs and nothing installs — you just read it. T
skimming a tutorial before running it, or for reading on a phone. Markdown pages currently exist only
for the chapter 1 tutorials listed with a `markdown` link below; every other tutorial is Colab-only.

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

- **[Chapter 1: Introduction](scripts/chapter_1_introduction/README.md)** — Grids, light profiles, galaxies, simulated imaging data, and fitting.
- Tutorial 0: Visualization — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/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/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_1_grids_and_galaxies.md))
- Tutorial 2: Data — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_2_data.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_2_data.md))
- Tutorial 3: Fitting — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_3_fitting.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_3_fitting.md))
- Tutorial 4: Methods — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_4_methods.ipynb))
- Tutorial 5: Summary — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_5_summary.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_5_summary.md))
- Tutorial 0: Visualization — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/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/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_1_grids_and_galaxies.md))
- Tutorial 2: Data — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_2_data.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_2_data.md))
- Tutorial 3: Fitting — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_3_fitting.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_3_fitting.md))
- Tutorial 4: Methods — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_4_methods.ipynb))
- Tutorial 5: Summary — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_5_summary.ipynb) / [markdown](markdown/chapter_1_introduction/tutorial_5_summary.md))
- **[Chapter 2: Modeling](scripts/chapter_2_modeling/README.md)** — Practical galaxy models, data and likelihoods, linear profiles and search chaining.
- Tutorial 1: Non-linear Search — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_2_modeling/tutorial_1_non_linear_search.ipynb))
- Tutorial 2: Practicalities — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_2_modeling/tutorial_2_practicalities.ipynb))
Expand All @@ -103,9 +103,9 @@ for the chapter 1 tutorials listed with a `markdown` link below; every other tut
- Tutorial 5: Model Fit — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_5_model_fit.ipynb))

- **[Chapter 4: Scaling Up Galaxies](scripts/chapter_4_scaling_up_galaxies/README.md)** — Extra galaxies, blended multi-galaxy systems, and cluster fields.
- Tutorial 1: Extra Galaxies — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb))
- Tutorial 2: Multi Galaxy — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb))
- Tutorial 3: Cluster — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb))
- Tutorial 1: Extra Galaxies — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb))
- Tutorial 2: Multi Galaxy — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb))
- Tutorial 3: Cluster — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb))
- **[Optional Tutorials](scripts/chapter_optional/)** — Alternative non-linear searches and advanced topics.
- Alternative Searches — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_optional/tutorial_searches.ipynb))
- Need for Speed — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_optional/tutorial_need_for_speed.ipynb))
Expand Down
3 changes: 2 additions & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ real analysis?" below).

- **Chapter 1 — Introduction** → [scripts/chapter_1_introduction/](scripts/chapter_1_introduction/): Galaxies from first principles: grids & galaxies, light profiles, simulating data, and fitting data. The conceptual foundation.
- **Chapter 2 — Modeling** → [scripts/chapter_2_modeling/](scripts/chapter_2_modeling/): Fitting a galaxy model to data with a non-linear search — practicalities, difficult fits, linear profiles, data and likelihoods, and component-based search chaining.
- **Chapter 3 — Pixelizations** → [scripts/chapter_3_pixelizations/](scripts/chapter_3_pixelizations/): Reconstructing galaxy structure on a mesh — indexed mappings, inversions, Bayesian regularization, fit problems, adaptive reconstruction and combined MGE/pixelization search chaining.
- **Chapter 3 — Pixelizations** → [scripts/chapter_3_pixelizations/](scripts/chapter_3_pixelizations/): Reconstructing galaxy structure on a mesh — indexed mappings, inversions, evidence-guided regularization, fit problems, adaptive reconstruction and combined analytic/pixelized fits.
- **Chapter 4 — Scaling Up Galaxies** → [scripts/chapter_4_scaling_up_galaxies/](scripts/chapter_4_scaling_up_galaxies/): Beyond a single galaxy — extra galaxies, blended multi-galaxy systems, and cluster fields.

## I want to understand…
Expand All @@ -40,6 +40,7 @@ real analysis?" below).
- **How do I model an image with two galaxies?** → [scripts/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.py](scripts/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.py): Joint fitting of blended galaxies and their degeneracies.
- **How do I reconstruct irregular structure on a pixel grid?** → [scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py](scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py) through [tutorial_5_model_fit.py](scripts/chapter_3_pixelizations/tutorial_5_model_fit.py).

- **How do I choose the regularization strength?** → [tutorial_2_bayesian_regularization.py](scripts/chapter_3_pixelizations/tutorial_2_bayesian_regularization.py): Compare log evidences and inspect how mesh resolution affects the preferred coefficient.
- **Why does a regularized reconstruction still leave residuals?** → [tutorial_3_fit_problems.py](scripts/chapter_3_pixelizations/tutorial_3_fit_problems.py): Mesh resolution, concentrated light and the limits of smoothing.
- **How can the mesh and smoothing follow galaxy brightness?** → [tutorial_4_adaptive_reconstruction.py](scripts/chapter_3_pixelizations/tutorial_4_adaptive_reconstruction.py): Hilbert sampling and adaptive regularization, compared using log evidence.

Expand Down
21 changes: 11 additions & 10 deletions notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ The `HowToGalaxy` folder contains **HowToGalaxy** lectures, which teach a new us

- `chapter_1_introduction`: An introduction to galaxy morphology and structure using **PyAutoGalaxy**.
- `chapter_2_modeling`: How to model galaxies, with data, models, Analysis objects and searches.
- `chapter_3_pixelizations`: How to perform pixelized reconstructions of a galaxy.
- `chapter_3_pixelizations`: Reconstruct complex galaxy light, choose regularization using Bayesian
evidence, diagnose fit problems and adapt the mesh and smoothing.
- `chapter_4_scaling_up_galaxies`: How to scale up modeling to multiple galaxies, from blended pairs to cluster fields.
- `chapter_optional`: Optional tutorials.
- `chapter_optional`: Alternative searches, runtime and historical prior passing.
- `simulators`: Scripts used to simulate the galaxy datasets fitted throughout the **HowToGalaxy** lectures.

# Full Explanation
Expand Down Expand Up @@ -95,15 +96,15 @@ fit CCD imaging data of a galaxy with a model. At the end, you'll understand:

**Using an inversion to perform a pixelized morphology reconstruction**

In chapter 3, we'll learn how to reconstruct the morphological features of a galaxy using a pixel-grid, ensuring
that we can fit an accurate model to galaxies with complex and irregular morphologies. You'll learn how to:
In chapter 3, we'll reconstruct complex galaxy light using a pixel-grid, compare reconstructions using Bayesian
evidence, and investigate where the mesh and smoothing limit the fit. You'll learn how to:

1. Pixelize a galaxy reconstruction into pixels.
2. Perform a linear inversion using this pixelization to reconstruct the galaxy's light.
3. Apply a smoothness prior on the galaxy reconstruction, called regularization.
4. Apply smoothing within a Bayesian framework to objectively quantify the reconstruction's complexity.
5. Write down the linear algebra and Bayesian evidence equations that underpin the whole framework.
6. Use these features to fit a model via non-linear searches.
1. Connect reconstruction mesh points to image pixels through mappings.
2. Solve for the galaxy's brightness using a linear inversion.
3. Apply regularization and compare log evidences to choose its strength.
4. Diagnose compact-galaxy fit problems that remain after choosing the regularization coefficient.
5. Combine Delaunay meshes, Hilbert brightness adaptation and adaptive Split regularization.
6. Fit a smooth analytic light component alongside a pixelization.

# OVERVIEW OF CHAPTER 4 (Advanced)

Expand Down
12 changes: 6 additions & 6 deletions notebooks/chapter_1_introduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ In chapter 1, we introduce you to galaxies, the light they emit and the core **P

# Files

- [Tutorial 0: Visualization](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) — Setting up **PyAutoGalaxy**'s visualization library.
- [Tutorial 0: Visualization](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb) — Setting up **PyAutoGalaxy**'s visualization library.

- [Tutorial 1: Grids And Galaxies](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) — How grids of (y,x) coordinates are used to create images of galaxies that ultimately quantify their morphology.
- [Tutorial 1: Grids And Galaxies](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb) — How grids of (y,x) coordinates are used to create images of galaxies that ultimately quantify their morphology.

- [Tutorial 2: Data](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_2_data.ipynb) — Simulating and inspecting telescope imaging data of a galaxy, for example from the Hubble Space Telescope.
- [Tutorial 2: Data](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_2_data.ipynb) — Simulating and inspecting telescope imaging data of a galaxy, for example from the Hubble Space Telescope.

- [Tutorial 3: Fitting](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_3_fitting.ipynb) — How to fit imaging data of a galaxy and quantify whether a fit is good or bad.
- [Tutorial 3: Fitting](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_3_fitting.ipynb) — How to fit imaging data of a galaxy and quantify whether a fit is good or bad.

- [Tutorial 4: Methods](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_4_methods.ipynb) — An overview of the different methods used to fit galaxies with.
- [Tutorial 4: Methods](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_4_methods.ipynb) — An overview of the different methods used to fit galaxies with.

- [Tutorial 5: Summary](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_1_introduction/tutorial_5_summary.ipynb) — A summary of the chapter.
- [Tutorial 5: Summary](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_1_introduction/tutorial_5_summary.ipynb) — A summary of the chapter.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/chapter_2_modeling/tutorial_7_summary.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions notebooks/chapter_4_scaling_up_galaxies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ systems, and cluster fields.

# Files

- [Tutorial 1: Extra Galaxies](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb) — Handling nearby galaxies by scaling their light out of the fit or modeling them explicitly.
- [Tutorial 1: Extra Galaxies](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_4_scaling_up_galaxies/tutorial_1_extra_galaxies.ipynb) — Handling nearby galaxies by scaling their light out of the fit or modeling them explicitly.

- [Tutorial 2: Multi Galaxy](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb) — Modeling two or more blended galaxies simultaneously and the degeneracies this creates.
- [Tutorial 2: Multi Galaxy](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb) — Modeling two or more blended galaxies simultaneously and the degeneracies this creates.

- [Tutorial 3: Cluster](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.11.1.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb) — Modeling a cluster field's BCG and catalogue-driven member population.
- [Tutorial 3: Cluster](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_4_scaling_up_galaxies/tutorial_3_cluster.ipynb) — Modeling a cluster field's BCG and catalogue-driven member population.
2 changes: 1 addition & 1 deletion notebooks/chapter_optional/tutorial_need_for_speed.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/chapter_optional/tutorial_prior_passing.ipynb

Large diffs are not rendered by default.

Loading
Loading