PowerLaw

class gammapy.spectrum.models.PowerLaw(index, amplitude, reference)[source]

Bases: gammapy.spectrum.models.SpectralModel

Spectral power-law model.

\[\phi(E) = \phi_0 \cdot \left( \frac{E}{E_0} \right)^{-\Gamma}\]
Parameters:

index : Quantity

\(\Gamma\)

amplitude : Quantity

\(Phi_0\)

reference : Quantity

\(E_0\)

Methods Summary

energy_flux(emin, emax) Compute energy flux in given energy range analytically.
energy_flux_error(emin, emax, **kwargs) Compute energy flux in given energy range analytically with error propagation.
evaluate(energy, index, amplitude, reference)
integral(emin, emax, **kwargs) Integrate power law analytically.
integral_error(emin, emax, **kwargs) Integrate power law analytically with error propagation.
inverse(value) Return energy for a given function value of the spectral model.
to_sherpa([name]) Return Sherpa PowLaw1d

Methods Documentation

energy_flux(emin, emax)[source]

Compute energy flux in given energy range analytically.

\[G(E_{min}, E_{max}) = \int_{E_{min}}^{E_{max}}E \phi(E)dE = \left. \phi_0 \frac{E_0^2}{-\Gamma + 2} \left( \frac{E}{E_0} \right)^{-\Gamma + 2} \right \vert _{E_{min}}^{E_{max}}\]
Parameters:

emin, emax : Quantity

Lower and upper bound of integration range.

energy_flux_error(emin, emax, **kwargs)[source]

Compute energy flux in given energy range analytically with error propagation.

Parameters:

emin, emax : Quantity

Lower and upper bound of integration range.

Returns:

energy_flux, energy_flux_error : tuple of Quantity

Tuple of energy flux and energy flux error.

static evaluate(energy, index, amplitude, reference)[source]
integral(emin, emax, **kwargs)[source]

Integrate power law analytically.

\[F(E_{min}, E_{max}) = \int_{E_{min}}^{E_{max}}\phi(E)dE = \left. \phi_0 \frac{E_0}{-\Gamma + 1} \left( \frac{E}{E_0} \right)^{-\Gamma + 1} \right \vert _{E_{min}}^{E_{max}}\]
Parameters:

emin, emax : Quantity

Lower and upper bound of integration range.

integral_error(emin, emax, **kwargs)[source]

Integrate power law analytically with error propagation.

Parameters:

emin, emax : Quantity

Lower and upper bound of integration range.

Returns:

integral, integral_error : tuple of Quantity

Tuple of integral flux and integral flux error.

inverse(value)[source]

Return energy for a given function value of the spectral model.

Parameters:

value : Quantity

Function value of the spectral model.

to_sherpa(name='default')[source]

Return Sherpa PowLaw1d

Parameters:

name : str, optional

Name of the sherpa model instance