RadMax2D#
- class gammapy.irf.RadMax2D(axes, data=0, unit='', is_pointlike=False, fov_alignment=FoVAlignment.RADEC, meta=None, interp_kwargs=None)[source]#
Bases:
gammapy.irf.core.IRF
2D Rad Max table.
This is not directly a IRF component but is needed as additional information for point-like IRF components when an energy or field of view dependent directional cut has been applied.
Data format specification: RAD_MAX_2D
- Parameters
- energy_axis
MapAxis
Reconstructed energy axis
- offset_axis
MapAxis
Field of view offset axis.
- data
Quantity
Applied directional cut
- metadict
Meta data
- energy_axis
Attributes Summary
MapAxes
Alignment of the field of view coordinate axes, see
FoVAlignment
Whether the IRF explicitly depends on offset
Returns True if rad_max axes are flat.
Whether the IRF is pointlike of full containment.
Map unit (
Unit
)Methods Summary
cumsum
(axis_name)Compute cumsum along a given axis
evaluate
([method])Evaluate IRF
from_hdulist
(hdulist[, hdu, format])Create from
HDUList
.from_irf
(irf)Create a RadMax2D instance from another IRF component.
from_table
(table[, format])Read from
Table
.integral
(axis_name, **kwargs)Compute integral along a given axis
integrate_log_log
(axis_name, **kwargs)Integrate along a given axis.
interp_missing_data
(axis_name)Interpolate missing data along a given axis
is_allclose
(other[, rtol_axes, atol_axes])Compare two data IRFs for equivalency
normalize
(axis_name)Normalise data in place along a given axis.
pad
(pad_width, axis_name, **kwargs)Pad irf along a given axis.
plot_rad_max_vs_energy
([ax])Plot rad max value against energy.
read
(filename[, hdu, format])Read from file.
to_hdulist
([format])to_table
([format])Convert to table
to_table_hdu
([format])Convert to
BinTableHDU
.to_unit
(unit)Convert irf to different unit
write
(filename, *args, **kwargs)Write IRF to fits.
Attributes Documentation
- axes#
MapAxes
- data#
- default_interp_kwargs = {'bounds_error': False, 'fill_value': 0.0}#
- default_unit = Unit("deg")#
- fov_alignment#
Alignment of the field of view coordinate axes, see
FoVAlignment
- has_offset_axis#
Whether the IRF explicitly depends on offset
- is_fixed_rad_max#
Returns True if rad_max axes are flat.
- is_pointlike#
Whether the IRF is pointlike of full containment.
- required_axes = ['energy', 'offset']#
- tag = 'rad_max_2d'#
Methods Documentation
- cumsum(axis_name)#
Compute cumsum along a given axis
- Parameters
- axis_namestr
Along which axis to integrate.
- Returns
- irf
IRF
Cumsum IRF
- irf
- evaluate(method=None, **kwargs)#
Evaluate IRF
- Parameters
- **kwargsdict
Coordinates at which to evaluate the IRF
- methodstr {‘linear’, ‘nearest’}, optional
Interpolation method
- Returns
- array
Quantity
Interpolated values
- array
- classmethod from_hdulist(hdulist, hdu=None, format='gadf-dl3')#
Create from
HDUList
.- Parameters
- hdulist
HDUList
HDU list
- hdustr
HDU name
- format{“gadf-dl3”}
Format specification
- hdulist
- Returns
- irf
IRF
IRF class
- irf
- classmethod from_irf(irf)[source]#
Create a RadMax2D instance from another IRF component.
This reads the RAD_MAX metadata keyword from the irf and creates a RadMax2D with a single bin in energy and offset using the ranges from the input irf.
- Parameters
- irf: `~gammapy.irf.EffectiveAreaTable2D` or `~gammapy.irf.EnergyDispersion2D`
IRF instance from which to read the RAD_MAX and limit information
- Returns
Notes
This assumes the true energy axis limits are also valid for the reco energy limits.
- classmethod from_table(table, format='gadf-dl3')#
Read from
Table
.- Parameters
- table
Table
Table with irf data
- format{“gadf-dl3”}
Format specification
- table
- Returns
- irf
IRF
IRF class.
- irf
- integral(axis_name, **kwargs)#
Compute integral along a given axis
This method uses interpolation of the cumulative sum.
- Parameters
- axis_namestr
Along which axis to integrate.
- **kwargsdict
Coordinates at which to evaluate the IRF
- Returns
- array
Quantity
Returns 2D array with axes offset
- array
- integrate_log_log(axis_name, **kwargs)#
Integrate along a given axis.
This method uses log-log trapezoidal integration.
- Parameters
- axis_namestr
Along which axis to integrate.
- **kwargsdict
Coordinates at which to evaluate the IRF
- Returns
- array
Quantity
Returns 2D array with axes offset
- array
- interp_missing_data(axis_name)#
Interpolate missing data along a given axis
- is_allclose(other, rtol_axes=0.001, atol_axes=1e-06, **kwargs)#
Compare two data IRFs for equivalency
- Parameters
- other
gammapy.irfs.IRF
The irf to compare against
- rtol_axesfloat
Relative tolerance for the axes comparison.
- atol_axesfloat
Relative tolerance for the axes comparison.
- **kwargsdict
keywords passed to
numpy.allclose
- other
- Returns
- is_allclosebool
Whether the IRF is all close.
- normalize(axis_name)#
Normalise data in place along a given axis.
- Parameters
- axis_namestr
Along which axis to normalize.
- pad(pad_width, axis_name, **kwargs)#
Pad irf along a given axis.
- Parameters
- pad_width{sequence, array_like, int}
Number of pixels padded to the edges of each axis.
- axis_namestr
Which axis to downsample. By default spatial axes are padded.
- **kwargsdict
Keyword argument forwarded to
pad
- Returns
- irf
IRF
Padded irf
- irf
- plot_rad_max_vs_energy(ax=None, **kwargs)[source]#
Plot rad max value against energy.
- Parameters
- ax
Axes
Axes to plot on.
- **kwargsdict
Keyword arguments passed to
pcolormesh
- ax
- Returns
- ax
Axes
Axes to plot on.
- ax
- classmethod read(filename, hdu=None, format='gadf-dl3')#
Read from file.
- Parameters
- filenamestr or
Path
Filename
- hdustr
HDU name
- format{“gadf-dl3”}
Format specification
- filenamestr or
- Returns
- irf
IRF
IRF class
- irf
- to_hdulist(format='gadf-dl3')#
- to_table(format='gadf-dl3')#
Convert to table
- Parameters
- format{“gadf-dl3”}
Format specification
- Returns
- table
Table
IRF data table
- table
- to_table_hdu(format='gadf-dl3')#
Convert to
BinTableHDU
.- Parameters
- format{“gadf-dl3”}
Format specification
- Returns
- hdu
BinTableHDU
IRF data table hdu
- hdu
- to_unit(unit)#
Convert irf to different unit
- Parameters
- unit
Unit
or str New unit
- unit
- Returns
- irf
IRF
IRF with new unit and converted data
- irf