I am interested in implementing a function for scipy. The function is called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase. It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform. However, it is useful for determining how periodic a supposedly periodic set of events really are, for example: 1. Determining whether crime is really more common during a full moon and by how much 2. Determining how concentrated visitors to a coffee shop are during rush hour 3. Determining exactly how concentrated hurricanes are during hurricane season My thinking is that this could be implemented in stages: First would be a Numpy function that would add a set of vectors in polar coordinates. Given a number of magnitude/angle pairs it would provide a summed magnitude/angle pair. This would probably be combined with a cartesian<->polar conversion functions. Making use of this function would be a scipy function that would actually implement the vector strength calculation. This is done by treating each event as a unit vector with a phase, then taking the average of the vectors. If all events have the same phase, the result will have an amplitude of 1. If they all have a different phases, the result will have an amplitude of 0. It may even be worth having a dedicated polar dtype, although that may be too much. What does everyone think of this proposal?
On Wed, Jan 9, 2013 at 12:32 PM, Todd <toddrjen@gmail.com> wrote:
I am interested in implementing a function for scipy. The function is called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase.
It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform.
However, it is useful for determining how periodic a supposedly periodic set of events really are, for example:
1. Determining whether crime is really more common during a full moon and by how much 2. Determining how concentrated visitors to a coffee shop are during rush hour 3. Determining exactly how concentrated hurricanes are during hurricane season
My thinking is that this could be implemented in stages:
First would be a Numpy function that would add a set of vectors in polar coordinates. Given a number of magnitude/angle pairs it would provide a summed magnitude/angle pair. This would probably be combined with a cartesian<->polar conversion functions.
Making use of this function would be a scipy function that would actually implement the vector strength calculation. This is done by treating each event as a unit vector with a phase, then taking the average of the vectors. If all events have the same phase, the result will have an amplitude of 1. If they all have a different phases, the result will have an amplitude of 0.
It may even be worth having a dedicated polar dtype, although that may be too much.
What does everyone think of this proposal?
Is this the same as a mean resultant in circular statistics? def circular_resultant(rads, axis=0): mp = np.sum(np.exp(1j*rads), axis=axis) rho = np.abs(mp) mu = np.angle(mp) return mp, rho, mu Josef
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
On Wed, Jan 9, 2013 at 8:44 PM, <josef.pktd@gmail.com> wrote:
I am interested in implementing a function for scipy. The function is called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase.
It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform.
However, it is useful for determining how periodic a supposedly periodic set of events really are, for example:
1. Determining whether crime is really more common during a full moon and by how much 2. Determining how concentrated visitors to a coffee shop are during rush hour 3. Determining exactly how concentrated hurricanes are during hurricane season
My thinking is that this could be implemented in stages:
First would be a Numpy function that would add a set of vectors in polar coordinates. Given a number of magnitude/angle pairs it would provide a summed magnitude/angle pair. This would probably be combined with a cartesian<->polar conversion functions.
Making use of this function would be a scipy function that would actually implement the vector strength calculation. This is done by treating each event as a unit vector with a phase, then taking the average of the vectors. If all events have the same phase, the result will have an amplitude of
On Wed, Jan 9, 2013 at 12:32 PM, Todd <toddrjen@gmail.com> wrote: 1.
If they all have a different phases, the result will have an amplitude of 0.
It may even be worth having a dedicated polar dtype, although that may be too much.
What does everyone think of this proposal?
Is this the same as a mean resultant in circular statistics?
def circular_resultant(rads, axis=0): mp = np.sum(np.exp(1j*rads), axis=axis) rho = np.abs(mp) mu = np.angle(mp)
return mp, rho, mu
Josef
It looks to be the same as the first part of my proposal.
On Fri, Feb 1, 2013 at 5:19 PM, Todd <toddrjen@gmail.com> wrote:
On Wed, Jan 9, 2013 at 8:44 PM, <josef.pktd@gmail.com> wrote:
I am interested in implementing a function for scipy. The function is called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase.
It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform.
However, it is useful for determining how periodic a supposedly
of events really are, for example:
1. Determining whether crime is really more common during a full moon and by how much 2. Determining how concentrated visitors to a coffee shop are during rush hour 3. Determining exactly how concentrated hurricanes are during hurricane season
My thinking is that this could be implemented in stages:
First would be a Numpy function that would add a set of vectors in polar coordinates. Given a number of magnitude/angle pairs it would provide a summed magnitude/angle pair. This would probably be combined with a cartesian<->polar conversion functions.
Making use of this function would be a scipy function that would actually implement the vector strength calculation. This is done by treating each event as a unit vector with a phase, then taking the average of the vectors. If all events have the same phase, the result will have an amplitude of
On Wed, Jan 9, 2013 at 12:32 PM, Todd <toddrjen@gmail.com> wrote: periodic set 1.
If they all have a different phases, the result will have an amplitude of 0.
It may even be worth having a dedicated polar dtype, although that may be too much.
What does everyone think of this proposal?
Is this the same as a mean resultant in circular statistics?
def circular_resultant(rads, axis=0): mp = np.sum(np.exp(1j*rads), axis=axis) rho = np.abs(mp) mu = np.angle(mp)
return mp, rho, mu
Josef
It looks to be the same as the first part of my proposal.
So does anyone have any opinions on this?
On Wed, Mar 27, 2013 at 10:37 AM, Todd <toddrjen@gmail.com> wrote:
On Fri, Feb 1, 2013 at 5:19 PM, Todd <toddrjen@gmail.com> wrote:
On Wed, Jan 9, 2013 at 8:44 PM, <josef.pktd@gmail.com> wrote:
I am interested in implementing a function for scipy. The function is called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase.
It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform.
However, it is useful for determining how periodic a supposedly
of events really are, for example:
1. Determining whether crime is really more common during a full moon and by how much 2. Determining how concentrated visitors to a coffee shop are during rush hour 3. Determining exactly how concentrated hurricanes are during hurricane season
My thinking is that this could be implemented in stages:
First would be a Numpy function that would add a set of vectors in
On Wed, Jan 9, 2013 at 12:32 PM, Todd <toddrjen@gmail.com> wrote: periodic set polar
coordinates. Given a number of magnitude/angle pairs it would provide a summed magnitude/angle pair. This would probably be combined with a cartesian<->polar conversion functions.
Making use of this function would be a scipy function that would actually implement the vector strength calculation. This is done by treating each event as a unit vector with a phase, then taking the average of the vectors. If all events have the same phase, the result will have an amplitude of 1. If they all have a different phases, the result will have an amplitude of 0.
It may even be worth having a dedicated polar dtype, although that may be too much.
What does everyone think of this proposal?
Is this the same as a mean resultant in circular statistics?
def circular_resultant(rads, axis=0): mp = np.sum(np.exp(1j*rads), axis=axis) rho = np.abs(mp) mu = np.angle(mp)
return mp, rho, mu
Josef
It looks to be the same as the first part of my proposal.
So does anyone have any opinions on this?
I would like to revisit this. The original proposal was to implement something called "vector strength", which is a measure of how periodic a set of events are. It seems fairly generally useful. Trying to determine if particular events are periodic, exactly how periodic they are, or what phase of a period they are synchronized to seems to me to be a question that would be encountered a lot. My original proposal was fairly complex, but looking at the mathematics it turns out it can be implemented fairly simply. I have an implementation already. The actual mathematical components is only a few lines, although there is some housekeeping at the beginning and end to allow for multiple target periods. If anyone thinks this is useful I can implement some unit tests and go ahead and submit it.
Dear Todd, On Tue, Nov 19, 2013 at 12:46 PM, Todd <toddrjen@gmail.com> wrote:
On Wed, Mar 27, 2013 at 10:37 AM, Todd <toddrjen@gmail.com> wrote:
On Fri, Feb 1, 2013 at 5:19 PM, Todd <toddrjen@gmail.com> wrote:
On Wed, Jan 9, 2013 at 8:44 PM, <josef.pktd@gmail.com> wrote:
On Wed, Jan 9, 2013 at 12:32 PM, Todd <toddrjen@gmail.com> wrote:
I am interested in implementing a function for scipy. The function is called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase.
It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform.
Would you suggest some reference where to read the details about this approach? Thanks Cheers, Eraldo
On Nov 20, 2013 12:39 PM, "Eraldo Pomponi" <eraldo.pomponi@gmail.com> wrote:
Dear Todd,
On Tue, Nov 19, 2013 at 12:46 PM, Todd <toddrjen@gmail.com> wrote:
On Wed, Mar 27, 2013 at 10:37 AM, Todd <toddrjen@gmail.com> wrote:
On Fri, Feb 1, 2013 at 5:19 PM, Todd <toddrjen@gmail.com> wrote:
On Wed, Jan 9, 2013 at 8:44 PM, <josef.pktd@gmail.com> wrote:
On Wed, Jan 9, 2013 at 12:32 PM, Todd <toddrjen@gmail.com> wrote:
I am interested in implementing a function for scipy. The function
is
called "vector strength". It is basically a measure of how reliably a set of events occur at a particular phase.
It was originally developed for neuroscience research, to determine how well a set of neural events sync up with a periodic stimulus like a sound waveform.
Would you suggest some reference where to read the details about this approach? Thanks
Cheers, Eraldo
This paper is pretty good, although fairly technical (I use it as a reference in the docstring as well): http://link.springer.com/article/10.1007%2Fs00422-013-0561-7 J. Leo van Hemmen. Vector strength after Goldberg, Brown, and von Mises: biological and mathematical perspectives. Biological Cybernetics August 2013, Volume 107, Issue 4, pp 385-396
Hi, Le 20/11/2013 17:25, Todd a écrit :
This paper is pretty good, although fairly technical (I use it as a reference in the docstring as well):
http://link.springer.com/article/10.1007%2Fs00422-013-0561-7
Sounds pretty interesting. I was curious to read it but I didn't find an author version on Google Scholar. Is there any freely available manuscript somewhere ? best, Pierre
On Wed, Nov 20, 2013 at 10:51 PM, Pierre Haessig <pierre.haessig@crans.org>wrote:
Hi,
Le 20/11/2013 17:25, Todd a écrit :
This paper is pretty good, although fairly technical (I use it as a reference in the docstring as well):
http://link.springer.com/article/10.1007%2Fs00422-013-0561-7
Sounds pretty interesting. I was curious to read it but I didn't find an author version on Google Scholar. Is there any freely available manuscript somewhere ?
best, Pierre
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
Dear Todd,
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 a lot for this new reference .... I searched too for a free copy of the first one without success. Cheers, Eraldo
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 ? best, Pierre
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.
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
participants (4)
-
Eraldo Pomponi
-
josef.pktd@gmail.com
-
Pierre Haessig
-
Todd