EffectiveAreaTable2D

class gammapy.irf.EffectiveAreaTable2D(energy_lo, energy_hi, offset_lo, offset_hi, data, meta=None, interp_kwargs=None)[source]

Bases: object

2D effective area table.

Parameters:

energy_lo : Quantity

Lower bin edges of energy axis

energy_hi : Quantity

Upper bin edges of energy axis

offset_lo : Quantity

Lower bin edges of offset axis

offset_hi : Quantity

Upper bin edges of offset axis

data : Quantity

Effective area

Examples

Create EffectiveAreaTable2D from scratch

>>> from gammapy.irf import EffectiveAreaTable2D
>>> import astropy.units as u
>>> import numpy as np
>>> energy = np.logspace(0,1,11) * u.TeV
>>> offset = np.linspace(0,1,4) * u.deg
>>> data = np.ones(shape=(10,4)) * u.cm * u.cm
>>> eff_area = EffectiveAreaTable2D(energy=energy, offset=offset, data= data)
>>> print(eff_area)
Data array summary info
energy         : size =    11, min =  1.000 TeV, max = 10.000 TeV
offset         : size =     4, min =  0.000 deg, max =  1.000 deg
Data           : size =    40, min =  1.000 cm2, max =  1.000 cm2

Attributes Summary

default_interp_kwargs Default Interpolation kwargs for NDDataArray.
energy
high_threshold High energy threshold
low_threshold Low energy threshold
offset

Methods Summary

from_hdulist(hdulist[, hdu])
from_table(table) Read from table.
peek([figsize]) Quick-look summary plots.
plot([ax, add_cbar]) Plot effective area image.
plot_energy_dependence([ax, offset, energy]) Plot effective area versus energy for a given offset.
plot_offset_dependence([ax, offset, energy]) Plot effective area versus offset for a given energy
read(filename[, hdu])
to_effective_area_table(offset[, energy]) Evaluate at a given offset and return EffectiveAreaTable

Attributes Documentation

default_interp_kwargs = {'fill_value': None, 'bounds_error': False}

Default Interpolation kwargs for NDDataArray. Extrapolate.

energy
high_threshold

High energy threshold

low_threshold

Low energy threshold

offset

Methods Documentation

classmethod from_hdulist(hdulist, hdu='EFFECTIVE AREA')[source]
classmethod from_table(table)[source]

Read from table.

Data format specification: aeff_2d

peek(figsize=(15, 5))[source]

Quick-look summary plots.

plot(ax=None, add_cbar=True, **kwargs)[source]

Plot effective area image.

plot_energy_dependence(ax=None, offset=None, energy=None, **kwargs)[source]

Plot effective area versus energy for a given offset.

Parameters:

ax : Axes, optional

Axis

offset : Angle

Offset

energy : Quantity

Energy axis

kwargs : dict

Forwarded tp plt.plot()

Returns:

ax : Axes

Axis

plot_offset_dependence(ax=None, offset=None, energy=None, **kwargs)[source]

Plot effective area versus offset for a given energy

Parameters:

ax : Axes, optional

Axis

offset : Angle

Offset axis

energy : Energy

Energy

Returns:

ax : Axes

Axis

classmethod read(filename, hdu='EFFECTIVE AREA')[source]
to_effective_area_table(offset, energy=None)[source]

Evaluate at a given offset and return EffectiveAreaTable

Parameters:

offset : Angle

Offset

energy : Quantity

Energy axis bin edges