class_docstr: Implementation of the Xdawn Algorithm.
  
  Xdawn :footcite:`RivetEtAl2009,RivetEtAl2011` is a spatial
  filtering method designed to improve the signal to signal + noise
  ratio (SSNR) of the ERP responses. Xdawn was originally designed for
  P300 evoked potential by enhancing the target response with respect
  to the non-target response. This implementation is a generalization
  to any type of ERP.
  
  Parameters
  ----------
  n_components : int, (default 2)
      The number of components to decompose the signals.
  signal_cov : None | Covariance | ndarray, shape (n_channels, n_channels)
      (default None). The signal covariance used for whitening of the data.
      if None, the covariance is estimated from the epochs signal.
  correct_overlap : 'auto' or bool (default 'auto')
      Compute the independent evoked responses per condition, while
      correcting for event overlaps if any. If 'auto', then
      overlapp_correction = True if the events do overlap.
  reg : float | str | None (default None)
      If not None (same as ``'empirical'``, default), allow
      regularization for covariance estimation.
      If float, shrinkage is used (0 <= shrinkage <= 1).
      For str options, ``reg`` will be passed as ``method`` to
      :func:`mne.compute_covariance`.
  
  Attributes
  ----------
  filters_ : dict of ndarray
      If fit, the Xdawn components used to decompose the data for each event
      type, else empty. For each event type, the filters are in the rows of
      the corresponding array.
  patterns_ : dict of ndarray
      If fit, the Xdawn patterns used to restore the signals for each event
      type, else empty.
  evokeds_ : dict of Evoked
      If fit, the evoked response for each event type.
  event_id_ : dict
      The event id.
  correct_overlap_ : bool
      Whether overlap correction was applied.
  
  See Also
  --------
  mne.decoding.CSP, mne.decoding.SPoC
  
  Notes
  -----
  .. versionadded:: 0.10
  
  References
  ----------
  .. footbibliography::
docstr: Remove selected components from the signal.
  
  Given the unmixing matrix, transform data,
  zero out components, and inverse transform the data.
  This procedure will reconstruct the signals from which
  the dynamics described by the excluded components is subtracted.
  
  Parameters
  ----------
  inst : instance of Raw | Epochs | Evoked
      The data to be processed.
  event_id : dict | list of str | None (default None)
      The kind of event to apply. if None, a dict of inst will be return
      one for each type of event xdawn has been fitted.
  include : array_like of int | None (default None)
      The indices referring to columns in the ummixing matrix. The
      components to be kept. If None, the first n_components (as defined
      in the Xdawn constructor) will be kept.
  exclude : array_like of int | None (default None)
      The indices referring to columns in the ummixing matrix. The
      components to be zeroed out. If None, all the components except the
      first n_components will be exclude.
  
  Returns
  -------
  out : dict
      A dict of instance (from the same type as inst input) for each
      event type in event_id.
docstr_tok: ["Remove","selected","components","from","the","signal",".","Given","the","unmixing","matrix",",","transform","data",",","zero","out","components",",","and","inverse","transform","the","data",".","This","procedure","will","reconstruct","the","signals","from","which","the","dynamics","described","by","the","excluded","components","is","subtracted",".","Parameters","--","--","--","--","--","inst",":","instance","of","Raw","|","Epochs","|","Evoked","The","data","to","be","processed",".","event_id",":","dict","|","list","of","str","|","None","(","default","None",")","The","kind","of","event","to","apply",".","if","None",",","a","dict","of","inst","will","be","return","one","for","each","type","of","event","xdawn","has","been","fitted",".","include",":","array_like","of","int","|","None","(","default","None",")","The","indices","referring","to","columns","in","the","ummixing","matrix",".","The","components","to","be","kept",".","If","None",",","the","first","n_components","(","as","defined","in","the","Xdawn","constructor",")","will","be","kept",".","exclude",":","array_like","of","int","|","None","(","default","None",")","The","indices","referring","to","columns","in","the","ummixing","matrix",".","The","components","to","be","zeroed","out",".","If","None",",","all","the","components","except","the","first","n_components","will","be","exclude",".","Returns","--","--","--","-","out",":","dict","A","dict","of","instance","(","from","the","same","type","as","inst","input",")","for","each","event","type","in","event_id","."]
code: def apply(self, inst, event_id=None, include=None, exclude=None):
      """Remove selected components from the signal.
  
      Given the unmixing matrix, transform data,
      zero out components, and inverse transform the data.
      This procedure will reconstruct the signals from which
      the dynamics described by the excluded components is subtracted.
  
      Parameters
      ----------
      inst : instance of Raw | Epochs | Evoked
          The data to be processed.
      event_id : dict | list of str | None (default None)
          The kind of event to apply. if None, a dict of inst will be return
          one for each type of event xdawn has been fitted.
      include : array_like of int | None (default None)
          The indices referring to columns in the ummixing matrix. The
          components to be kept. If None, the first n_components (as defined
          in the Xdawn constructor) will be kept.
      exclude : array_like of int | None (default None)
          The indices referring to columns in the ummixing matrix. The
          components to be zeroed out. If None, all the components except the
          first n_components will be exclude.
  
      Returns
      -------
      out : dict
          A dict of instance (from the same type as inst input) for each
          event type in event_id.
      """
      if event_id is None:
          event_id = self.event_id_
  
      if not isinstance(inst, (BaseRaw, BaseEpochs, Evoked)):
          raise ValueError(
              "Data input must be Raw, Epochs or Evoked type"
          )
      picks = _pick_data_channels(inst.info)
  
      # Define the components to keep
      default_exclude = list(
          range(self.n_components, len(inst.ch_names))
      )
      if exclude is None:
          exclude = default_exclude
      else:
          exclude = list(set(list(default_exclude) + list(exclude)))
  
      if isinstance(inst, BaseRaw):
          out = self._apply_raw(
              raw=inst,
              include=include,
              exclude=exclude,
              event_id=event_id,
              picks=picks,
          )
      elif isinstance(inst, BaseEpochs):
          out = self._apply_epochs(
              epochs=inst,
              include=include,
              picks=picks,
              exclude=exclude,
              event_id=event_id,
          )
      elif isinstance(inst, Evoked):
          out = self._apply_evoked(
              evoked=inst,
              include=include,
              picks=picks,
              exclude=exclude,
              event_id=event_id,
          )
      return out
  
imports: import numpy
  from scipy import linalg
  from .._fiff.pick import _pick_data_channels, pick_info
  from ..cov import Covariance, _regularized_covariance
  from ..decoding import BaseEstimator, TransformerMixin
  from ..epochs import BaseEpochs
  from ..evoked import Evoked, EvokedArray
  from ..io import BaseRaw
  from ..utils import _check_option, logger
label_desc: Use image node_id 4 for calling the Xdawn obj's underlying member method code with example usage: obj.apply(inst, event_id, include, exclude) and returns: out