EnergyDependentTablePSF

class gammapy.irf.EnergyDependentTablePSF(energy, rad, exposure=None, psf_value=None)[source]

Bases: object

Energy-dependent radially-symmetric table PSF (gtpsf format).

TODO: add references and explanations.

Parameters:

energy : Quantity

Energy (1-dim)

rad : Quantity with angle units

Offset angle wrt source position (1-dim)

exposure : Quantity

Exposure (1-dim)

psf_value : Quantity

PSF (2-dim with axes: psf[energy_index, offset_index]

Methods Summary

containment_radius(energies, fraction[, ...]) Containment radius.
evaluate([energy, rad, interp_kwargs]) Evaluate the PSF at a given energy and offset
from_fits(hdu_list) Create EnergyDependentTablePSF from gtpsf format HDU list.
info() Print basic info
integral(energy, rad_min, rad_max) Containment fraction.
kernels(cube, **kwargs) Make a set of 2D kernel images, representing the PSF at different energies.
plot_containment_vs_energy([ax, fractions]) Plot containment versus energy.
plot_exposure_vs_energy() Plot exposure versus energy.
plot_psf_vs_rad([energies]) Plot PSF vs radius.
read(filename) Create EnergyDependentTablePSF from gtpsf-format FITS file.
table_psf_at_energy(energy[, interp_kwargs]) Evaluate the EnergyOffsetArray at one given energy.
table_psf_in_energy_band(energy_band[, ...]) Average PSF in a given energy band.
to_fits() Convert to FITS HDU list format.
write(*args, **kwargs) Write to FITS file.

Methods Documentation

containment_radius(energies, fraction, interp_kwargs=None)[source]

Containment radius.

Parameters:

energies : Quantity

Energy

fraction : float

Containment fraction in %

Returns:

rad : Quantity

Containment radius in deg

evaluate(energy=None, rad=None, interp_kwargs=None)[source]

Evaluate the PSF at a given energy and offset

Parameters:

energy : Quantity

energy value

rad : Angle

Offset wrt source position

interp_kwargs : dict

option for interpolation for RegularGridInterpolator

Returns:

values : Quantity

Interpolated value

classmethod from_fits(hdu_list)[source]

Create EnergyDependentTablePSF from gtpsf format HDU list.

Parameters:

hdu_list : HDUList

HDU list with THETA and PSF extensions.

info()[source]

Print basic info

integral(energy, rad_min, rad_max)[source]

Containment fraction.

Parameters:

energy : Quantity

Energy

rad_min, rad_max : Angle

Offset

Returns:

fraction : array_like

Containment fraction (in range 0 .. 1)

kernels(cube, **kwargs)[source]

Make a set of 2D kernel images, representing the PSF at different energies.

The kernel image is evaluated on the spatial and energy grid defined by the reference sky cube.

Parameters:

cube : SkyCube

Reference sky cube.

kwargs : dict

Returns:

kernels : list of ndarray

List of 2D convolution kernels.

plot_containment_vs_energy(ax=None, fractions=[0.63, 0.8, 0.95], **kwargs)[source]

Plot containment versus energy.

plot_exposure_vs_energy()[source]

Plot exposure versus energy.

plot_psf_vs_rad(energies=[10000.0, 100000.0, 1000000.0])[source]

Plot PSF vs radius.

Parameters:TODO
classmethod read(filename)[source]

Create EnergyDependentTablePSF from gtpsf-format FITS file.

Parameters:

filename : str

File name

table_psf_at_energy(energy, interp_kwargs=None, **kwargs)[source]

Evaluate the EnergyOffsetArray at one given energy.

Parameters:

energy : Quantity

Energy

interp_kwargs : dict

Option for interpolation for RegularGridInterpolator

Returns:

table : Table

Table with two columns: offset, value

table_psf_in_energy_band(energy_band, spectral_index=2, spectrum=None, **kwargs)[source]

Average PSF in a given energy band.

Expected counts in sub energy bands given the given exposure and spectrum are used as weights.

Parameters:

energy_band : Quantity

Energy band

spectral_index : float

Power law spectral index (used if spectrum=None).

spectrum : callable

Spectrum (callable with energy as parameter).

Returns:

psf : TablePSF

Table PSF

to_fits()[source]

Convert to FITS HDU list format.

Returns:

hdu_list : HDUList

PSF in HDU list format.

write(*args, **kwargs)[source]

Write to FITS file.

Calls writeto, forwarding all arguments.