Coding Cross Correlation Function in Python
DarthXander
DarthXander at hotmail.co.uk
Wed Dec 2 14:20:47 EST 2009
On Dec 2, 7:12 pm, sturlamolden <sturlamol... at 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
> xcorr.
Thanks, though I'd like to do this longer hand than the built in
functions! Great to approximate it though.
More information about the Python-list
mailing list