Background2D#
- class gammapy.irf.Background2D[source]#
Bases:
BackgroundIRF
Background 2D.
Data format specification: BKG_2D
- Parameters:
- axeslist of
MapAxis
orMapAxes
- Required axes (in the given order) are:
energy (reconstructed energy axis)
offset (field of view offset axis)
- data
ndarray
Data array.
- unitstr or
Unit
Data unit usually
s^-1 MeV^-1 sr^-1
.- is_pointlikebool, optional
Whether the IRF is point-like. True for point-like IRFs, False for full-containment. Default is False.
- fov_alignment
FoVAlignment
, optional The orientation of the field of view coordinate system. Default is FoVAlignment.RADEC.
- metadict
Metadata dictionary.
- interp_kwargsdict, optional
Keyword arguments passed to
ScaledRegularGridInterpolator
. If None, the following inputs are usedbounds_error=False
,fill_value=0.0
andvalues_scale="log"
. Default is None.
- axeslist of
Attributes Summary
Methods Summary
peek
([figsize])Quick-look summary plots.
plot
([ax, add_cbar, axes_loc, kwargs_colorbar])Plot energy offset dependence of the background model.
plot_at_energy
([energy, add_cbar, ncols, ...])Plot the background rate in FoV coordinates at a given energy.
plot_energy_dependence
([ax, offset])Plot background rate versus energy for a given offset.
plot_offset_dependence
([ax, energy])Plot background rate versus offset for a given energy.
plot_spectrum
([ax])Plot angle integrated background rate versus energy.
to_3d
()Convert to Background3D.
Attributes Documentation
- default_unit = Unit("1 / (MeV s sr)")#
- required_axes = ['energy', 'offset']#
- tag = 'bkg_2d'#
Methods Documentation
- peek(figsize=(10, 8))[source]#
Quick-look summary plots.
This method creates a figure with four subplots:
Offset dependence plot : background rate versus offset for the given energy axis
Integrated spectrum plot : background rate integrated over the full field of view versus energy
Energy dependence plot : background rate versus energy for a given offset
Energy offset dependence of the background model map
- Parameters:
- figsizetuple, optional
Size of the figure. Default is (10, 8).
- plot(ax=None, add_cbar=True, axes_loc=None, kwargs_colorbar=None, **kwargs)[source]#
Plot energy offset dependence of the background model.
- Parameters:
- ax
Axes
, optional Matplotlib axes. Default is None.
- add_cbarbool, optional
Add a colorbar to the plot. Default is True.
- axes_locdict, optional
Keyword arguments passed to
append_axes
.- kwargs_colorbardict, optional
Keyword arguments passed to
colorbar
.- kwargsdict
Keyword arguments passed to
pcolormesh
.
- ax
- Returns:
- ax
Axes
Matplotlib axes.
- ax
- plot_at_energy(energy=<Quantity 1. TeV>, add_cbar=True, ncols=3, figsize=None, **kwargs)[source]#
Plot the background rate in FoV coordinates at a given energy.
- Parameters:
- energy
Quantity
, optional List of energy. Default is 1 TeV.
- add_cbarbool, optional
Add color bar. Default is True.
- ncolsint, optional
Number of columns to plot. Default is 3.
- figsizetuple, optional
Figure size. Default is None.
- **kwargsdict
Keyword arguments passed to
pcolormesh
.
- energy
- plot_energy_dependence(ax=None, offset=None, **kwargs)[source]#
Plot background rate versus energy for a given offset.
- plot_offset_dependence(ax=None, energy=None, **kwargs)[source]#
Plot background rate versus offset for a given energy.
- __init__(axes, data=0, unit='', is_pointlike=False, fov_alignment=FoVAlignment.RADEC, meta=None, interp_kwargs=None)#
- classmethod __new__(*args, **kwargs)#