OnOffBackgroundMaker#

class gammapy.makers.OnOffBackgroundMaker[source]#

Bases: Maker

Estimate OFF background from a paired OFF observation.

Turns a reduced MapDataset or SpectrumDataset into its OnOff counterpart by mirroring the OFF run’s events into the ON pointing FoV frame and setting acceptances from livetime.

ON-OFF pairs should be created beforehand by the user.

Note

Currently, this supports only one OFF observation for each ON observation. It also only works for pointing observations, and drift mode is not supported.

Parameters:
acceptance_methodstr, optional

Allowed options are {“livetime_ratio”, “counts_ratio”} Strategy for the acceptance calculation. Available options are:

  • “livetime_ratio”: takes the ratio of livetimes.

  • “counts_ratio”: takes the ratio of the counts outside an exclusion mask, passed through kwargs.

Default is “livetime_ratio”.

kwargsdict, optional

Additional arguments passed to the maker. Should contain exclusion_mask if acceptance_method is counts_ratio, otherwise assume no mask.

Returns:
datasetMapDatasetOnOff or SpectrumDatasetOnOff

Either a spectrum dataset or a map on off dataset.

Attributes Summary

Methods Summary

run(dataset, on_observation, off_observation)

Create background using dedicated off pointing.

Attributes Documentation

available_acceptance_methods = ['livetime_ratio', 'counts_ratio']#
tag = 'OnOffBackgroundMaker'#

Methods Documentation

run(dataset, on_observation, off_observation)[source]#

Create background using dedicated off pointing.

Parameters:
datasetMapDataset or SpectrumDataset

Reduced dataset for the ON observation.

on_observationObservation

The ON observation.

off_observationObservation

The paired OFF observation.

Returns:
datasetMapDatasetOnOff or SpectrumDatasetOnOff

Either a spectrum dataset or a map on off dataset.

__init__(acceptance_method='livetime_ratio', **kwargs)[source]#
classmethod __new__(*args, **kwargs)#