smpy.utils.find_peaks2d

smpy.utils.find_peaks2d(image, threshold=None, verbose=False, true_boundaries=None, scaled_boundaries=None)[source]

Identify peaks in a 2D array above a specified threshold.

Find local maxima in a 2D image where each peak pixel has a value greater than all 8 neighboring pixels. Refactored from cosmostat/lenspack.

Parameters:
  • image (numpy.ndarray) – 2D input map for peak detection.

  • threshold (float, optional) – Detection threshold. If None, uses minimum image value.

  • verbose (bool, optional) – Whether to print peak information.

  • true_boundaries (dict, optional) – True coordinate boundaries for position conversion.

  • scaled_boundaries (dict, optional) – Scaled coordinate boundaries for position conversion.

Returns:

  • X (numpy.ndarray) – Peak pixel indices in x-direction.

  • Y (numpy.ndarray) – Peak pixel indices in y-direction.

  • heights (numpy.ndarray) – Peak values sorted in descending order.

  • coords (list or None) – Peak coordinates in true coordinate system if boundaries provided, otherwise None.