On Thu, Jun 4, 2009 at 5:14 AM, David Cournapeau <courn...@gmail.com> wrote:
> On Tue, Jun 2, 2009 at 10:56 PM, Ryan May <rma...@gmail.com> wrote: > > On Tue, Jun 2, 2009 at 5:59 AM, David Cournapeau > > <da...@ar.media.kyoto-u.ac.jp> wrote: > >> > >> Robin wrote: > >> > On Tue, Jun 2, 2009 at 11:36 AM, David Cournapeau <courn...@gmail.com > > > >> > wrote: > >> > > >> >> Done in r7031 - correlate/PyArray_Correlate should be unchanged, and > >> >> acorrelate/PyArray_Acorrelate implement the conventional definitions, > >> >> > >> > > >> > I don't know if it's been discussed before but while people are > >> > thinking about/changing correlate I thought I'd like to request as a > >> > user a matlab style xcorr function (basically with the functionality > >> > of the matlab version). > >> > > >> > I don't know if this is a deliberate emission, but it is often one of > >> > the first things my colleagues try when I get them using Python, and > >> > as far as I know there isn't really a good answer. There is xcorr in > >> > pylab, but it isn't vectorised like xcorr from matlab... > >> > > >> > >> There is one in the talkbox scikit: > >> > >> > >> > http://github.com/cournape/talkbox/blob/202135a9d848931ebd036b97302f1e10d7488c63/scikits/talkbox/tools/correlations.py > >> > >> It uses the fft, and bonus point, the file is independent of the rest of > >> toolbox. There is another version which uses direct implementation (this > >> is faster if you need only a few lags, and it takes less memory too). > > > > I'd be +1 on including something like this (provided it expanded to > include > > complex-valued data). I think it's a real need, since everyone seems to > > keep rolling their own. I had to write my own just so that I can > calculate > > a few lags in a vectorized fashion. > > The code in talkbox is not good enough for scipy. I made an attempt > for scipy.signal here: > > > http://github.com/cournape/scipy3/blob/b004d17d824f1c03921d9663207ee40adadc5762/scipy/signal/correlations.py > > It is reasonably fast when only a few lags are needed, both double and > complex double are supported, and it works on arbitrary axis and lags. > Other precisions should be easy to add, but I think I need to extend > the numpy code generators to support cython sources to avoid code > duplication. > > Does that fill your need ? It would fill mine. Would it make sense to make y default to x, so that you can use xcorr to do the autocorrelation as: xcorr(x) ? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion