class_docstr: Estimation of squared coherence matrices.
  
  Squared coherence matrices estimation [1]_. This method will return a 4-d
  array with a squared coherence matrix estimation for each input and in
  each frequency bin of the FFT.
  
  Parameters
  ----------
  window : int, default=128
      The length of the FFT window used for spectral estimation.
  overlap : float, default=0.75
      The percentage of overlap between window.
  fmin : float | None, default=None
      the minimal frequency to be returned.
  fmax : float | None, default=None
      The maximal frequency to be returned.
  fs : float | None, default=None
      The sampling frequency of the signal.
  coh : {'ordinary', 'instantaneous', 'lagged', 'imaginary'},             default='ordinary'
      The coherence type:
  
      * 'ordinary' for the ordinary coherence, defined in Eq.(22) of [1]_;
        this normalization of cross-spectral matrices captures both in-phase
        and out-of-phase correlations. However it is inflated by the
        artificial in-phase (zero-lag) correlation engendered by volume
        conduction.
      * 'instantaneous' for the instantaneous coherence, Eq.(26) of [1]_,
        capturing only in-phase correlation.
      * 'lagged' for the lagged-coherence, Eq.(28) of [1]_, capturing only
        out-of-phase correlation (not defined for DC and Nyquist bins).
      * 'imaginary' for the imaginary coherence [2]_, Eq.(0.16) of [3]_,
        capturing out-of-phase correlation but still affected by in-phase
        correlation.
  
  Attributes
  ----------
  freqs_ : ndarray, shape (n_freqs,)
      If transformed, the frequencies associated to cospectra.
      None if ``fs`` is None.
  
  Notes
  -----
  .. versionadded:: 0.3
  
  See Also
  --------
  Covariances
  HankelCovariances
  CospCovariances
  
  References
  ----------
  .. [1] `Instantaneous and lagged measurements of linear
      and nonlinear dependence between groups of multivariate time series:
      frequency decomposition
      <https://arxiv.org/ftp/arxiv/papers/0711/0711.1455.pdf>`_
      R. Pascual-Marqui. Technical report, 2007.
  .. [2] `Identifying true brain interaction from EEG data using the
      imaginary part of coherency
      <https://doi.org/10.1016/j.clinph.2004.04.029>`_
      G. Nolte, O. Bai, L. Wheaton, Z. Mari, S. Vorbach, M. Hallett.
      Clinical Neurophysioly, Volume 115, Issue 10, October 2004,
      Pages 2292-2307
  .. [3] `Non-Parametric Synchronization Measures used in EEG
      and MEG
      <https://hal.archives-ouvertes.fr/hal-01868538v2>`_
      M. Congedo. Technical Report, 2018.
docstr: Estimate the squared coherences matrices.
  
  Parameters
  ----------
  X : ndarray, shape (n_matrices, n_channels, n_times)
      Multi-channel time-series.
  
  Returns
  -------
  covmats : ndarray, shape (n_matrices, n_channels, n_channels, n_freqs)
      Squared coherence matrices for each input and for each frequency
      bin.
docstr_tok: ["Estimate","the","squared","coherences","matrices",".","Parameters","--","--","--","--","--","X",":","ndarray",",","shape","(","n_matrices",",","n_channels",",","n_times",")","Multi-channel","time-series",".","Returns","--","--","--","-","covmats",":","ndarray",",","shape","(","n_matrices",",","n_channels",",","n_channels",",","n_freqs",")","Squared","coherence","matrices","for","each","input","and","for","each","frequency","bin","."]
code: def transform(self, X):
      """Estimate the squared coherences matrices.
  
      Parameters
      ----------
      X : ndarray, shape (n_matrices, n_channels, n_times)
          Multi-channel time-series.
  
      Returns
      -------
      covmats : ndarray, shape (n_matrices, n_channels, n_channels, n_freqs)
          Squared coherence matrices for each input and for each frequency
          bin.
      """
      out = []
  
      for i in range(len(X)):
          S, freqs = coherence(
              X[i],
              window=self.window,
              overlap=self.overlap,
              fmin=self.fmin,
              fmax=self.fmax,
              fs=self.fs,
              coh=self.coh,
          )
          out.append(S)
      self.freqs_ = freqs
  
      return np.array(out)
  
imports: import numpy
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.covariance import shrunk_covariance
  from sklearn.metrics.pairwise import pairwise_kernels
  from .spatialfilters import Xdawn
  from .utils.covariance import covariances, covariances_EP, cospectrum, coherence, block_covariances
label_desc: Use image node_id 2 for calling the Coherences obj's underlying member method code with example usage: obj.transform(X) and returns: np