LogEnergyAxis

class gammapy.spectrum.LogEnergyAxis(energy, mode='center')[source]

Bases: object

Log energy axis.

Defines a transformation between:

  • energy = 10 ** x
  • x = log10(energy)
  • pix in the range [0, …, len(x)] via linear interpolation of the x array, e.g. pix=0 corresponds to x[0] and pix=0.3 is 0.5 * (0.3 * x[0] + 0.7 * x[1])

Note

The specutils.Spectrum1DLookupWCS class is similar (only that it doesn’t include the log transformation and the API is different. Also see this Astropy feature request: https://github.com/astropy/astropy/issues/2362

Parameters:

energy : Quantity

Energy array

mode : [‘center’, ‘edges’]

Whether the energy array represents the values at the center or edges of the pixels.

Methods Summary

wcs_pix2world(z) Convert pixel to energy coordinates.
wcs_world2pix(energy) Convert energy to pixel coordinates.

Methods Documentation

wcs_pix2world(z)[source]

Convert pixel to energy coordinates.

Parameters:

z : float

Pixel coordinate

wcs_world2pix(energy)[source]

Convert energy to pixel coordinates.

Parameters:

energy : Quantity

Energy coordinate.