Substructure finder#

class ClumpFinder(image, mask=None, mask_bg=None, mask_bulge=None)[source]#

Bases: object

Code 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() with model_im = 0 to detect substructures in the residuals.

Parameters:
  • image (NDArray) – image of the galaxy in the given band

  • mask (NDArray or bool or None) – segmentation mask for the galaxy with True for pixels belonging to the galaxy. If None, the mask is set to True (i.e. all pixels are considered to belong to the galaxy).

  • mask_bg (NDArray or bool or None) – segmentation mask for the background only with True for pixels belonging to the background. If None, the background cannot be estimated.

  • mask_bulge (NDArray or bool or None) – mask that hides parts of the galaxy that are in the bulge. True for pixels in the bulge zone and False for 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 galaxy

  • flux_threshold (float) – threshold used to determine whether a pixel is bright enough or not

  • surface (int) – surface criterion in pixels to 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:

ValueError if

  • there is no background mask given at initialization

  • n_sigma < 0