Substructure finder#
- class ClumpFinder(image, mask=None, mask_bg=None, mask_bulge=None)[source]#
Bases:
objectCode author: Wilfried Mercier - LAM <wilfried.mercier@lam.fr>
Class used to find substructures in residual images of galaxies using the technique described in Mercier et al. (2025).
Important
One can provide the residual image instead of the galaxy image. In such a case, call
detect()withmodel_im = 0to detect substructures in the residuals.- Parameters:
image (NDArray) – image of the galaxy in the given band
mask (NDArray or
boolorNone) – segmentation mask for the galaxy withTruefor pixels belonging to the galaxy. IfNone, the mask is set toTrue(i.e. all pixels are considered to belong to the galaxy).mask_bg (NDArray or
boolorNone) – segmentation mask for the background only withTruefor pixels belonging to the background. IfNone, the background cannot be estimated.mask_bulge (NDArray or
boolorNone) – mask that hides parts of the galaxy that are in the bulge.Truefor pixels in the bulge zone andFalsefor pixels outside.
- detect(model_im, flux_threshold, surface)[source]#
Code author: Wilfried Mercier - LAM <wilfried.mercier@lam.fr>
Detect substructures in a residual image given flux and surface thresholds.
The substructures are found by looking at the residuals after subtracting the galaxy model from the image. If the image is already the residuals, one can provide
model_im = 0.Note
This technique identifies both under- and over-densities above a given threshold in the image.
- Parameters:
model_im (NDArray or
float) – 2D model of the galaxyflux_threshold (
float) – threshold used to determine whether a pixel is bright enough or notsurface (
int) – surface criterion inpixelsto decide whether a structure is sufficiently extended or not
- Returns:
clump detection map with one value per substructure with
negative values for under-dense pixels
positive values for over-dense pixels (i.e. substructures)
0 for the background
- Return type:
NDArray with the same shape as
model_im- Raises:
ValueErrorifthere is no background mask given at initialization
n_sigma < 0