MapDatasetMaker#
- class gammapy.makers.MapDatasetMaker(selection=None, background_oversampling=None, background_interp_missing_data=True, background_pad_offset=True)[source]#
Bases:
gammapy.makers.core.Maker
Make binned maps for a single IACT observation.
- Parameters
- selectionlist of str, optional
Select which maps to make, the available options are: ‘counts’, ‘exposure’, ‘background’, ‘psf’, ‘edisp’. By default, all maps are made.
- background_oversamplingint
Background evaluation oversampling factor in energy.
- background_interp_missing_databool, optional
Interpolate missing values in background 3d map. Default is True, have to be set to True for CTA IRF.
- background_pad_offsetbool, optional
Pad one bin in offset for 2d background map. This avoids extrapolation at edges and use the nearest value. Default is True.
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 geometry >>> 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 information 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 geometry.
- observation
Observation
Observation container.
- geom
- Returns
- background
Map
Background map.
- background
- static make_counts(geom, observation)[source]#
Make counts map.
- Parameters
- geom
Geom
Reference map geometry.
- observation
Observation
Observation container.
- geom
- Returns
- counts
Map
Counts map.
- counts
- make_edisp(geom, observation)[source]#
Make energy dispersion map.
- Parameters
- geom
Geom
Reference geometry.
- observation
Observation
Observation container.
- geom
- Returns
- edisp
EDispMap
Energy dispersion map.
- edisp
- make_edisp_kernel(geom, observation)[source]#
Make energy dispersion kernel map.
- Parameters
- geom
Geom
Reference geometry. Must contain “energy” and “energy_true” axes in that order.
- observation
Observation
Observation container.
- geom
- Returns
- edisp
EDispKernelMap
Energy dispersion kernel map.
- edisp
- static make_exposure(geom, observation, use_region_center=True)[source]#
Make exposure map.
- Parameters
- geom
Geom
Reference map geometry.
- observation
Observation
Observation container.
- use_region_centerbool, optional
For geom as a
RegionGeom
. If True, consider the values at the region center. If False, average over the whole region. Default is True.
- 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 geometry.
- observation
Observation
Observation container.
- use_region_centerbool, optional
For geom as a
RegionGeom
. If True, consider the values at the region center. If False, average over the whole region. Default is True.
- geom
- Returns
- exposure
Map
Exposure map.
- exposure
- static make_meta_table(observation)[source]#
Make information meta table.
- Parameters
- observation
Observation
Observation.
- observation
- Returns
- meta_table
Table
Meta table.
- meta_table
- make_psf(geom, observation)[source]#
Make PSF map.
- Parameters
- geom
Geom
Reference geometry.
- 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