[Numpy-discussion] numpy.correlate with phase offset 1D data series
Mon Mar 3 16:31:29 CST 2008
On Mon, Mar 3, 2008 at 2:45 PM, Ray Schumacher <firstname.lastname@example.org>
> At 01:24 PM 3/3/2008, you wrote:
> > > If you use 'same' or 'full' you'll end of with different
> > >amounts of offset. I imagine that this is due to the way the data is
> > >The offset should be deterministic based on the mode and the size of
> > >data, so it should be straightforward to compensate for.
> I agree
> > > If I use a real time domain signal like
> > > http://rjs.org/Python/sample.sig fh = open(r'sample.sig','rb') s1 =
> > > numpy.fromstring(fh.read(), numpy.int32) fh.close()
> >When I download this, it's full of NaNs. There's either a problem in the
> >I downloaded it or in the uploaded file. You didn't by chance upload it
> >an ASCII file did you?
> I just tested the URL myself with Firefox; it came down OK. It is a
> binary string from numpy.tostring(), 29,956 bytes of int32. It has a
> fundamental of 42 cycles in the data, and other fs of less power.
> I just uploaded a http://rjs.org/Python/sample.csv version
I'm going to guess that you are using some flavor of Unix, since I also
downloaded using Firefox and the data ends up corrupted. My hypothesis is
that Firefox doesn't recognize the mime type and treats it as a text file,
corrupting it on Windows, but not on Unix. Then again, maybe you're not
using Unix and my installation of Firefox is just broken. No biggy, the csv
version works fine in any event.
With the CSV version I do get a peak at the (un)expected location (7489//2).
The peak is pretty flat and only twice the size of the surrounding gunk, but
it looks more or less legit.
> Xie's 2D algorithm reduced to 1D works nicely for computing the
> relative phase, but is it the fastest way? It might be, since some
> correlation algorithms use FFTs as well. What does _correlateND use, in
I'm going to defer to Anne here. It sounds like she is more experienced in
this area. I will mention that at one point I put together a delay finder
that used cross correlation in combination with a quadratic fit tot he peak
and it worked quite well. However, that was some time ago and speed was not
a priority for me in that situation so, you may well be better off using
some other approach.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion