integrate_spectrum

gammapy.utils.integrate.integrate_spectrum(func, xmin, xmax, ndecade=100, intervals=False)[source]

Integrate 1d function using the log-log trapezoidal rule.

If scalar values for xmin and xmax are passed an oversampled grid is generated using the ndecade keyword argument. If xmin and xmax arrays are passed, no oversampling is performed and the integral is computed in the provided grid.

Parameters
funccallable

Function to integrate.

xminQuantity or array-like

Integration range minimum

xmaxQuantity or array-like

Integration range minimum

ndecadeint, optional

Number of grid points per decade used for the integration. Default : 100.

intervalsbool, optional

Return integrals in the grid not the sum, default: False