[SciPy-Dev] Vector Strength function

josef.pktd@gmai... josef.pktd@gmai...
Wed Jan 9 13:44:44 CST 2013


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
>


More information about the SciPy-Dev mailing list