cross_correlation

cross_correlation(x, y)

Cross-correlation of two series.

Mirrors the C# Fourier.Correlation: an FFT-based correlation, NOT a normalized correlation coefficient (see :func:correlation for that). Both series must have the same power-of-two length.

Parameters

Name Type Description Default
x array_like Equal, power-of-two length. required
y array_like Equal, power-of-two length. required

Returns

Name Type Description
numpy.ndarray Wraparound order: increasing positive lags in [0] up to [n/2 - 1], increasing negative lags in [n-1] down to [n/2].

Examples

>>> from corehydropy import cross_correlation
>>> len(cross_correlation([1, 2, 3, 4], [4, 3, 2, 1]))
4