integrate_spectrum#
- gammapy.modeling.models.integrate_spectrum(func, energy_min, energy_max, ndecade=100, energy_flux=False, parameter_samples=None)[source]#
Integrate one-dimensional function using the log-log trapezoidal rule.
Internally an oversampling of the energy bins to “ndecade” is used.
To compute the integral func(E)*E (e.g. to get an energy flux) one can set
energy_flux
to True.- Parameters:
- funccallable
Function to integrate. Usually this is a
SpectralModel
- energy_min
Quantity
Integration range minimum.
- energy_max
Quantity
Integration range minimum.
- ndecadeint, optional
Number of grid points per decade used for the integration. Default is 100.
- parameter_sampleslist, optional
List of parameter quantities to pass to
func.evaluate
if it exists. This provides vectorized integral evaluation for parameter samples. If None, evaluation is performed with a simple call tofunc
. Default is None.- energy_fluxbool, optional
If True, the function will integrate func(E)*E, to compute the energy flux. Default is False.