Coding Cross Correlation Function in Python

2009-12-02 Thread DarthXander
I have two data sets which I wish to perform the discrete correlation function on and then plot the results for many values of t to see what if any time lag exists between the data. Thus far my code is; import csv import pylab from pylab import * from numpy import * from numpy import array

Re: Coding Cross Correlation Function in Python

2009-12-02 Thread DarthXander
On Dec 2, 7:12 pm, sturlamolden sturlamol...@yahoo.no wrote: For two 1D ndarrays, the cross-correlation is from numpy.fft import rfft, irfft from numpy import fliplr xcorr = lambda x,y : irfft(rfft(x)*rfft(fliplr(y))) Normalize as you wish, and preferably pad with zeros before invoking