find_peaks_in_flux_map#

gammapy.estimators.utils.find_peaks_in_flux_map(maps, threshold, min_distance=1)[source]#

Find local test statistic peaks for a given Map.

Utilises the find_peaks function to find various parameters from FluxMaps.

Parameters:
mapsFluxMaps

Input flux map object.

thresholdfloat or array-like

The test statistic data value or pixel-wise test statistic data values to be used for the detection threshold. A 2D threshold must have the same. shape as the map data.

min_distanceint or Quantity

Minimum distance between peaks. An integer value is interpreted as pixels. Default is 1.

Returns:
outputTable

Table with parameters of detected peaks.

Examples

>>> import astropy.units as u
>>> from gammapy.datasets import MapDataset
>>> from gammapy.estimators import ExcessMapEstimator
>>> from gammapy.estimators.utils import find_peaks_in_flux_map
>>>
>>> dataset = MapDataset.read("$GAMMAPY_DATA/cta-1dc-gc/cta-1dc-gc.fits.gz")
>>> estimator = ExcessMapEstimator(
...     correlation_radius="0.1 deg", energy_edges=[0.1, 10]*u.TeV
... )
>>> maps = estimator.run(dataset)
>>> # Find the peaks which are above 5 sigma
>>> sources = find_peaks_in_flux_map(maps, threshold=5, min_distance=0.1*u.deg)
>>> print(sources[:4])
x   y      ra       dec      npred   npred_excess   counts     ts    sqrt_ts   norm  norm_err     flux      flux_err
           deg       deg                                                                       1 / (s cm2) 1 / (s cm2)
--- --- --------- --------- --------- ------------ --------- -------- ------- ------- -------- ----------- -----------
158 135 266.05019 -28.70181 192.00000     61.33788 192.00000 25.11839 5.01183 0.28551  0.06450   2.827e-12   6.385e-13
 92 133 267.07022 -27.31834 137.00000     51.99467 137.00000 26.78181 5.17511 0.37058  0.08342   3.669e-12   8.259e-13
176 134 265.80492 -29.09805 195.00000     65.15990 195.00000 28.29158 5.31898 0.30561  0.06549   3.025e-12   6.484e-13
282 150 263.78083 -31.12704  84.00000     39.99004  84.00000 28.61526 5.34932 0.55027  0.12611   5.448e-12   1.249e-12