class_docstr: CSP spatial filtering with covariance matrices as inputs.
  
  Implementation of the famous Common Spatial Pattern algorithm [1]_ [2]_,
  but with covariance matrices as input. In addition, the implementation
  allows different metric for the estimation of the class-related mean
  covariance matrices, as described in [3]_.
  
  This implementation support multiclass CSP by means of approximate joint
  diagonalization. In this case, the spatial filter selection is achieved
  according to [4]_.
  
  Parameters
  ----------
  nfilter : int, default=4
      The number of components to decompose M/EEG signals.
  metric : str, default='euclid'
      The metric for the estimation of mean covariance matrices.
  log : bool, default=True
      If true, return the log variance, otherwise return the spatially
      filtered covariance matrices.
  
  Attributes
  ----------
  filters_ : ndarray, shape (min(n_channels, n_filters), n_channels)
      If fit, the CSP spatial filters.
  patterns_ : ndarray, shape (min(n_channels, n_filters), n_channels)
      If fit, the CSP spatial patterns.
  
  See Also
  --------
  MDM, SPoC
  
  References
  ----------
  .. [1] `Spatial Patterns Underlying Population Differences in the
      Background EEG
      <https://link.springer.com/article/10.1007/BF01129656>`_
      Z. Koles, M. Lazar, and S. Zhou. Brain Topography 2(4), 275-284, 1990.
  .. [2] `Optimizing Spatial Filters for Robust EEG Single-Trial Analysis
      <https://ieeexplore.ieee.org/document/4408441>`_
      B. Blankertz, R. Tomioka, S. Lemm, M. Kawanabe, K-R. Muller. IEEE
      Signal Processing Magazine 25(1), 41-56, 2008.
  .. [3] `Common Spatial Pattern revisited by Riemannian geometry
      <https://hal.archives-ouvertes.fr/hal-00602686>`_
      A. Barachant, S. Bonnet, M. Congedo and C. Jutten. IEEE International
      Workshop on Multimedia Signal Processing (MMSP), p. 472-476, 2010.
  .. [4] `Multiclass common spatial patterns and information theoretic
      feature extraction
      <https://ieeexplore.ieee.org/document/4473042>`_
      IEEE Transactions on Biomedical Engineering, Volume 55, Issue 8,
      August 2008. pp. 1991 - 2000
docstr: Init.
docstr_tok: ["Init","."]
code: def __init__(self, nfilter=4, metric="euclid", log=True):
      """Init."""
      self.nfilter = nfilter
      self.metric = metric
      self.log = log
  
imports: import warnings
  import numpy
  from scipy.linalg import eigh, inv
  from sklearn.base import BaseEstimator, TransformerMixin
  from .utils.covariance import _check_cov_est_function, normalize, get_nondiag_weight
  from .utils.mean import mean_covariance
  from .utils.ajd import ajd_pham
  from .None import estimation
  from .preprocessing import Whitening
label_desc: Use image node_id 1 to create a new CSP object from inherited base classes: BilinearFilter with example: obj = CSP(nfilter, metric, log)