EDispKernelMap#
- class gammapy.irf.EDispKernelMap(edisp_kernel_map, exposure_map=None)[source]#
Bases:
gammapy.irf.core.IRFMap
Energy dispersion kernel map.
- Parameters
Attributes Summary
Mask safe for the map.
Methods Summary
copy
()Copy IRF map.
cutout
(position, width[, mode])Cutout IRF map.
downsample
(factor[, axis_name, 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 energy dispersion map from geometry.
from_hdulist
(hdulist[, hdu, hdu_bands, ...])Create from
HDUList
.get_edisp_kernel
([position, energy_axis])Get energy dispersion at a given position.
peek
([figsize])Quick-look summary plots.
read
(filename[, format, hdu, checksum])Read an IRF_map from file and create corresponding object.
resample_energy_axis
(energy_axis[, weights])Return a resampled
EDispKernelMap
.slice_by_idx
(slices)Slice sub dataset.
stack
(other[, weights, nan_to_num])Stack IRF map with another one in place.
to_hdulist
([format])Convert to
HDUList
.to_image
([weights])Return a 2D EdispKernelMap by summing over the reconstructed energy axis.
to_region_nd_map
(region)Extract IRFMap in a given region or position.
write
(filename[, overwrite, format, checksum])Write IRF map to fits.
Attributes Documentation
- edisp_map#
- mask_safe_image#
Mask safe for the map.
- required_axes = ['energy', 'energy_true']#
- tag = 'edisp_kernel_map'#
Methods Documentation
- copy()#
Copy IRF map.
- cutout(position, width, mode='trim')#
Cutout IRF map.
- Parameters
- position
SkyCoord
Center position of the cutout region.
- widthtuple of
Angle
Angular sizes of the region in (lon, lat) in that specific order. If only one value is passed, a square region is extracted.
- mode{‘trim’, ‘partial’, ‘strict’}, optional
Mode option for Cutout2D, for details see
Cutout2D
. Default is “trim”.
- position
- Returns
- cutout
IRFMap
Cutout IRF map.
- cutout
- downsample(factor, axis_name=None, weights=None)#
Downsample the spatial dimension by a given factor.
- 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
, optional The (2D) geometry object to use. If None, an all sky geometry with 2 bins is created. Default is None.
- 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
- energy_axis_true
Quantity
Bin edges of true energy axis.
- energy_axis
Quantity
Bin edges of reconstructed energy axis.
- biasfloat or
ndarray
Center of Gaussian energy dispersion, bias.
- sigmafloat or
ndarray
RMS width of Gaussian energy dispersion, resolution.
- pdf_thresholdfloat, optional
Zero suppression threshold. Default is 1e-6.
- geom
Geom
, optional The (2D) geometry object to use. If None, an all sky geometry with 2 bins is created. Default is None.
- energy_axis_true
- Returns
- edisp_map
EDispKernelMap
Energy dispersion kernel map.
- edisp_map
- classmethod from_geom(geom)[source]#
Create energy dispersion map from geometry.
By default, a diagonal energy dispersion matrix is created.
- Parameters
- geom
Geom
Energy dispersion 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, format='gadf')#
Create from
HDUList
.- Parameters
- hdulist
HDUList
HDU list.
- hdustr, optional
Name or index of the HDU with the IRF map. Default is None.
- hdu_bandsstr, optional
Name or index of the HDU with the IRF map BANDS table. Default is None.
- exposure_hdustr, optional
Name or index of the HDU with the exposure map data. Default is None.
- exposure_hdu_bandsstr, optional
Name or index of the HDU with the exposure map BANDS table. Default is None.
- format{“gadf”, “gtpsf”}, optional
File format. Default is “gadf”.
- 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.
- peek(figsize=(15, 5))[source]#
Quick-look summary plots.
Plots corresponding to the center of the map.
- Parameters
- figsizetuple, optional
Size of the figure. Default is (15, 5).
- classmethod read(filename, format='gadf', hdu=None, checksum=False)#
Read an IRF_map from file and create corresponding object.
- Parameters
- filenamestr or
Path
File name.
- format{“gadf”, “gtpsf”}, optional
File format. Default is “gadf”.
- hdustr or int
HDU location. Default is None.
- checksumbool
If True checks both DATASUM and CHECKSUM cards in the file headers. Default is False.
- filenamestr or
- Returns
- irf_map
PSFMap
,EDispMap
orEDispKernelMap
IRF map.
- irf_map
- resample_energy_axis(energy_axis, weights=None)[source]#
Return 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 reconstructed energy axis to use for the grouping.
- weights: `~gammapy.maps.Map`, optional
Weights to be applied. Default is None.
- energy_axis
- Returns
- edisp
EDispKernelMap
Energy dispersion kernel map.
- edisp
- slice_by_idx(slices)#
Slice sub dataset.
The slicing only applies to the maps that define the corresponding axes.
- Parameters
- slicesdict
Dictionary 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 dictionary are kept unchanged.
- Returns
- map_out
IRFMap
Sliced IRF map object.
- map_out
- stack(other, weights=None, nan_to_num=True)#
Stack IRF map with another one in place.
- to_hdulist(format='gadf')#
Convert to
HDUList
.- Parameters
- format{“gadf”, “gtpsf”}, optional
File format. Default is “gadf”.
- Returns
- hdu_list
HDUList
HDU list.
- hdu_list
- 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. Default is None.
- Returns
- edisp
EDispKernelMap
Energy dispersion kernel map.
- edisp
- to_region_nd_map(region)#
Extract IRFMap in a given region or position.
If a region is given a mean IRF is computed, if a position is given the IRF is interpolated.
- write(filename, overwrite=False, format='gadf', checksum=False)#
Write IRF map to fits.
- Parameters
- filenamestr or
Path
Filename to write to.
- overwritebool, optional
Overwrite existing file. Default is False.
- format{“gadf”, “gtpsf”}, optional
File format. Default is “gadf”.
- checksumbool, optional
When True adds both DATASUM and CHECKSUM cards to the headers written to the file. Default is False.
- filenamestr or