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.

Data format specification: aeff_2d

Parameters:

energy_lo, energy_hi : Quantity

Energy binning

offset_lo, offset_hi : Quantity

Field of view offset angle.

data : Quantity

Effective area

Examples

Here’s an example you can use to learn about this class:

>>> from gammapy.irf import EffectiveAreaTable2D
>>> filename = '$GAMMAPY_EXTRA/datasets/cta-1dc/caldb/data/cta//1dc/bcf/South_z20_50h/irf_file.fits'
>>> aeff = EffectiveAreaTable2D.read(filename, hdu='EFFECTIVE AREA')
>>> print(aeff)
EffectiveAreaTable2D
NDDataArray summary info
energy         : size =    42, min =  0.014 TeV, max = 177.828 TeV
offset         : size =     6, min =  0.500 deg, max =  5.500 deg
Data           : size =   252, min =  0.000 m2, max = 5371581.000 m2

Here’s another one, created from scratch, without reading a file:

>>> 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,3)) * u.cm * u.cm
>>> aeff = EffectiveAreaTable2D(energy_lo=energy[:-1], energy_hi=energy[1:], offset_lo=offset[:-1], 
>>>                             offset_hi=offset[1:], data= data)
>>> print(aeff)
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 =    30, min =  1.000 cm2, max =  1.000 cm2

Attributes Summary

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

Methods Summary

from_hdulist(hdulist[, hdu]) Create from HDUList.
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]) Read from file.
to_effective_area_table(offset[, energy]) Evaluate at a given offset and return EffectiveAreaTable.
to_fits([name]) Convert to BinTable.
to_table() Convert to Table.

Attributes Documentation

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

Default Interpolation kwargs for NDDataArray. Extrapolate.

high_threshold

High energy threshold

low_threshold

Low energy threshold

Methods Documentation

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

Create from HDUList.

classmethod from_table(table)[source]

Read from Table.

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]

Read from file.

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

to_fits(name='EFFECTIVE AREA')[source]

Convert to BinTable.

to_table()[source]

Convert to Table.