hierarchical_sources

hierarchical_sources#

scarlet2.init.hierarchical_sources(obs, scales=None, strict=True, K=3, split_peaks=True, image_type='ground', min_separation=0, min_area=9, thresh=0, catalog=None)[source]#

Initialize sources from a wavelet-based hierarchical footprint detection.

Computes a detection image from obs, decomposes it into a hierarchy of footprints across starlet scales, and returns one HierarchicalSourceInfo per footprint, suitable for constructing Source objects.

Spectra and morphologies are initialized from the wavelet detection image at each source’s scale, with a least-squares flux estimate that progressively subtracts brighter/larger sources before fitting fainter/ smaller ones (largest scale first).

Parameters:
  • obs (Observation) – The observation providing image data, per-pixel weights, and the coordinate frame used to convert centers to pixel positions.

  • scales (list of int, optional) – Starlet scales (indices into the coefficient array, default [1,2,3]) to use for detection.

  • strict (bool, optional) – If True, the coarse residual plane is pushed one scale higher so that the selected scales are cleanly separated without bleed from the largest-scale smooth background. Default False.

  • K (float, optional) – Detection threshold multiplier: coefficients with |w| > K * sigma_j are considered significant. Also used for the SNR-based bounding box extension. Default 3.

  • split_peaks (bool, optional) – If True (default), footprints with multiple peaks are split into separate sources using a watershed algorithm. Otherwise, additional peaks become children of the originating footprint, which retains the full footprint area, i.e. the children overlap. Splitting peaks allows to reduce the overlap of mostly independent sources.

  • image_type (str) – The type of image that is being used. This should be "ground" for ground based images with wide PSFs or "space" for images from space-based telescopes with a narrow PSF.

  • min_separation (float, optional) – Minimum pixel separation between peaks within a footprint.

  • min_area (int, optional) – Minimum number of pixels a footprint must contain to be kept.

  • thresh (float, optional) – Detection threshold; pixels must strictly exceed this value.

  • catalog (list of astropy.coordinates.SkyCoord, optional) – If given, only footprints that contain one of these sky positions are returned. Converted to pixel coordinates via obs.frame.get_pixel.

Returns:

sources – One entry per detected footprint. Will create a “compact” source, i.e. a morphology array from the model PSF for every location in catalog that is not detected as a footprint.

Return type:

list of HierarchicalSourceInfo