EDispKernelMap¶
-
class
gammapy.irf.
EDispKernelMap
(edisp_kernel_map, exposure_map)[source]¶ Bases:
gammapy.irf.irf_map.IRFMap
Energy dispersion kernel map.
- Parameters
Attributes Summary
Methods Summary
copy
()Copy IRF map
cutout
(position, width[, mode])Cutout IRF map.
downsample
(factor[, axis, weights])Downsample the spatial dimension by a given factor.
from_diagonal_response
(energy_axis, …[, geom])Create an energy dispersion map with diagonal response.
from_edisp_kernel
(edisp[, geom])Create an energy dispersion map from the input 1D kernel.
from_gauss
(energy_axis, energy_axis_true, …)Create an energy dispersion map from the input 1D kernel.
from_geom
(geom)Create edisp map from geom.
from_hdulist
(hdulist[, hdu, hdu_bands, …])Create from
HDUList
.get_edisp_kernel
([position, energy_axis])Get energy dispersion at a given position.
read
(filename[, hdu])Read an IRF_map from file and create corresponding object
resample_energy_axis
(energy_axis[, weights])Returns a resampled EdispKernelMap
slice_by_idx
(slices)Slice sub dataset.
stack
(other[, weights])Stack IRF map with another one in place.
Convert to
HDUList
.to_image
([weights])“Return a 2D EdispKernelMap by summing over the reconstructed energy axis.
write
(filename[, overwrite])Write IRF map to fits
Attributes Documentation
-
edisp_map
¶
-
tag
= 'edisp_kernel_map'¶
Methods Documentation
-
copy
()¶ Copy IRF map
-
cutout
(position, width, mode='trim')¶ Cutout IRF map.
- Parameters
- Returns
- cutout
IRFMap
Cutout IRF map.
- cutout
-
downsample
(factor, axis=None, weights=None)¶ Downsample the spatial dimension by a given factor.
- Parameters
- factorint
Downsampling factor.
- axisstr
Which axis to downsample. By default spatial axes are downsampled.
- weights
Map
Map with weights downsampling.
- Returns
- map
IRFMap
Downsampled irf map.
- map
-
classmethod
from_diagonal_response
(energy_axis, energy_axis_true, geom=None)[source]¶ Create an energy dispersion map with diagonal response.
- Parameters
- Returns
- edisp_map
EDispKernelMap
Energy dispersion kernel map.
- edisp_map
-
classmethod
from_edisp_kernel
(edisp, geom=None)[source]¶ Create an energy dispersion map from the input 1D kernel.
The kernel will be duplicated over all spatial bins.
- Parameters
- edisp
EDispKernel
the input 1D kernel.
- geom
Geom
The (2D) geom object to use. Default creates an all sky geometry with 2 bins.
- edisp
- Returns
- edisp_map
EDispKernelMap
Energy dispersion kernel map.
- edisp_map
-
classmethod
from_gauss
(energy_axis, energy_axis_true, sigma, bias, pdf_threshold=1e-06, geom=None)[source]¶ Create an energy dispersion map from the input 1D kernel.
The kernel will be duplicated over all spatial bins.
- Parameters
- edisp
EDispKernel
the input 1D kernel.
- geom
Geom
The (2D) geom object to use. Default creates an all sky geometry with 2 bins.
- edisp
- Returns
- edisp_map
EDispKernelMap
Energy dispersion kernel map.
- edisp_map
-
classmethod
from_geom
(geom)[source]¶ Create edisp map from geom.
By default a diagonal edisp matrix is created.
- Parameters
- geom
Geom
Edisp map geometry.
- geom
- Returns
- edisp_map
EDispKernelMap
Energy dispersion kernel map.
- edisp_map
-
classmethod
from_hdulist
(hdulist, hdu=None, hdu_bands=None, exposure_hdu=None, exposure_hdu_bands=None)¶ Create from
HDUList
.- Parameters
- hdulist
HDUList
HDU list.
- hdustr
Name or index of the HDU with the IRF map.
- hdu_bandsstr
Name or index of the HDU with the IRF map BANDS table.
- exposure_hdustr
Name or index of the HDU with the exposure map data.
- exposure_hdu_bandsstr
Name or index of the HDU with the exposure map BANDS table.
- hdulist
- Returns
- irf_map
IRFMap
IRF map.
- irf_map
-
get_edisp_kernel
(position=None, energy_axis=None)[source]¶ Get energy dispersion at a given position.
-
classmethod
read
(filename, hdu=None)¶ Read an IRF_map from file and create corresponding object
-
resample_energy_axis
(energy_axis, weights=None)[source]¶ Returns a resampled EdispKernelMap
Bins are grouped according to the edges of the reconstructed energy axis provided. The true energy is left unchanged.
- Parameters
- energy_axis
MapAxis
The reco energy axis to use for the reco energy grouping
- weights: `~gammapy.maps.Map`, optional
Weights to be applied
- energy_axis
- Returns
- edisp
EDispKernelMap
Edisp kernel map
- edisp
-
slice_by_idx
(slices)¶ Slice sub dataset.
The slicing only applies to the maps that define the corresponding axes.
- Parameters
- slicesdict
Dict of axes names and integers or
slice
object pairs. Contains one element for each non-spatial dimension. For integer indexing the corresponding axes is dropped from the map. Axes not specified in the dict are kept unchanged.
- Returns
- map_out
IRFMap
Sliced irf map object.
- map_out
-
stack
(other, weights=None)¶ Stack IRF map with another one in place.
- Parameters
- other
IRFMap
IRF map to be stacked with this one.
- weights
Map
Map with stacking weights.
- other
-
to_image
(weights=None)[source]¶ “Return a 2D EdispKernelMap by summing over the reconstructed energy axis.
- Parameters
- weights: `~gammapy.maps.Map`, optional
Weights to be applied
- Returns
- edisp
EDispKernelMap
Edisp kernel map
- edisp
-
write
(filename, overwrite=False, **kwargs)¶ Write IRF map to fits