EnergyDependentMultiGaussPSF

class gammapy.irf.EnergyDependentMultiGaussPSF(energy_lo, energy_hi, theta, sigmas, norms, energy_thresh_lo='0.1 TeV', energy_thresh_hi='100 TeV')[source]

Bases: object

Triple Gauss analytical PSF depending on energy and theta.

To evaluate the PSF call the to_energy_dependent_table_psf or psf_at_energy_and_theta methods.

Parameters
energy_loQuantity

Lower energy boundary of the energy bin.

energy_hiQuantity

Upper energy boundary of the energy bin.

thetaQuantity

Center values of the theta bins.

sigmaslist of ‘numpy.ndarray’

Triple Gauss sigma parameters, where every entry is a two dimensional ‘numpy.ndarray’ containing the sigma value for every given energy and theta.

normslist of ‘numpy.ndarray’

Triple Gauss norm parameters, where every entry is a two dimensional ‘numpy.ndarray’ containing the norm value for every given energy and theta. Norm corresponds to the value of the Gaussian at theta = 0.

energy_thresh_loQuantity

Lower save energy threshold of the psf.

energy_thresh_hiQuantity

Upper save energy threshold of the psf.

Examples

Plot R68 of the PSF vs. theta and energy:

import matplotlib.pyplot as plt
from gammapy.irf import EnergyDependentMultiGaussPSF
filename = '$GAMMAPY_DATA/tests/unbundled/irfs/psf.fits'
psf = EnergyDependentMultiGaussPSF.read(filename, hdu='POINT SPREAD FUNCTION')
psf.plot_containment(0.68, show_safe_energy=False)
plt.show()

(png, hires.png, pdf)

../_images/gammapy-irf-EnergyDependentMultiGaussPSF-1.png

Methods Summary

containment_radius(self, energy, theta[, …])

Compute containment for all energy and theta values

from_fits(hdu)

Create EnergyDependentMultiGaussPSF from HDU list.

info(self[, fractions, energies, thetas])

Print PSF summary info.

peek(self[, figsize])

Quick-look summary plots.

plot_containment(self[, fraction, ax, …])

Plot containment image with energy and theta axes.

plot_containment_vs_energy(self[, …])

Plot containment fraction as a function of energy.

psf_at_energy_and_theta(self, energy, theta)

Get MultiGauss2D model for given energy and theta.

read(filename[, hdu])

Create EnergyDependentMultiGaussPSF from FITS file.

to_energy_dependent_table_psf(self[, theta, …])

Convert triple Gaussian PSF ot table PSF.

to_fits(self)

Convert psf table data to FITS hdu list.

to_psf3d(self[, rad])

Create a PSF3D from an analytical PSF.

write(self, filename, \*args, \*\*kwargs)

Write PSF to FITS file.

Methods Documentation

containment_radius(self, energy, theta, fraction=0.68)[source]

Compute containment for all energy and theta values

classmethod from_fits(hdu)[source]

Create EnergyDependentMultiGaussPSF from HDU list.

Parameters
hduBinTableHDU

HDU

info(self, fractions=[0.68, 0.95], energies=<Quantity [ 1., 10.] TeV>, thetas=<Quantity [0.] deg>)[source]

Print PSF summary info.

The containment radius for given fraction, energies and thetas is computed and printed on the command line.

Parameters
fractionslist

Containment fraction to compute containment radius for.

energiesQuantity

Energies to compute containment radius for.

thetasQuantity

Thetas to compute containment radius for.

Returns
ssstring

Formatted string containing the summary info.

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

Quick-look summary plots.

plot_containment(self, fraction=0.68, ax=None, show_safe_energy=False, add_cbar=True, **kwargs)[source]

Plot containment image with energy and theta axes.

Parameters
fractionfloat

Containment fraction between 0 and 1.

add_cbarbool

Add a colorbar

plot_containment_vs_energy(self, fractions=[0.68, 0.95], thetas=<Angle [0., 1.] deg>, ax=None, **kwargs)[source]

Plot containment fraction as a function of energy.

psf_at_energy_and_theta(self, energy, theta)[source]

Get MultiGauss2D model for given energy and theta.

No interpolation is used.

Parameters
energyQuantity

Energy at which a PSF is requested.

thetaAngle

Offset angle at which a PSF is requested.

Returns
psfMultiGauss2D

Multigauss PSF object.

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

Create EnergyDependentMultiGaussPSF from FITS file.

Parameters
filenamestr

File name

to_energy_dependent_table_psf(self, theta=None, rad=None, exposure=None)[source]

Convert triple Gaussian PSF ot table PSF.

Parameters
thetaAngle

Offset in the field of view. Default theta = 0 deg

radAngle

Offset from PSF center used for evaluating the PSF on a grid. Default offset = [0, 0.005, …, 1.495, 1.5] deg.

exposureQuantity

Energy dependent exposure. Should be in units equivalent to ‘cm^2 s’. Default exposure = 1.

Returns
tabe_psfEnergyDependentTablePSF

Instance of EnergyDependentTablePSF.

to_fits(self)[source]

Convert psf table data to FITS hdu list.

Returns
hdu_listHDUList

PSF in HDU list format.

to_psf3d(self, rad=None)[source]

Create a PSF3D from an analytical PSF.

Parameters
radQuantity or Angle

the array of position errors (rad) on which the PSF3D will be defined

Returns
psf3dPSF3D

the PSF3D. It will be defined on the same energy and offset values than the input psf.

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

Write PSF to FITS file.

Calls writeto, forwarding all arguments.