compute_flux_points_dnde

gammapy.spectrum.compute_flux_points_dnde(flux_points, model, method='lafferty')[source]

Compute differential flux points quantities.

See: http://adsabs.harvard.edu/abs/1995NIMPA.355..541L for details on the 'lafferty' method.

Parameters:

flux_points : FluxPoints

Input integral flux points.

model : SpectralModel

Spectral model assumption. Note that the value of the amplitude parameter does not matter. Still it is recommended to use something with the right scale and units. E.g. amplitude = 1e-12 * u.Unit('cm-2 s-1 TeV-1')

method : {‘lafferty’, ‘log_center’, ‘table’}

Flux points e_ref estimation method:

  • 'laferty' Lafferty & Wyatt model-based e_ref
  • 'log_center' log bin center e_ref
  • 'table' using column ‘e_ref’ from input flux_points
Returns:

flux_points : FluxPoints

Flux points including differential quantity columns dnde and dnde_err (optional), dnde_ul (optional).

Examples

>>> from astropy import units as u
>>> from gammapy.spectrum import FluxPoints, compute_flux_points_dnde
>>> from gammapy.spectrum.models import PowerLaw
>>> filename = '$GAMMAPY_EXTRA/test_datasets/spectrum/flux_points/flux_points.fits'
>>> flux_points = FluxPoints.read(filename)
>>> model = PowerLaw(2.2 * u.Unit(''), 1e-12 * u.Unit('cm-2 s-1 TeV-1'), 1 * u.TeV)
>>> flux_point_dnde = compute_flux_points_dnde(flux_points, model=model)