def ctps(data, is_raw=True):
 if (not (data.ndim == 3)):
  ValueError(('Data must have 3 dimensions, not %i.' % data.ndim))
 if is_raw:
  phase_angles = _compute_normalized_phase(data)
 else:
  phase_angles = data
 ks_dynamics = np.zeros_like(phase_angles[0])
 pk_dynamics = np.zeros_like(phase_angles[0])
 for (ii, source) in enumerate(np.transpose(phase_angles, [1, 0, 2])):
  (ks, pk) = kuiper(source)
  pk_dynamics[ii, :] = pk
  ks_dynamics[ii, :] = ks
 return (ks_dynamics, pk_dynamics, (phase_angles if is_raw else None))

def ctps ( data , is_raw = True ) : if ( not ( data . ndim == 3 ) ) : ValueError ( ( 'Data must have 3 dimensions, not %i.' % data . ndim ) ) if is_raw : phase_angles = _compute_normalized_phase ( data ) else : phase_angles = data ks_dynamics = np . zeros_like ( phase_angles [ 0 ] ) pk_dynamics = np . zeros_like ( phase_angles [ 0 ] ) for ( ii , source ) in enumerate ( np . transpose ( phase_angles , [ 1 , 0 , 2 ] ) ) : ( ks , pk ) = kuiper ( source ) pk_dynamics [ ii , : ] = pk ks_dynamics [ ii , : ] = ks return ( ks_dynamics , pk_dynamics , ( phase_angles if is_raw else None ) )
compute cross-trial-phase-statistics [1] .