Cross-correlation coefficients in Python
Returns coefficients (or inner product) and lags
This might save someone a bit of time, I could not find a standard xcorr function (like MATLAB's) in Python, which returns the coefficients of a cross correlation of two signals (instead of the inner product).
This code is adapted from matplotlib's xcorr function, I just separated the normalization from the plotting behavior.
Calls numpy.correlate(x,y, mode='full')
n = np.sqrt(np.dot(x, x) * np.dot(y, y))
coeffs = np.true_divide(innerproduct,n)