ExcessMapEstimator

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

Bases: gammapy.estimators.Estimator

Computes correlated excess, sqrt TS (i.e. Li-Ma significance) and errors for MapDatasets.

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.

Some background estimation techniques like ring background or adaptive ring background will provide already correlated data for OFF. In the case of already correlated OFF data, the OFF data should not be correlated again, and so the option correlate_off should set to False (default).

Parameters
correlation_radius~astropy.coordinate.Angle

correlation radius to use

n_sigmafloat

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

n_sigma_ulfloat

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

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 optionnal steps are not executed.

energy_edgesQuantity

Energy edges of the target excess maps bins.

apply_mask_fitBool

Apply a mask for the computation. A mask_fit must be present on the input dataset

correlate_offBool

Correlate OFF events in the case of a MapDatasetOnOff

spectral_modelSpectralModel

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

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.

get_sqrt_ts(ts, norm)

Compute sqrt(TS) value.

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

static get_sqrt_ts(ts, norm)

Compute sqrt(TS) value.

Compute sqrt(TS) as defined by:

\[\begin{split}\sqrt{TS} = \left \{ \begin{array}{ll} -\sqrt{TS} & : \text{if} \ norm < 0 \\ \sqrt{TS} & : \text{else} \end{array} \right.\end{split}\]
Parameters
tsndarray

TS value.

normndarray

norm value

Returns
——-
sqrt_tsndarray

Sqrt(TS) value.

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

input dataset

Returns
imagesdict

Dictionary containing result correlated maps. Keys are:

  • counts : correlated counts map

  • background : correlated background map

  • excess : correlated excess map

  • ts : TS map

  • sqrt_ts : sqrt(delta TS), or Li-Ma significance map

  • err : symmetric error map (from covariance)

  • flux : flux map. An exposure map must be present in the dataset to compute flux map

  • errn : negative error map

  • errp : positive error map

  • ul : upper limit map