fasttrapz

sofia_redux.toolkit.resampling.fasttrapz(y, x)[source]

Fast 1-D integration using Trapezium method.

Approximates the integration of a 1-D discrete valued function \(y_i = f(x_i)\) with \(N\) measurements as:

\[\int_a^b f(x) \approx \frac{1}{2} \sum_{i=1}^{N}{ \left( y_{i - 1} + y_i \right) \left( x_i - x_{i - 1} \right) }\]
Parameters:
ynumpy.ndarray (N,)

Dependent variable

xnumpy.ndarray (N,)

Independent variable

Returns:
areafloat

The integrated area