def vectorstrength(events, period):
 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')
 scalarperiod = (not period.ndim)
 events = atleast_2d(events)
 period = atleast_2d(period)
 if (period <= 0).any():
  raise ValueError('periods must be positive')
 vectors = exp(dot(((2j * pi) / period.T), events))
 vectormean = mean(vectors, axis=1)
 strength = abs(vectormean)
 phase = angle(vectormean)
 if scalarperiod:
  strength = strength[0]
  phase = phase[0]
 return (strength, phase)

def vectorstrength ( events , period ) : 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' ) scalarperiod = ( not period . ndim ) events = atleast_2d ( events ) period = atleast_2d ( period ) if ( period <= 0 ) . any ( ) : raise ValueError ( 'periods must be positive' ) vectors = exp ( dot ( ( ( 2j * pi ) / period . T ) , events ) ) vectormean = mean ( vectors , axis = 1 ) strength = abs ( vectormean ) phase = angle ( vectormean ) if scalarperiod : strength = strength [ 0 ] phase = phase [ 0 ] return ( strength , phase )
determine the vector strength of the events corresponding to the given period .