MapDatasetMaker#
- class gammapy.makers.MapDatasetMaker(selection=None, background_oversampling=None, background_interp_missing_data=True)[source]#
Bases:
gammapy.makers.core.Maker
Make binned maps for a single IACT observation.
- Parameters
- selectionlist
List of str, selecting which maps to make. Available: ‘counts’, ‘exposure’, ‘background’, ‘psf’, ‘edisp’ By default, all maps are made.
- background_oversamplingint
Background evaluation oversampling factor in energy.
- background_interp_missing_data: bool
Interpolate missing values in background 3d map. Default is True, have to be set to True for CTA IRF.
Examples
This example shows how to run the MapMaker for a single observation
>>> from gammapy.data import DataStore >>> from gammapy.datasets import MapDataset >>> from gammapy.maps import WcsGeom, MapAxis >>> from gammapy.makers import MapDatasetMaker
>>> #load an observation >>> data_store = DataStore.from_dir("$GAMMAPY_DATA/hess-dl3-dr1") >>> obs = data_store.obs(23523)
>>> #prepare the geom >>> energy_axis = MapAxis.from_energy_bounds(1.0, 10.0, 4, unit="TeV") >>> energy_axis_true = MapAxis.from_energy_bounds( 0.5, 20, 10, unit="TeV", name="energy_true") >>> geom = WcsGeom.create(skydir=(83.633, 22.014), binsz=0.02, width=(2, 2), frame="icrs", proj="CAR", axes=[energy_axis])
>>> #Run the maker >>> empty = MapDataset.create(geom=geom, energy_axis_true=energy_axis_true, name="empty") >>> maker = MapDatasetMaker() >>> dataset = maker.run(empty, obs) >>> print(dataset) MapDataset ---------- Name : empty Total counts : 787 Total background counts : 684.52 Total excess counts : 102.48 Predicted counts : 684.52 Predicted background counts : 684.52 Predicted excess counts : nan Exposure min : 7.01e+07 m2 s Exposure max : 1.10e+09 m2 s Number of total bins : 40000 Number of fit bins : 40000 Fit statistic type : cash Fit statistic value (-2 log(L)) : nan Number of models : 0 Number of parameters : 0 Number of free parameters : 0
Attributes Summary
Methods Summary
make_background
(geom, observation)Make background map.
make_counts
(geom, observation)Make counts map.
make_edisp
(geom, observation)Make energy dispersion map.
make_edisp_kernel
(geom, observation)Make energy dispersion kernel map.
make_exposure
(geom, observation[, ...])Make exposure map.
make_exposure_irf
(geom, observation[, ...])Make exposure map with irf geometry.
make_meta_table
(observation)Make info meta table.
make_psf
(geom, observation)Make psf map.
run
(dataset, observation)Make map dataset.
Attributes Documentation
- available_selection = ['counts', 'exposure', 'background', 'psf', 'edisp']#
- tag = 'MapDatasetMaker'#
Methods Documentation
- make_background(geom, observation)[source]#
Make background map.
- Parameters
- geom
Geom
Reference geom.
- observation
Observation
Observation container.
- geom
- Returns
- background
Map
Background map.
- background
- static make_counts(geom, observation)[source]#
Make counts map.
NOTE for 1D analysis: if the
Geom
is built from aCircleSkyRegion
, the latter will be directly used to extract the counts. If instead theGeom
is built from aPointSkyRegion
, the size of the ON region is taken from theRAD_MAX_2D
table containing energy-dependent theta2 cuts.- Parameters
- geom
Geom
Reference map geom.
- observation
Observation
Observation container.
- geom
- Returns
- counts
Map
Counts map.
- counts
- make_edisp(geom, observation)[source]#
Make energy dispersion map.
- Parameters
- geom
Geom
Reference geom.
- observation
Observation
Observation container.
- geom
- Returns
- edisp
EDispMap
Edisp map.
- edisp
- make_edisp_kernel(geom, observation)[source]#
Make energy dispersion kernel map.
- Parameters
- geom
Geom
Reference geom. Must contain “energy” and “energy_true” axes in that order.
- observation
Observation
Observation container.
- geom
- Returns
- edisp
EDispKernelMap
EdispKernel map.
- edisp
- static make_exposure(geom, observation, use_region_center=True)[source]#
Make exposure map.
- Parameters
- geom
Geom
Reference map geom.
- observation
Observation
Observation container.
- geom
- Returns
- exposure
Map
Exposure map.
- exposure
- static make_exposure_irf(geom, observation, use_region_center=True)[source]#
Make exposure map with irf geometry.
- Parameters
- geom
Geom
Reference geom.
- observation
Observation
Observation container.
- geom
- Returns
- exposure
Map
Exposure map.
- exposure
- static make_meta_table(observation)[source]#
Make info meta table.
- Parameters
- observation
Observation
Observation
- observation
- Returns
- meta_table:
Table
- meta_table:
- make_psf(geom, observation)[source]#
Make psf map.
- Parameters
- geom
Geom
Reference geom.
- observation
Observation
Observation container.
- geom
- Returns
- psf
PSFMap
Psf map.
- psf
- run(dataset, observation)[source]#
Make map dataset.
- Parameters
- dataset
MapDataset
Reference dataset.
- observation
Observation
Observation
- dataset
- Returns
- dataset
MapDataset
Map dataset.
- dataset