stacking — tSZ cluster stacking

foregrounds_diffusion.stacking.select_snr_pixels(tsz_maps_nhw, snr_min, snr_max, min_separation=5)[source]

Find local SNR-peak coordinates within a given SNR bin.

Parameters:
  • tsz_maps_nhw (ndarray, shape (N, H, W))

  • snr_min (float) – Lower SNR bound (inclusive).

  • snr_max (float or None) – Upper SNR bound (exclusive). None means no upper bound.

  • min_separation (int) – Minimum pixel separation between selected peaks.

Returns:

list of tuple – Each element is (patch_idx, row, col).

foregrounds_diffusion.stacking.extract_cutouts(maps_nhw, coords, cutout_size, max_cutouts=500)[source]

Extract square cutouts centred on (patch_idx, row, col) coordinates.

Parameters:
  • maps_nhw (ndarray, shape (N, H, W))

  • coords (list of tuple) – Coordinates from select_snr_pixels().

  • cutout_size (int) – Side length of the square cutout in pixels.

  • max_cutouts (int) – Maximum number of cutouts to extract (caps memory use).

Returns:

ndarray, shape (M, cutout_size, cutout_size) or None – Stacked cutouts, or None if no valid cutouts were found.