1+ """
2+ Mixin classes that add image-operation methods (PSF convolution, Fourier transform) to light objects.
3+
4+ The three mixin classes here are arranged in a hierarchy:
5+
6+ - `OperateImage` — methods that operate on a **single** image from a light object
7+ (e.g. a `LightProfile` or `Galaxy`).
8+ - `OperateImageList` — extends `OperateImage` with methods that operate on a **list** of images,
9+ one per light profile component.
10+ - `OperateImageGalaxies` — extends `OperateImageList` with methods that operate on a **dict** mapping
11+ each `Galaxy` to its image, preserving galaxy identity through the pipeline.
12+
13+ All three classes are mixins — they are not instantiated directly but are inherited by light objects
14+ (`LightProfile`, `Galaxy`, `Galaxies`, `Tracer`) to expose a consistent API for blurring and Fourier
15+ transforming images.
16+ """
117from __future__ import annotations
218import numpy as np
319from typing import TYPE_CHECKING , Dict , List , Optional
@@ -24,9 +40,31 @@ class OperateImage:
2440 def image_2d_from (
2541 self , grid : aa .Grid2D , xp = np , operated_only : Optional [bool ] = None
2642 ) -> aa .Array2D :
43+ """
44+ Abstract method — return the 2D image of this light object at every coordinate on `grid`.
45+
46+ Subclasses (e.g. `LightProfile`, `Galaxy`) implement this method to evaluate their surface
47+ brightness at each (y, x) coordinate.
48+
49+ Parameters
50+ ----------
51+ grid
52+ The 2D (y, x) coordinates where the image is evaluated.
53+ operated_only
54+ Controls which light profiles contribute. `None` (default) returns all profiles;
55+ `True` returns only `LightProfileOperated` images; `False` excludes them.
56+ """
2757 raise NotImplementedError
2858
2959 def has (self , cls ) -> bool :
60+ """
61+ Returns `True` if any attribute of this object is an instance of `cls`, else `False`.
62+
63+ Parameters
64+ ----------
65+ cls
66+ The class type to search for.
67+ """
3068 raise NotImplementedError
3169
3270 def _blurred_image_2d_from (
@@ -36,6 +74,21 @@ def _blurred_image_2d_from(
3674 psf : aa .Convolver ,
3775 xp = np ,
3876 ) -> aa .Array2D :
77+ """
78+ Convolve a 2D image with a PSF using the supplied `Convolver`.
79+
80+ This is the internal helper used by `blurred_image_2d_from`. It does not handle the
81+ `LightProfileOperated` logic — the caller must do that separately.
82+
83+ Parameters
84+ ----------
85+ image_2d
86+ The 2D image of the masked pixels to be convolved.
87+ blurring_image_2d
88+ The 2D image of the pixels just outside the mask whose light blurs into the masked region.
89+ psf
90+ The PSF convolver that performs the 2D convolution.
91+ """
3992
4093 values = psf .convolved_image_from (
4194 image = image_2d , blurring_image = blurring_image_2d , xp = xp
0 commit comments