SafeMaskMaker#
- class gammapy.makers.SafeMaskMaker(methods=('aeff-default',), aeff_percent=10, bias_percent=10, position=None, fixed_offset=None, offset_max='3 deg')[source]#
Bases:
gammapy.makers.core.Maker
Make safe data range mask for a given observation.
Warning
Currently some methods computing a safe energy range (“aeff-default”, “aeff-max” and “edisp-bias”) determine a true energy range and apply it to reconstructed energy, effectively neglecting the energy dispersion.
- Parameters
- methods{“aeff-default”, “aeff-max”, “edisp-bias”, “offset-max”, “bkg-peak”}
Method to use for the safe energy range. Can be a list with a combination of those. Resulting masks are combined with logical
and
. “aeff-default” uses the energy ranged specified in the DL3 data files, if available.- aeff_percentfloat
Percentage of the maximal effective area to be used as lower energy threshold for method “aeff-max”.
- bias_percentfloat
Percentage of the energy bias to be used as lower energy threshold for method “edisp-bias”
- position
SkyCoord
Position at which the
aeff_percent
orbias_percent
are computed.- fixed_offset
Angle
offset, calculated from the pointing position, at which the
aeff_percent
orbias_percent
are computed. If neither the position nor fixed_offset is specified, it uses the position of the center of the map by default.- offset_maxstr or
Quantity
Maximum offset cut.
Attributes Summary
Methods Summary
make_mask_bkg_invalid
(dataset)Mask non-finite values and zeros values in background maps.
make_mask_energy_aeff_default
(dataset, ...)Make safe energy mask from aeff default.
make_mask_energy_aeff_max
(dataset[, observation])Make safe energy mask from effective area maximum value.
make_mask_energy_bkg_peak
(dataset)Make safe energy mask based on the binned background.
make_mask_energy_edisp_bias
(dataset[, ...])Make safe energy mask from energy dispersion bias.
make_mask_offset_max
(dataset, observation)Make maximum offset mask.
run
(dataset[, observation])Make safe data range mask.
Attributes Documentation
- available_methods = {'aeff-default', 'aeff-max', 'bkg-peak', 'edisp-bias', 'offset-max'}#
- tag = 'SafeMaskMaker'#
Methods Documentation
- static make_mask_bkg_invalid(dataset)[source]#
Mask non-finite values and zeros values in background maps.
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- dataset
- Returns
- mask_safe
ndarray
Safe data range mask.
- mask_safe
- static make_mask_energy_aeff_default(dataset, observation)[source]#
Make safe energy mask from aeff default.
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- observation: `~gammapy.data.Observation`
Observation to compute mask for.
- dataset
- Returns
- mask_safe
ndarray
Safe data range mask.
- mask_safe
- make_mask_energy_aeff_max(dataset, observation=None)[source]#
Make safe energy mask from effective area maximum value.
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- observation: `~gammapy.data.Observation`
Observation to compute mask for. It is a mandatory argument when fixed_offset is set.
- dataset
- Returns
- mask_safe
ndarray
Safe data range mask.
- mask_safe
- static make_mask_energy_bkg_peak(dataset)[source]#
Make safe energy mask based on the binned background.
The energy threshold is defined as the lower edge of the energy bin with the highest predicted background rate. This is to ensure analysis in a region where a Powerlaw approximation to the background spectrum is valid. The is motivated by its use in the HESS DL3 validation paper: https://arxiv.org/pdf/1910.08088.pdf
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- dataset
- Returns
- mask_safe
ndarray
Safe data range mask.
- mask_safe
- make_mask_energy_edisp_bias(dataset, observation=None)[source]#
Make safe energy mask from energy dispersion bias.
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- observation: `~gammapy.data.Observation`
Observation to compute mask for. It is a mandatory argument when fixed_offset is set.
- dataset
- Returns
- mask_safe
ndarray
Safe data range mask.
- mask_safe
- make_mask_offset_max(dataset, observation)[source]#
Make maximum offset mask.
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- observation: `~gammapy.data.Observation`
Observation to compute mask for.
- dataset
- Returns
- mask_safe
ndarray
Maximum offset mask.
- mask_safe
- run(dataset, observation=None)[source]#
Make safe data range mask.
- Parameters
- dataset
MapDataset
orSpectrumDataset
Dataset to compute mask for.
- observation: `~gammapy.data.Observation`
Observation to compute mask for.
- dataset
- Returns
- dataset
Dataset
Dataset with defined safe range mask.
- dataset