# EnergyDependentMultiGaussPSF#

class gammapy.irf.EnergyDependentMultiGaussPSF(axes, data=0, unit='', is_pointlike=False, fov_alignment=FoVAlignment.RADEC, meta=None, interp_kwargs=None)[source]#

Triple Gauss analytical PSF depending on true energy and offset.

Parameters
axeslist of `MapAxis`

Required axes are [“energy_true”, “offset”]

data`recarray`

Data array

Meta data

Examples

Plot R68 of the PSF vs. offset and true energy:

```import matplotlib.pyplot as plt
from gammapy.irf import EnergyDependentMultiGaussPSF
filename = '\$GAMMAPY_DATA/cta-1dc/caldb/data/cta/1dc/bcf/South_z20_50h/irf_file.fits'
plt.show()
```

Attributes Summary

 `axes` `MapAxes` `data` `default_interp_kwargs` `fov_alignment` Alignment of the field of view coordinate axes, see `FoVAlignment` `has_offset_axis` Whether the IRF explicitly depends on offset `is_pointlike` Whether the IRF is pointlike of full containment. `quantity` Quantity `required_axes` `required_parameters` `tag` `unit` Map unit (`Unit`)

Methods Summary

 `containment`(rad, **kwargs) Containment of the PSF at given axes coordinates `containment_radius`(fraction[, factor]) Containment radius at given axes coordinates `cumsum`(axis_name) Compute cumsum along a given axis `evaluate`(rad, **kwargs) Evaluate the PSF model. `evaluate_containment`(rad, **kwargs) Containment of the PSF at given axes coordinates `evaluate_direct`(rad, **kwargs) Evaluate psf model `evaluate_parameters`(energy_true, offset) Evaluate analytic PSF parameters at a given energy and offset. `from_hdulist`(hdulist[, hdu, format]) Create from `HDUList`. `from_table`(table[, format]) Create parametric psf from `Table`. `info`([fraction, energy_true, offset]) Print PSF summary info. `integral`(axis_name, **kwargs) Compute integral along a given axis `integrate_log_log`(axis_name, **kwargs) Integrate along a given axis. `interp_missing_data`(axis_name) Interpolate missing data along a given axis `is_allclose`(other[, rtol_axes, atol_axes]) Compare two data IRFs for equivalency Normalize parametric PSF `pad`(pad_width, axis_name, **kwargs) Pad irf along a given axis. `peek`([figsize]) Quick-look summary plots. `plot_containment_radius`([ax, fraction, add_cbar]) Plot containment image with energy and theta axes. `plot_containment_radius_vs_energy`([ax, ...]) Plot containment fraction as a function of energy. `plot_psf_vs_rad`([ax, offset, energy_true]) Plot PSF vs rad. `read`(filename[, hdu, format]) Read from file. `slice_by_idx`(slices) Slice sub IRF from IRF object. `to_hdulist`([format]) `to_psf3d`([rad]) Create a PSF3D from a parametric PSF. `to_table`([format]) Convert PSF table data to table. `to_table_hdu`([format]) Convert to `BinTableHDU`. `to_unit`(unit) Convert IRF to unit. `write`(filename, *args, **kwargs) Write IRF to fits.

Attributes Documentation

axes#

`MapAxes`

data#
default_interp_kwargs = {'bounds_error': False, 'fill_value': 0.0}#
fov_alignment#

Alignment of the field of view coordinate axes, see `FoVAlignment`

has_offset_axis#

Whether the IRF explicitly depends on offset

is_pointlike#

Whether the IRF is pointlike of full containment.

quantity#

Quantity

required_axes = ['energy_true', 'offset']#
required_parameters = ['sigma_1', 'sigma_2', 'sigma_3', 'scale', 'ampl_2', 'ampl_3']#
tag = 'psf_3gauss'#
unit#

Map unit (`Unit`)

Methods Documentation

Containment of the PSF at given axes coordinates

Parameters
rad`Quantity`

**kwargsdict

Other coordinates

Returns
containment`ndarray`

Containment

Containment radius at given axes coordinates

Parameters
fractionfloat or `ndarray`

Containment fraction

factorint

Up-sampling factor of the rad axis, determines the precision of the computed containment radius.

**kwargsdict

Other coordinates

Returns
radius`Angle`

cumsum(axis_name)#

Compute cumsum along a given axis

Parameters
axis_namestr

Along which axis to integrate.

Returns
irf`IRF`

Cumsum IRF

Evaluate the PSF model.

Parameters
rad`Angle`

Offset from PSF center used for evaluating the PSF on a grid

**kwargsdict

Other coordinates

Returns
psf_value`Quantity`

PSF value

Containment of the PSF at given axes coordinates

Parameters
rad`Quantity`

**kwargsdict

Parameters, see `required_parameters`

Returns
containment`ndarray`

Containment

Evaluate psf model

Parameters
rad`Quantity`

**kwargsdict

Parameters, see `required_parameters`

Returns
value`ndarray`

PSF value

evaluate_parameters(energy_true, offset)#

Evaluate analytic PSF parameters at a given energy and offset.

Uses nearest-neighbor interpolation.

Parameters
energy_true`Quantity`

energy value

offset`Angle`

Offset in the field of view

Returns
values`Quantity`

Interpolated value

Create from `HDUList`.

Parameters
hdulist`HDUList`

HDU list

hdustr

HDU name

Format specification

Returns
irf`IRF`

IRF class

Create parametric psf from `Table`.

Parameters
table`Table`

Table info.

Returns
psf`ParametricPSF`

PSF class

info(fraction=(0.68, 0.95), energy_true=<Quantity [[ 1.],            [10.]] TeV>, offset=<Quantity 0. deg>)#

Print PSF summary info.

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

Parameters
fractionlist

Containment fraction to compute containment radius for.

energy_true`Quantity`

Energies to compute containment radius for.

offset`Quantity`

Offset to compute containment radius for.

Returns
ssstring

Formatted string containing the summary info.

integral(axis_name, **kwargs)#

Compute integral along a given axis

This method uses interpolation of the cumulative sum.

Parameters
axis_namestr

Along which axis to integrate.

**kwargsdict

Coordinates at which to evaluate the IRF

Returns
array`Quantity`

Returns 2D array with axes offset

integrate_log_log(axis_name, **kwargs)#

Integrate along a given axis.

This method uses log-log trapezoidal integration.

Parameters
axis_namestr

Along which axis to integrate.

**kwargsdict

Coordinates at which to evaluate the IRF

Returns
array`Quantity`

Returns 2D array with axes offset

interp_missing_data(axis_name)#

Interpolate missing data along a given axis

is_allclose(other, rtol_axes=0.001, atol_axes=1e-06, **kwargs)#

Compare two data IRFs for equivalency

Parameters
other`gammapy.irfs.ParametricPSF`

The PSF to compare against

rtol_axesfloat

Relative tolerance for the axes comparison.

atol_axesfloat

Relative tolerance for the axes comparison.

**kwargsdict

keywords passed to `numpy.allclose`

Returns
is_allclosebool

Whether the IRF is all close.

normalize()#

Normalize parametric PSF

Pad irf along a given axis.

Parameters

Number of pixels padded to the edges of each axis.

axis_namestr

Which axis to downsample. By default spatial axes are padded.

**kwargsdict

Keyword argument forwarded to `pad`

Returns
irf`IRF`

peek(figsize=(15, 5))#

Quick-look summary plots.

Parameters
figsizetuple

Size of the figure.

Plot containment image with energy and theta axes.

Parameters
ax`Axes`

Axes to plot on.

fractionfloat

Containment fraction between 0 and 1.

**kwargsdict

Keyword arguments passed to `pcolormesh`

Returns
ax`Axes`

Axes to plot on.

plot_containment_radius_vs_energy(ax=None, fraction=(0.68, 0.95), offset=<Quantity [0., 1.] deg>, **kwargs)#

Plot containment fraction as a function of energy.

Parameters
ax`Axes`

Axes to plot on.

fractionlist of float or `ndarray`

Containment fraction between 0 and 1.

offset`Quantity`

Offset array

**kwargsdict

Keyword arguments passed to `plot`

Returns
ax`Axes`

Axes to plot on.

plot_psf_vs_rad(ax=None, offset=<Quantity [0.] deg>, energy_true=<Quantity [ 0.1, 1., 10. ] TeV>, **kwargs)#

Parameters
ax`Axes`

Axes to plot on.

offset`Angle`

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

energy_true`Quantity`

True energy at which to plot the profile

Parameters
filenamestr or `Path`

Filename

hdustr

HDU name

Format specification

Returns
irf`IRF`

IRF class

slice_by_idx(slices)#

Slice sub IRF from IRF object.

Parameters
slicesdict

Dict of axes names and `slice` object pairs. Contains one element for each non-spatial dimension. Axes not specified in the dict are kept unchanged.

Returns
sliced`IRF`

Sliced IRF object.

Create a PSF3D from a parametric PSF.

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

Parameters
rad`Quantity`

Returns
psf3d`PSF3D`

PSF3D.

Convert PSF table data to table.

Parameters

Format specification

Returns
hdu_list`HDUList`

PSF in HDU list format.

Convert to `BinTableHDU`.

Parameters

Format specification

Returns
hdu`BinTableHDU`

IRF data table hdu

to_unit(unit)#

Convert IRF to unit.

write(filename, *args, **kwargs)#

Write IRF to fits.

Calls `writeto`, forwarding all arguments.