SafeMaskMaker#

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

Bases: 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”.

positionSkyCoord

Position at which the aeff_percent or bias_percent are computed.

fixed_offsetAngle

Offset, calculated from the pointing position, at which the aeff_percent or bias_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.

irfs{“DL4”, “DL3”}

Whether to use reprojected (“DL4”) or raw (“DL3”) irfs. Default is “DL4”.

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[, observation])

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:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

Returns:
mask_safendarray

Safe data range mask.

static make_mask_energy_aeff_default(dataset, observation)[source]#

Make safe energy mask from aeff default.

Parameters:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

observationObservation

Observation to compute mask for.

Returns:
mask_safendarray

Safe data range mask.

make_mask_energy_aeff_max(dataset, observation=None)[source]#

Make safe energy mask from effective area maximum value.

Parameters:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

observationObservation

Observation to compute mask for. It is a mandatory argument when fixed_offset is set.

Returns:
mask_safendarray

Safe data range mask.

make_mask_energy_bkg_peak(dataset, observation=None)[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:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

observation: `~gammapy.data.Observation`

Observation to compute mask for. It is a mandatory argument when DL3 irfs are used.

Returns:
mask_safendarray

Safe data range mask.

make_mask_energy_edisp_bias(dataset, observation=None)[source]#

Make safe energy mask from energy dispersion bias.

Parameters:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

observationObservation

Observation to compute mask for. It is a mandatory argument when fixed_offset is set.

Returns:
mask_safendarray

Safe data range mask.

make_mask_offset_max(dataset, observation)[source]#

Make maximum offset mask.

Parameters:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

observationObservation

Observation to compute mask for.

Returns:
mask_safendarray

Maximum offset mask.

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

Make safe data range mask.

Parameters:
datasetMapDataset or SpectrumDataset

Dataset to compute mask for.

observationObservation

Observation to compute mask for.

Returns:
datasetDataset

Dataset with defined safe range mask.