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
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ for the chapter 1 tutorials listed with a `markdown` link below; every other tut
- Tutorial 8: Need for Speed — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_2_modeling/tutorial_8_need_for_speed.ipynb))
- Tutorial 9: Search Chaining — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_2_modeling/tutorial_9_search_chaining.ipynb))
- Tutorial 10: Prior Passing — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_2_modeling/tutorial_10_prior_passing.ipynb))
- **[Chapter 3: Pixelizations](scripts/chapter_3_pixelizations/README.md)** — Pixelized galaxy reconstructions, inversions, regularization, and the Bayesian formalism.
- Tutorial 1: Pixelizations — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb))
- Tutorial 2: Mappers — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb))
- Tutorial 3: Inversions — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb))
- Tutorial 4: Bayesian Regularization — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb))
- Tutorial 5: Bayesian Formalism — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_5_bayesian_formalism.ipynb))
- Tutorial 6: Model Fit — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_6_model_fit.ipynb))
- **[Chapter 3: Pixelizations](scripts/chapter_3_pixelizations/README.md)** — Indexed mappings, inversions, regularization and MGE search chaining.
- Tutorial 1: Pixelizations — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb))
- Tutorial 2: Bayesian Regularization — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_2_bayesian_regularization.ipynb))
- Tutorial 3: Model Fit — ([Colab](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_3_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.10.29.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.10.29.1/notebooks/chapter_4_scaling_up_galaxies/tutorial_2_multi_galaxy.ipynb))
Expand Down
18 changes: 6 additions & 12 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,12 @@ AUTO-GENERATED by PyAutoHands — do not edit by hand; regenerate with generate.

## chapter_3_pixelizations

- [Tutorial 1: Pixelizations](scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py): In the previous chapters, we used light profiles to model the light of a galaxy, where the light profile was an analytic description of how the luminosity varies as a function of radius.
- Contents: Initial Setup, Mesh, Wrap Up
- [Tutorial 2: Mappers](scripts/chapter_3_pixelizations/tutorial_2_mappers.py): In the previous tutorial, we used a pixelization to create a `Mapper`. However, it was not clear what a `Mapper` does, why it was called a mapper and whether it was mapping anything at all!
- Contents: Initial Setup, Dataset Auto-Simulation, Mappers, Mask, Wrap Up
- [Tutorial 3: Inversions](scripts/chapter_3_pixelizations/tutorial_3_inversions.py): In the previous two tutorials, we introduced:
- Contents: Initial Setup, Dataset Auto-Simulation, Pixelization, Positive Only Solver, Detailed Explanation, Wrap Up
- [Tutorial 4: Bayesian Regularization](scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py): So far, we have:
- Contents: Initial Setup, Dataset Auto-Simulation, Convenience Function, Pixelization, Regularization, Bayesian Evidence, Non-Linear and Linear, Detailed Description, Wrap Up
- [Tutorial 5: Bayesian Formalism](scripts/chapter_3_pixelizations/tutorial_5_bayesian_formalism.py): In tutorials 1 to 4, we built an intuition for how pixelized galaxy reconstruction works: pixelizations place a pixel-grid over the galaxy's image, mappers pair pixelization pixels with image-pixels, inversions solve for the pixel fluxes that best fit the data, and regularization smooths the solution within a Bayesian framework.
- Contents: Initial Setup, Dataset Auto-Simulation, Mask, Over Sampling, Mesh Shape, Galaxy, Image Grid, Mesh Pixel Centres, Interpolation, Mapper, Mapping Matrix, Blurred Mapping Matrix, Data Vector (D), Curvature Matrix (F), Unregularized Solve, Regularization Matrix (H), Galaxy Reconstruction (s), Image Reconstruction, Likelihood Function, Chi Squared, Regularization Term, Complexity Terms, Noise Normalization Term, Log Evidence, Fit, Wrap Up
- [Tutorial 6: Model Fit](scripts/chapter_3_pixelizations/tutorial_6_model_fit.py): In the previous tutorials we used an inversion to reconstruct a complex galaxy. However, from the perspective of a scientific analysis, it is not clear how useful this was. When we fit a galaxy with light profiles, we learn about its brightness (`intensity`), size (`effective_radius`), compactness (`sersic_index`), etc.
- Contents: Initial Setup, Dataset Auto-Simulation, Model + Search + Analysis + Model-Fit (Search 1), Mesh Shape, Model + Search + Analysis + Model-Fit (Search 2), Model + Search (Search 3), Wrap Up
- [Tutorial 1: Pixelizations, Mappers and Inversions](scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py): Look at a resolved galaxy image. Its broad light distribution may follow a smooth bulge and disc, while smaller regions contain bright star-forming knots, off-centre clumps or irregular extensions. A model can capture the overall galaxy yet leave these features clearly visible in the residual image.
- Contents: The image and its coordinates, A brightness mesh, Following the mappings, An inversion, A model image, Using FitImaging
- [Tutorial 2: Bayesian Regularization](scripts/chapter_3_pixelizations/tutorial_2_bayesian_regularization.py): (no summary in script docstring)
- Contents: Interpolation and our starting reconstruction., Reducing and increasing regularization., Bayesian evidence and a coefficient experiment., Inspecting the preferred reconstruction., Linear brightnesses and non-linear model choices., Comparing mesh resolutions.
- [Tutorial 3: Model Fit](scripts/chapter_3_pixelizations/tutorial_3_model_fit.py): A pixelization can describe a galaxy without assigning an analytic centre and shape to every visible feature. However, analytic profiles remain useful when we want to describe its smooth components. In this tutorial we combine an MGE with a pixelization and use search chaining to put the smooth light model in place first.
- Contents: Dataset, Search 1, Search 2, Search 3, Interpretation

## chapter_4_scaling_up_galaxies

Expand Down
4 changes: 2 additions & 2 deletions 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 — parameter spaces, priors, dealing with failure, linear light profiles, masking, and reading results.
- **Chapter 3 — Pixelizations** → [scripts/chapter_3_pixelizations/](scripts/chapter_3_pixelizations/): Reconstructing irregular galaxy structure on a pixel-grid instead of with light profiles — mappers, inversions, Bayesian regularization, the Bayesian formalism.
- **Chapter 3 — Pixelizations** → [scripts/chapter_3_pixelizations/](scripts/chapter_3_pixelizations/): Reconstructing galaxy structure on a mesh — indexed mappings, inversions, Bayesian regularization and combined MGE/pixelization search chaining.
- **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 @@ -38,7 +38,7 @@ real analysis?" below).
- **My fit found a wrong (local-maxima) solution — what do I do?** → [scripts/chapter_2_modeling/tutorial_4_dealing_with_failure.py](scripts/chapter_2_modeling/tutorial_4_dealing_with_failure.py): Prior tuning, reducing complexity, and looking harder.
- **What are linear light profiles / MGE?** → [scripts/chapter_2_modeling/tutorial_5_linear_profiles.py](scripts/chapter_2_modeling/tutorial_5_linear_profiles.py): Solving intensities linearly; the Multi-Gaussian Expansion basis.
- **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_4_bayesian_regularization.py](scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py).
- **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_3_model_fit.py](scripts/chapter_3_pixelizations/tutorial_3_model_fit.py).

## Ready for real analysis?

Expand Down
26 changes: 17 additions & 9 deletions notebooks/chapter_3_pixelizations/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
In chapter 3, we use **Pixelizations** to reconstruct the light of complex galaxies on pixelized grids.
Look at a resolved galaxy image. Its broad light distribution may follow a smooth bulge and disc, while smaller regions contain bright star-forming knots, off-centre clumps or irregular extensions. A model can capture the overall galaxy yet leave these features clearly visible in the residual image.

**Colab** links to every tutorial are included.
In Chapter 2, we introduced linear light profiles and multi-Gaussian expansions (MGEs). Combining Gaussians of different widths gives us a more flexible radial brightness distribution than a single Sérsic profile. Gaussian groups with different ellipticities and orientations can also describe changes in flattening and isophotal twists. Fixed widths and linearly solved intensities provide this flexibility without introducing a large number of non-linear parameters.

# Files
Our worked example nevertheless imposed a particular geometry: the Gaussians within each galaxy’s group shared a common centre and elliptical shape. Adding more Gaussians improves our control over the brightness distribution around that centre, but does not create independently positioned knots or several components with distinct centres.

We could introduce offset Gaussian groups. The limitation is not that MGEs cannot represent multiple centres, but that increasingly complicated galaxies require us to choose and fit an increasingly elaborate arrangement of components.

Suppose the MGE reproduces the smooth galaxy light but leaves compact, structured residuals. These may indicate that the model needs more freedom to describe local features. They are not automatically evidence for additional galaxy components: an inaccurate PSF, background estimate, contaminating object or other data-treatment error can also leave structured residuals.

- [Tutorial 1: Pixelizations](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb) — Creating a pixel-grid to reconstruct a galaxy's light.
In this chapter, we introduce pixelized reconstruction as another way to describe the galaxy’s light. We infer brightness values across a mesh without assigning a separate analytic centre and shape to every feature. The predicted image includes telescope blurring, so the reconstruction is an inferred description of the galaxy rather than simply a copy of the observed pixels.

- [Tutorial 2: Mappers](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb) — How a pixelization maps its pixels to image-pixels.
This builds on the linear profiles of Chapter 2. Instead of solving for Gaussian intensities, we solve for the mesh brightness values. Their extra freedom can describe irregular structure, but can also fit noise. Regularization supplies a prior that controls variations between neighbouring brightness values.

- [Tutorial 3: Inversions](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb) — Inverting the mappings to reconstruct the galaxy's light.
The reconstruction still depends on modelling choices, including the mesh, its resolution, regularization and the treatment of the data. We will learn to inspect how those choices affect both the reconstructed galaxy and the image residuals.

MGE and other analytic profiles remain useful for describing and measuring smooth galaxy components. Pixelizations complement them when more complicated structure needs to be represented, including in models that combine analytic components with a pixelized reconstruction.

# Files

- [Tutorial 4: Bayesian Regularization](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb) — Smoothing the reconstruction within a Bayesian framework.
- [Tutorial 1: Pixelizations](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb) — Meshes, indexed mappings, inversions and telescope blurring.

- [Tutorial 5: Bayesian Formalism](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_5_bayesian_formalism.ipynb) — The linear algebra and Bayesian evidence equations behind pixelized galaxy reconstruction.
- [Tutorial 2: Bayesian Regularization](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_2_bayesian_regularization.ipynb) — Interpolation, smoothness priors, evidence and resolution experiments.

- [Tutorial 6: Model Fit](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.10.29.1/notebooks/chapter_3_pixelizations/tutorial_6_model_fit.ipynb) — An example modeling pipeline which uses an inversion.
- [Tutorial 3: Model Fit](https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/main/notebooks/chapter_3_pixelizations/tutorial_3_model_fit.ipynb) — An MGE fit followed by a combined MGE and pixelized model.
Loading
Loading