_cross_correlation

_cross_correlation(a: numpy.ndarray, b: numpy.ndarray, maxlags: Optional[int] = None, normed: bool = True) Tuple[numpy.ndarray, numpy.ndarray][source]

Calculate cross correlation between arrays.

This implementation is slow: O(n^2), but can properly ignore NaNs.

Parameters
  • a (numpy.ndarray) – first array, should be equal length with b

  • b (numpy.ndarray) – second array, should be equal length with a

  • maxlags (Optional[int]) – number of lags to compare, should be >=1 and < len(a)

  • normed (bool) – should correlations be normed or not

Returns

  • lags: array of size maxlags * 2 + 1 represents for which lags correlations are calculated in result

  • result: array of size maxlags * 2 + 1 represents found correlations

Return type

lags, result

Raises
  • ValueError: – lengths of a and b are not the same

  • ValueError: – parameter maxlags doesn’t satisfy constraints