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_hiQuantity

Energy binning

offset_lo, offset_hiQuantity

Field of view offset angle.

dataQuantity

Effective area

Examples

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

>>> from gammapy.irf import EffectiveAreaTable2D
>>> filename = '$GAMMAPY_DATA/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(self[, figsize])

Quick-look summary plots.

plot(self[, ax, add_cbar])

Plot effective area image.

plot_energy_dependence(self[, ax, offset, …])

Plot effective area versus energy for a given offset.

plot_offset_dependence(self[, ax, offset, …])

Plot effective area versus offset for a given energy.

read(filename[, hdu])

Read from file.

to_effective_area_table(self, offset[, energy])

Evaluate at a given offset and return EffectiveAreaTable.

to_fits(self[, name])

Convert to BinTableHDU.

to_table(self)

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(self, figsize=(15, 5))[source]

Quick-look summary plots.

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

Plot effective area image.

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

Plot effective area versus energy for a given offset.

Parameters
axAxes, optional

Axis

offsetAngle

Offset

energyQuantity

Energy axis

kwargsdict

Forwarded tp plt.plot()

Returns
axAxes

Axis

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

Plot effective area versus offset for a given energy.

Parameters
axAxes, optional

Axis

offsetAngle

Offset axis

energyQuantity

Energy

Returns
axAxes

Axis

classmethod read(filename, hdu='EFFECTIVE AREA')[source]

Read from file.

to_effective_area_table(self, offset, energy=None)[source]

Evaluate at a given offset and return EffectiveAreaTable.

Parameters
offsetAngle

Offset

energyQuantity

Energy axis bin edges

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

Convert to BinTableHDU.

to_table(self)[source]

Convert to Table.