'Fit Xdawn spatial filters.
Parameters
X : array, shape (n_epochs, n_channels, n_samples)
The target data.
y : array, shape (n_epochs,) | None
The target labels. If None, Xdawn fit on the average evoked.
Returns
self : Xdawn instance
The Xdawn instance.'

def fit(self, X, y=None):

    (X, y) = self._check_Xy(X, y)
    self.classes_ = np.unique(y)
    (self.filters_, self.patterns_, _) = _fit_xdawn(X, y, n_components=self.n_components, reg=self.reg, signal_cov=self.signal_cov)
    return self
