Energy¶
-
class
gammapy.utils.energy.Energy[source]¶ Bases:
astropy.units.quantity.QuantityEnergy quantity scalar or array.
This is a
Quantitysub-class that adds convenience methods to handle common tasks for energy bin center arrays, like FITS I/O or generating equal-log-spaced grids of energies.See Energy handling in Gammapy for further information.
Parameters: energy :
array, scalar,QuantityEnergy
unit :
UnitBase, str, optionalThe unit of the value specified for the energy. This may be any string that
Unitunderstands, but it is better to give an actual unit object.dtype :
dtype, optionalSee
Quantity.copy : bool, optional
See
Quantity.Attributes Summary
nbinsThe number of bins. rangeThe covered energy range (tuple). Methods Summary
equal_log_spacing(emin, emax, nbins[, unit, ...])Create Energy with equal log-spacing ( Energy).from_fits(hdu[, unit])Read ENERGIES fits extension ( Energy).to_fits()Write ENERGIES fits extension Attributes Documentation
-
nbins¶ The number of bins.
-
range¶ The covered energy range (tuple).
Methods Documentation
-
classmethod
equal_log_spacing(emin, emax, nbins, unit=None, per_decade=False)[source]¶ Create Energy with equal log-spacing (
Energy).if no unit is given, it will be taken from emax
Parameters: emin :
Quantity, floatLowest energy bin
emax :
Quantity, floatHighest energy bin
nbins : int
Number of bins
unit :
UnitBase, strEnergy unit
per_decade : bool
Whether nbins is per decade.
-
classmethod
from_fits(hdu, unit=None)[source]¶ Read ENERGIES fits extension (
Energy).Parameters: hdu: `~astropy.io.fits.BinTableHDU`
ENERGIESextensions.unit :
UnitBase, str, NoneEnergy unit
-
to_fits()[source]¶ Write ENERGIES fits extension
Returns: hdu:
BinTableHDUENERGIES fits extension
-