On Thu, Nov 21, 2013 at 12:41 PM, Todd <toddrjen@gmail.com> wrote:


On Nov 21, 2013 11:00 AM, "Pierre Haessig" <pierre.haessig@crans.org> wrote:
>
> Le 20/11/2013 23:32, Todd a écrit :
> > I couldn't find a free copy of  that paper, but this one has a pdf
> > available and seems to cover the basics (and it is by the same group
> > so it has some of the same figures and most of the same equations).  I
> > may use it in the docstring instead.  You really only need to read the
> > first two pages (second and third pages of the pdf since the first
> > page is just citation information).
> >
> > http://scitation.aip.org/content/aip/journal/chaos/21/4/10.1063/1.3670512
> >
> > van Hemmen, JL, Longtin, A, and Vollmayr, AN.
> > Testing resonating vector strength: Auditory system, electric fish,
> > and noise.
> > Chaos 21, 047508 (2011); http://dx.doi.org/10.1063/1.3670512
> Thanks for this new reference.
>
> I've only read part of it now. It seems to me that van Hemmen's
> "Resonating Vector Strength" is really close to the Fourier transform,
> but specialized for "spike signals". Because the input data is the
> timing of the events, it's a very sparse description (as opposed to a
> dense vector with lots of "0"s and few "1"s)  which I guess leads to a
> quite efficient computation (compared to a dense fft). Is that right ?

Yes, that is pretty much correct.  However, if you know what the period you are looking for is (the conventional vector strength), or can narrow it down to a small list or range, then it is much easier to interpret than an FFT.

Also, although it is not emphasized in the paper, due to the mathematics you get the phase of the events for free.  So my implementation returns the phase automatically (people who don't want it can just exclude that value).

There is one thing I am not 100% sure about.  There are two ways to support multiple periods.  The first is using matrix multiplication, which is faster but results in a 2D matrix so it can take a lot more memory.  The other is a loop, which uses less memory but require more processing time.  I am not sure which is the recommended approach in this sort of situation.

I have a full version of the matrix-based version of the function  on github now.  It has documentation and unit tests and should be ready to create a pull request if it is okay.  It can be found here:

https://github.com/toddrjen/scipy/compare/vectorstrength