CrabSpectrum¶
-
class
gammapy.spectrum.
CrabSpectrum
(reference='meyer')[source]¶ Bases:
object
Crab nebula spectral model.
The Crab nebula is often used as a standard candle in gamma-ray astronomy. Fluxes and sensitivities are often quoted relative to the Crab spectrum.
The following references are available:
- ‘meyer’, http://adsabs.harvard.edu/abs/2010A%26A…523A…2M, Appendix D
- ‘hegra’, http://adsabs.harvard.edu/abs/2000ApJ…539..317A
- ‘hess_pl’ and ‘hess_ecpl’: http://adsabs.harvard.edu/abs/2006A%26A…457..899A
- ‘magic_lp’ and ‘magic_ecpl’: http://adsabs.harvard.edu/abs/2015JHEAp…5…30A
Parameters: reference : {‘meyer’, ‘hegra’, ‘hess_pl’, ‘hess_ecpl’, ‘magic_lp’, ‘magic_ecpl’}
Which reference to use for the spectral model.
Examples
Let’s first import what we need:
import astropy.units as u from gammapy.spectrum import CrabSpectrum from gammapy.spectrum.models import PowerLaw
Plot the ‘hess_ecpl’ reference Crab spectrum between 1 TeV and 100 TeV:
crab_hess_ecpl = CrabSpectrum('hess_ecpl') crab_hess_ecpl.model.plot([1, 100] * u.TeV)
Use a reference crab spectrum as unit to measure a differential flux (at 10 TeV):
>>> pwl = PowerLaw(index=2.3, amplitude=1e-12 * u.Unit('1 / (cm2 s TeV)'), reference=1 * u.TeV) >>> crab = CrabSpectrum('hess_pl').model >>> energy = 10 * u.TeV >>> dnde_cu = (pwl(energy) / crab(energy)).to('%') >>> print(dnde_cu) 6.19699156377 %
And the same for integral fluxes (between 1 and 10 TeV):
>>> # compute integral flux in crab units >>> emin, emax = [1, 10] * u.TeV >>> flux_int_cu = (pwl.integral(emin, emax) / crab.integral(emin, emax)).to('%') >>> print(flux_int_cu) 3.5350582166 %
Attributes Summary
references
Available references (see class docstring). Attributes Documentation
-
references
= ['meyer', 'hegra', 'hess_pl', 'hess_ecpl', 'magic_lp', 'magic_ecpl']¶ Available references (see class docstring).