from gammapy.modeling.models import PowerLawSpectralModel pwl = PowerLawSpectralModel(index=2.5, reference="10 GeV") print(pwl)
PowerLawSpectralModel name = 'powerlaw' index = 2.5 amplitude= 1e-11 cm-2 s-1 TeV-1 reference= 10000.0 MeV
from gammapy.modeling.models import PowerLawSpectralModel import astropy.units as u pwl = PowerLawSpectralModel(index=3.0, amplitude=1e-11/u.TeV/u.cm**2/u.s) energy = 10 * u.GeV flux = pwl(energy) print(flux)
2.512375518721153e-13 cm^-2 s^-1In this example, we use the PowerLawSpectralModel to compute the flux at a given energy. This code snippet belongs to the gammapy package library.