code: def vectorstrength(events, period):
      """
      Determine the vector strength of the events corresponding to the given
      period.
  
      The vector strength is a measure of phase synchrony, how well the
      timing of the events is synchronized to a single period of a periodic
      signal.
  
      If multiple periods are used, calculate the vector strength of each.
      This is called the "resonating vector strength".
  
      Parameters
      ----------
      events : 1D array_like
          An array of time points containing the timing of the events.
      period : float or array_like
          The period of the signal that the events should synchronize to.
          The period is in the same units as `events`.  It can also be an array
          of periods, in which case the outputs are arrays of the same length.
  
      Returns
      -------
      strength : float or 1D array
          The strength of the synchronization.  1.0 is perfect synchronization
          and 0.0 is no synchronization.  If `period` is an array, this is also
          an array with each element containing the vector strength at the
          corresponding period.
      phase : float or array
          The phase that the events are most strongly synchronized to in radians.
          If `period` is an array, this is also an array with each element
          containing the phase for the corresponding period.
  
      References
      ----------
      van Hemmen, JL, Longtin, A, and Vollmayr, AN. Testing resonating vector
          strength: Auditory system, electric fish, and noise.
          Chaos 21, 047508 (2011);
          :doi:`10.1063/1.3670512`.
      van Hemmen, JL.  Vector strength after Goldberg, Brown, and von Mises:
          biological and mathematical perspectives.  Biol Cybern.
          2013 Aug;107(4):385-96. :doi:`10.1007/s00422-013-0561-7`.
      van Hemmen, JL and Vollmayr, AN.  Resonating vector strength: what happens
          when we vary the "probing" frequency while keeping the spike times
          fixed.  Biol Cybern. 2013 Aug;107(4):491-94.
          :doi:`10.1007/s00422-013-0560-8`.
      """
      events = asarray(events)
      period = asarray(period)
      if events.ndim > 1:
          raise ValueError("events cannot have dimensions more than 1")
      if period.ndim > 1:
          raise ValueError("period cannot have dimensions more than 1")
  
      # we need to know later if period was originally a scalar
      scalarperiod = not period.ndim
  
      events = atleast_2d(events)
      period = atleast_2d(period)
      if (period <= 0).any():
          raise ValueError("periods must be positive")
  
      # this converts the times to vectors
      vectors = exp(dot(2j * pi / period.T, events))
  
      # the vector strength is just the magnitude of the mean of the vectors
      # the vector phase is the angle of the mean of the vectors
      vectormean = mean(vectors, axis=1)
      strength = abs(vectormean)
      phase = angle(vectormean)
  
      # if the original period was a scalar, return scalars
      if scalarperiod:
          strength = strength[0]
          phase = phase[0]
      return strength, phase
  
imports: from __future__ import division, print_function, absolute_import
  import operator
  import threading
  import sys
  import timeit
  from scipy.spatial import cKDTree
  from .None import sigtools, dlti
  from ._upfirdn import upfirdn, _output_len
  from scipy._lib.six import callable
  from scipy._lib._version import NumpyVersion
  from scipy import fftpack, linalg
  from scipy.fftpack.helper import _init_nd_shape_and_axes_sorted
  from numpy import allclose, angle, arange, argsort, array, asarray, atleast_1d, atleast_2d, cast, dot, exp, expand_dims, iscomplexobj, mean, ndarray, newaxis, ones, pi, poly, polyadd, polyder, polydiv, polymul, polysub, polyval, product, r_, ravel, real_if_close, reshape, roots, sort, take, transpose, unique, where, zeros, zeros_like
  import numpy
  import math
  from scipy.special import factorial
  from .windows import get_window
  from ._arraytools import axis_slice, axis_reverse, odd_ext, even_ext, const_ext
  from .filter_design import cheby1, _validate_sos
  from .fir_filter_design import firwin
label_desc: Use image node_id 34 for calling a global function with example usage: vectorstrength(events, period) and returns: strength,  phase