[Numpy-discussion] numpy.correlate with phase offset 1D data series

Ray Schumacher subscriber100@rjs....
Mon Mar 3 13:57:12 CST 2008

I'm trying to figure out what numpy.correlate does, and, what are 
people using to calculate the phase shift of 1D signals?

(I coded on routine that uses rfft, conjugate, ratio, irfft, and 
argmax  based on a paper by Hongjie Xie "An IDL/ENVI implementation 
of the FFT Based Algorithm for Automatic Image Registration" - but 
that seems more intensive than it could be.)

In numpy, an identity
import numpy
from pylab import *
c=numpy.correlate(l,l, mode='same')
plot(c) peaks at the center, x=5, and is symmetric

when the data is rotated by 2
c=numpy.correlate(l, l[-2:]+l[:-2], mode='same')
it peaks at x=3

I was expecting, I guess, that the peak should reflect the x axis shift, as in

If I use a real time domain signal like
fh = open(r'sample.sig','rb')
s1 = numpy.fromstring(fh.read(), numpy.int32)

an identity like
c=numpy.correlate(s1, s1, mode='same')
plots like noise.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080303/2f09f79a/attachment.html 
-------------- next part --------------

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.3/1308 - Release Date: 3/3/2008 10:01 AM

More information about the Numpy-discussion mailing list