PSFKing¶
-
class
gammapy.irf.PSFKing(axes, data=0, unit='', meta=None, interp_kwargs=None)[source]¶ Bases:
gammapy.irf.psf.parametric.ParametricPSFKing profile analytical PSF depending on energy and offset.
This PSF parametrisation and FITS data format is described here: PSF_KING.
- Parameters
- axeslist of
MapAxisorMapAxes Data axes, required are [“energy_true”, “offset”]
- metadict
Meta data
- axeslist of
Attributes Summary
MapAxesWhether the IRF depends on offset
Whether the IRF is pointlike of full containment.
Quantity
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, gamma, sigma)Containment of the PSF at given axes coordinates
evaluate_direct(rad, gamma, sigma)Evaluate the 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
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.
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.write(filename, *args, **kwargs)Write IRF to fits.
Attributes Documentation
-
axes¶ MapAxes
-
data¶
-
default_interp_kwargs= {'bounds_error': False, 'fill_value': None}¶
-
is_offset_dependent¶ Whether the IRF depends on offset
-
is_pointlike¶ Whether the IRF is pointlike of full containment.
-
quantity¶ Quantity
-
required_axes= ['energy_true', 'offset']¶
-
required_parameters= ['gamma', 'sigma']¶
-
tag= 'psf_king'¶
Methods Documentation
-
containment(rad, **kwargs)¶ Containment of the PSF at given axes coordinates
-
containment_radius(fraction, factor=20, **kwargs)¶ Containment radius at given axes coordinates
-
cumsum(axis_name)¶ Compute cumsum along a given axis
- Parameters
- axis_namestr
Along which axis to integrate.
- Returns
- irf
IRF Cumsum IRF
- irf
-
evaluate(rad, **kwargs)¶ Evaluate the PSF model.
-
static
evaluate_containment(rad, gamma, sigma)[source]¶ Containment of the PSF at given axes coordinates
-
static
evaluate_direct(rad, gamma, sigma)[source]¶ Evaluate the PSF model.
Formula is given here: PSF_KING.
-
evaluate_parameters(energy_true, offset)¶ Evaluate analytic PSF parameters at a given energy and offset.
Uses nearest-neighbor interpolation.
-
classmethod
from_hdulist(hdulist, hdu=None, format='gadf-dl3')¶ Create from
HDUList.- Parameters
- hdulist
HDUList HDU list
- hdustr
HDU name
- format{“gadf-dl3”}
Format specification
- hdulist
- Returns
- irf
IRF IRF class
- irf
-
classmethod
from_table(table, format='gadf-dl3')¶ Create parametric psf from
Table.- Parameters
- table
Table Table info.
- table
- Returns
- psf
ParametricPSF PSF class
- psf
-
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
- array
-
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
- array
-
interp_missing_data(axis_name)¶ Interpolate missing data along a given axis
-
normalize()¶ Normalize parametric PSF
-
pad(pad_width, axis_name, **kwargs)¶ Pad irf along a given axis.
- Parameters
- pad_width{sequence, array_like, int}
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 Padded irf
- irf
-
peek(figsize=(15, 5))¶ Quick-look summary plots.
-
plot_containment_radius(ax=None, fraction=0.68, add_cbar=True, **kwargs)¶ Plot containment image with energy and theta axes.
- Parameters
- ax
Axes Axes to plot on.
- fractionfloat
Containment fraction between 0 and 1.
- add_cbarbool
Add a colorbar
- **kwargsdict
Keyword arguments passed to
pcolormesh
- ax
- Returns
- ax
Axes Axes to plot on.
- ax
-
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.
-
plot_psf_vs_rad(ax=None, offset=<Quantity [0.] deg>, energy_true=<Quantity [ 0.1, 1., 10. ] TeV>, **kwargs)¶ Plot PSF vs rad.
-
classmethod
read(filename, hdu=None, format='gadf-dl3')¶ Read from file.
- Parameters
- filenamestr or
Path Filename
- hdustr
HDU name
- format{“gadf-dl3”}
Format specification
- filenamestr or
- Returns
- irf
IRF IRF class
- irf
-
to_hdulist(format='gadf-dl3')¶
-
to_psf3d(rad=None)¶ Create a PSF3D from a parametric PSF.
It will be defined on the same energy and offset values than the input psf.
-
to_table(format='gadf-dl3')¶ Convert PSF table data to table.
- Parameters
- format{“gadf-dl3”}
Format specification
- Returns
- hdu_list
HDUList PSF in HDU list format.
- hdu_list
-
to_table_hdu(format='gadf-dl3')¶ Convert to
BinTableHDU.- Parameters
- format{“gadf-dl3”}
Format specification
- Returns
- hdu
BinTableHDU IRF data table hdu
- hdu