code: def ctps(data, is_raw=True):
      """Compute cross-trial-phase-statistics [1].
  
      Note. It is assumed that the sources are already
      appropriately filtered
  
      Parameters
      ----------
      data: ndarray, shape (n_epochs, n_channels, n_times)
          Any kind of data of dimensions trials, traces, features.
      is_raw : bool
          If True it is assumed that data haven't been transformed to Hilbert
          space and phase angles haven't been normalized. Defaults to True.
  
      Returns
      -------
      ks_dynamics : ndarray, shape (n_sources, n_times)
          The kuiper statistics.
      pk_dynamics : ndarray, shape (n_sources, n_times)
          The normalized kuiper index for ICA sources and
          time slices.
      phase_angles : ndarray, shape (n_epochs, n_sources, n_times) | None
          The phase values for epochs, sources and time slices. If ``is_raw``
          is False, None is returned.
  
      References
      ----------
      [1] Dammers, J., Schiek, M., Boers, F., Silex, C., Zvyagintsev,
          M., Pietrzyk, U., Mathiak, K., 2008. Integration of amplitude
          and phase statistics for complete artifact removal in independent
          components of neuromagnetic recordings. Biomedical
          Engineering, IEEE Transactions on 55 (10), 2353-2362.
      """
      if not data.ndim == 3:
          raise ValueError(
              "Data must have 3 dimensions, not %i." % data.ndim
          )
  
      if is_raw:
          phase_angles = _compute_normalized_phase(data)
      else:
          phase_angles = data  # phase angles can be computed externally
  
      # initialize array for results
      ks_dynamics = np.zeros_like(phase_angles[0])
      pk_dynamics = np.zeros_like(phase_angles[0])
  
      # calculate Kuiper's statistic for each source
      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
  
imports: import math
  import numpy
  from scipy.signal import hilbert
  from scipy.special import logsumexp
label_desc: Use image node_id 2 for calling a global function with example usage: ctps(data, is_raw) and returns: ks_dynamics,  pk_dynamics,  unknown