interp_conserve

eazy.utils.interp_conserve(x, xp, fp, left=0.0, right=0.0)[source]

Interpolation analogous to numpy.interp but conserving “flux”.

Parameters:
xnumpy.ndarray

Desired interpolation locations

xp, fpnumpy.ndarray

The x and y coordinates of the function to be interpolated. The x array can be irregularly spaced but should be increase monotonically.

left, rightfloat

Values to use for extrapolation below the minimum and maximum limits of x.

Returns:
ylike x

Interpolated values.

Interpolation performed by trapezoidal integration between the midpoints
of the output x array with numpy.trapz.

Note

For a faster cython implementation of this function, see grizli.utils_c.interp_conserve_c.