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, n_sigma_sensitivity=5, gamma_min_sensitivity=10, bkg_syst_fraction_sensitivity=0.05, apply_threshold_sensitivity=False)[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 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 FoV cut into account.- Parameters
- correlation_radius
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.
- n_sigma_sensitivityfloat
Confidence level for the sensitivity expressed in number of sigma.
- gamma_min_sensitivityfloat, optional
Minimum number of gamma-rays. Default is 10.
- bkg_syst_fraction_sensitivityfloat, optional
Fraction of background counts that are above the gamma-ray counts. Default is 0.05.
- apply_threshold_sensitivitybool
If True, use
bkg_syst_fraction_sensitivity
andgamma_min_sensitivity
in the sensitivity computation. Default is False which is the same setting as the HGPS catalog.- selection_optionallist of str, optional
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.
“sensitivity”: estimate sensitivity for a given significance
Default is None so the optional steps are not executed.
- energy_edgeslist of
Quantity
, optional Edges of the target maps energy bins. The resulting bin edges won’t be exactly equal to the input ones, but rather the closest values to the energy axis edges of the parent dataset. Default is None: apply the estimator in each energy bin of the parent dataset. For further explanation see Estimators (DL4 to DL5, and DL6).
- correlate_offbool
Correlate OFF events. Default is True.
- spectral_model
SpectralModel
Spectral model used for the computation of the flux map. If None, a Power Law of index 2 is assumed (default).
- correlation_radius
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'] ref. model : pl n_sigma : 1 n_sigma_ul : 2 sqrt_ts_threshold_ul : 2 sed type init : likelihood
Attributes Summary
Configuration parameters.
Methods Summary
copy
()Copy estimator.
estimate_excess_map
(dataset)Estimate excess and test statistic maps for a single dataset.
estimate_exposure_reco_energy
(dataset, ...)Estimate exposure map in reconstructed energy for a single dataset
estimate_kernel
(dataset)Get the convolution kernel for the input dataset.
estimate_mask_default
(dataset)Get mask used by the estimator.
run
(dataset)Compute correlated excess, Li & Ma significance and flux maps
Attributes Documentation
- config_parameters#
Configuration parameters.
- correlation_radius#
- selection_optional#
- tag = 'ExcessMapEstimator'#
Methods Documentation
- copy()#
Copy estimator.
- estimate_excess_map(dataset)[source]#
Estimate excess and test statistic maps for a single dataset.
If exposure is defined, a flux map is also computed.
- Parameters
- dataset
MapDataset
Map dataset.
- dataset
- estimate_exposure_reco_energy(dataset, kernel, mask)[source]#
- Estimate exposure map in reconstructed energy for a single dataset
assuming the given spectral_model shape.
- Parameters
- dataset
MapDataset
Map dataset.
- kernel
Tophat2DKernel
Kernel.
- mask
Map
Mask map.
- dataset
- Returns
- reco_exposure
Map
Reconstructed exposure map.
- reco_exposure
- estimate_kernel(dataset)[source]#
Get the convolution kernel for the input dataset.
- Parameters
- dataset
MapDataset
Input dataset.
- dataset
- Returns
- kernel
Tophat2DKernel
Kernel.
- kernel
- static estimate_mask_default(dataset)[source]#
Get mask used by the estimator.
- Parameters
- dataset
MapDataset
Input dataset.
- dataset
- Returns
- mask
Map
Mask map.
- mask
- 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
- dataset
MapDataset
orMapDatasetOnOff
Map dataset.
- dataset
- Returns
- maps
FluxMaps
Flux maps.
- maps