SafeMaskMaker

class gammapy.cube.SafeMaskMaker(methods=('aeff-default', ), aeff_percent=10, bias_percent=10, position=None, offset_max='3 deg')[source]

Bases: object

Make safe data range mask for a given observation.

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”

positionSkyCoord

Position at which the aeff_percent or bias_percent are computed. By default, it uses the position of the center of the map.

offset_maxstr or Quantity

Maximum offset cut.

Attributes Summary

available_methods

Methods Summary

make_mask_energy_aeff_default(dataset, …)

Make safe energy mask from aeff default.

make_mask_energy_aeff_max(self, dataset)

Make safe energy mask from aeff max.

make_mask_energy_bkg_peak(dataset)

Make safe energy mask based on the binned background.

make_mask_energy_edisp_bias(self, dataset)

Make safe energy mask from aeff max.

make_mask_offset_max(self, dataset, observation)

Make maximum offset mask.

run(self, dataset[, observation])

Make safe data range mask.

Attributes Documentation

available_methods = {'aeff-default', 'aeff-max', 'bkg-peak', 'edisp-bias', 'offset-max'}

Methods Documentation

static make_mask_energy_aeff_default(dataset, observation)[source]

Make safe energy mask from aeff default.

Parameters
datasetDataset

Dataset to compute mask for.

observation: `~gammapy.data.DataStoreObservation`

Observation to compute mask for.

Returns
mask_safendarray

Safe data range mask.

make_mask_energy_aeff_max(self, dataset)[source]

Make safe energy mask from aeff max.

Parameters
datasetSpectrumDataset or SpectrumDatasetOnOff

Dataset to compute mask for.

Returns
mask_safendarray

Safe data range mask.

static make_mask_energy_bkg_peak(dataset)[source]

Make safe energy mask based on the binned background.

The energy threshold is defined as the upper edge of the energy bin with the highest predicted background rate. This method is motivated by its use in the HESS DL3 validation paper: https://arxiv.org/pdf/1910.08088.pdf

Parameters
datasetDataset

Dataset to compute mask for.

Returns
mask_safendarray

Safe data range mask.

make_mask_energy_edisp_bias(self, dataset)[source]

Make safe energy mask from aeff max.

Parameters
datasetDataset

Dataset to compute mask for.

Returns
mask_safendarray

Safe data range mask.

make_mask_offset_max(self, dataset, observation)[source]

Make maximum offset mask.

Parameters
datasetDataset

Dataset to compute mask for.

observation: `~gammapy.data.DataStoreObservation`

Observation to compute mask for.

Returns
mask_safendarray

Maximum offset mask.

run(self, dataset, observation=None)[source]

Make safe data range mask.

Parameters
datasetDataset

Dataset to compute mask for.

observation: `~gammapy.data.DataStoreObservation`

Observation to compute mask for.

Returns
datasetDataset

Dataset with defined safe range mask.