ExcessMapEstimator#

class gammapy.estimators.ExcessMapEstimator(correlation_radius='0.1 deg', n_sigma=1, n_sigma_ul=2, selection_optional=None, energy_edges=None, correlate_off=True, spectral_model=None)[source]#

Bases: gammapy.estimators.core.Estimator

Computes correlated excess, significance and error maps from a map dataset.

If a model is set on the dataset the excess map estimator will compute the excess taking into account the predicted counts of the model.

..note:

By default the excess estimator correlates the off counts as well to avoid
artifacts at the edges of the :term:`FoV` for stacked on-off datasets.
However when the on-off dataset has been derived from a ring background
estimate, this leads to the off counts being correlated twice. To avoid
artifacts and the double correlation, the `ExcessMapEstimator` has to
be applied per dataset and the resulting maps need to be stacked, taking
the :term:`FoV` cut into account.
Parameters
correlation_radius~astropy.coordinate.Angle

correlation radius to use

n_sigmafloat

Confidence level for the asymmetric errors expressed in number of sigma.

n_sigma_ulfloat

Confidence level for the upper limits expressed in number of sigma.

selection_optionallist of str

Which additional maps to estimate besides delta TS, significance and symmetric error. Available options are:

  • “all”: all the optional steps are executed

  • “errn-errp”: estimate asymmetric errors.

  • “ul”: estimate upper limits.

Default is None so the optional steps are not executed.

energy_edgesQuantity

Energy edges of the target excess maps bins.

correlate_offbool

Correlate OFF events. Default is True.

spectral_modelSpectralModel

Spectral model used for the computation of the flux map. If None, a Power Law of index 2 is assumed (default).

Examples

>>> from gammapy.datasets import MapDataset
>>> from gammapy.estimators import ExcessMapEstimator
>>> dataset = MapDataset.read("$GAMMAPY_DATA/cta-1dc-gc/cta-1dc-gc.fits.gz")
>>> estimator = ExcessMapEstimator(correlation_radius="0.1 deg")
>>> result = estimator.run(dataset)
>>> print(result)
FluxMaps
--------

  geom                   : WcsGeom
  axes                   : ['lon', 'lat', 'energy']
  shape                  : (320, 240, 1)
  quantities             : ['npred', 'npred_excess', 'counts', 'ts', 'sqrt_ts', 'norm', 'norm_err']  # noqa: E501
  ref. model             : pl
  n_sigma                : 1
  n_sigma_ul             : 2
  sqrt_ts_threshold_ul   : 2
  sed type init          : likelihood

Attributes Summary

config_parameters

Config parameters

correlation_radius

selection_optional

tag

Methods Summary

copy()

Copy estimator

estimate_excess_map(dataset)

Estimate excess and ts maps for single dataset.

run(dataset)

Compute correlated excess, Li & Ma significance and flux maps

Attributes Documentation

config_parameters#

Config parameters

correlation_radius#
selection_optional#
tag = 'ExcessMapEstimator'#

Methods Documentation

copy()#

Copy estimator

estimate_excess_map(dataset)[source]#

Estimate excess and ts maps for single dataset.

If exposure is defined, a flux map is also computed.

Parameters
datasetMapDataset

Map dataset

run(dataset)[source]#

Compute correlated excess, Li & Ma significance and flux maps

If a model is set on the dataset the excess map estimator will compute the excess taking into account the predicted counts of the model.

Parameters
datasetMapDataset or MapDatasetOnOff

Map dataset

Returns
mapsFluxMaps

Flux maps