OnOffBackgroundMaker#
- class gammapy.makers.OnOffBackgroundMaker[source]#
Bases:
MakerEstimate OFF background from a paired OFF observation.
Turns a reduced
MapDatasetorSpectrumDatasetinto 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_maskif acceptance_method iscounts_ratio, otherwise assume no mask.
- Returns:
- dataset
MapDatasetOnOfforSpectrumDatasetOnOff Either a spectrum dataset or a map on off dataset.
- 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:
- dataset
MapDatasetorSpectrumDataset Reduced dataset for the ON observation.
- on_observation
Observation The ON observation.
- off_observation
Observation The paired OFF observation.
- dataset
- Returns:
- dataset
MapDatasetOnOfforSpectrumDatasetOnOff Either a spectrum dataset or a map on off dataset.
- dataset
- classmethod __new__(*args, **kwargs)#