Skip to content

Commit cce368f

Browse files
authored
Merge pull request #296 from Jammy2211/docs/imaging
docs: add module docstrings and fill missing docstrings in imaging package
2 parents af9f6d2 + 9b43286 commit cce368f

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

autogalaxy/imaging/fit_imaging.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
Fit an imaging (CCD) dataset with a model consisting of one or more galaxies.
3+
4+
`FitImaging` is the central object in a **PyAutoGalaxy** imaging analysis. It:
5+
6+
1. Computes the summed image of all non-linear (standard) galaxy light profiles.
7+
2. Convolves that image with the PSF to create the ``blurred_image``.
8+
3. Subtracts the blurred image from the data to create the ``profile_subtracted_image``.
9+
4. If linear light profiles or a pixelization are present, fits the residual image via a linear
10+
inversion (see `autogalaxy.galaxy.to_inversion`).
11+
5. Combines the blurred image and inversion reconstruction into the ``model_data``.
12+
6. Computes residuals, chi-squared, log-likelihood (or log-evidence when an inversion is used).
13+
14+
When fitting a model via `AnalysisImaging`, the `figure_of_merit` property of `FitImaging` is
15+
evaluated inside `log_likelihood_function` and returned to the non-linear search.
16+
"""
117
import numpy as np
218
from typing import Dict, List, Optional
319

@@ -116,6 +132,13 @@ def profile_subtracted_image(self) -> aa.Array2D:
116132

117133
@property
118134
def galaxies_to_inversion(self) -> GalaxiesToInversion:
135+
"""
136+
Returns a `GalaxiesToInversion` object that converts the galaxies containing linear light profiles or
137+
pixelizations into the inversion objects required for the linear algebra solve.
138+
139+
The dataset passed to this object is the ``profile_subtracted_image`` — the imaging data with all
140+
standard (non-linear) light profile images subtracted — so the inversion only fits the residual signal.
141+
"""
119142
dataset = aa.DatasetInterface(
120143
data=self.profile_subtracted_image,
121144
noise_map=self.noise_map,

autogalaxy/imaging/model/analysis.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
"""
2+
`AnalysisImaging` — the **PyAutoFit** `Analysis` class for fitting galaxy models to CCD imaging data.
3+
4+
This module provides `AnalysisImaging`, which implements `log_likelihood_function` by:
5+
6+
1. Extracting galaxies from the model instance.
7+
2. Constructing a `FitImaging` object using those galaxies and the stored `Imaging` dataset.
8+
3. Returning the `figure_of_merit` of the fit (log-likelihood or log-evidence).
9+
10+
It also handles:
11+
12+
- Adapt images: per-galaxy model images from a previous search that drive adaptive pixelizations.
13+
- Visualization: automatic figure generation during and after the model-fit.
14+
- Results: wrapping fit outputs into a `ResultImaging` object for downstream use.
15+
"""
116
import numpy as np
217
from typing import Optional
318

autogalaxy/imaging/simulator.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""
2+
Extends the **PyAutoArray** `SimulatorImaging` class with galaxy-aware simulation methods.
3+
4+
`SimulatorImaging` (from `autoarray`) handles the low-level simulation pipeline: applying a PSF, adding
5+
Poisson noise, and adding a background sky. This module adds a `via_galaxies_from` method that takes a
6+
list of `Galaxy` objects and a 2D grid, evaluates the galaxy images, and passes them to the parent
7+
simulation pipeline.
8+
9+
It also handles `LightProfileSNR` objects, automatically scaling each profile's `intensity` so that its
10+
peak signal-to-noise ratio matches the requested value given the simulation exposure time and sky level.
11+
"""
112
import numpy as np
213
from typing import List
314

0 commit comments

Comments
 (0)