code: def find_peaks(input_map, threshold, min_separation=0.5):
      
  
      data = input_map.data
  
      cdelt = max(input_map.geom.wcs.wcs.cdelt)
      min_separation = max(min_separation, 2 * cdelt)
  
      region_size_pix = int(min_separation / cdelt)
      region_size_pix = max(3, region_size_pix)
  
      deltaxy = utils.make_pixel_distance(region_size_pix * 2 + 3)
      deltaxy *= max(input_map.geom.wcs.wcs.cdelt)
      region = deltaxy < min_separation
  
      local_max = maximum_filter(data, footprint=region) == data
      local_max[data < threshold] = False
  
      labeled, num_objects = scipy.ndimage.label(local_max)
      slices = scipy.ndimage.find_objects(labeled)
  
      peaks = []
      for s in slices:
          skydir = SkyCoord.from_pixel(s[1].start, s[0].start,
                                       input_map.geom.wcs)
          peaks.append({'ix': s[1].start,
                        'iy': s[0].start,
                        'skydir': skydir,
                        'amp': data[s[0].start, s[1].start]})
  
      return sorted(peaks, key=lambda t: t['amp'], reverse=True)
docs: Find peaks in a 2-D map object that have amplitude larger than
      `threshold` and lie a distance at least `min_separation` from another
      peak of larger amplitude.  The implementation of this method uses
      `~scipy.ndimage.filters.maximum_filter`.
  
      Parameters
      ----------
      input_map : `~gammapy.maps.WcsMap`
  
      threshold : float
  
      min_separation : float
         Radius of region size in degrees.  Sets the minimum allowable
         separation between peaks.
  
      Returns
      -------
      peaks : list
         List of dictionaries containing the location and amplitude of
         each peak.