'Apply Xdawn dim reduction.
Parameters
epochs : Epochs | ndarray, shape (n_epochs, n_channels, n_times)
Data on which Xdawn filters will be applied.
Returns
X : ndarray, shape (n_epochs, n_components * n_event_types, n_times)
Spatially filtered signals.'

def transform(self, epochs):

    if isinstance(epochs, BaseEpochs):
        X = epochs.get_data()
    elif isinstance(epochs, np.ndarray):
        X = epochs
    else:
        raise ValueError('Data    input    must    be    of    Epoch    type    or    numpy    array')
    filters = [filt[:self.n_components] for filt in itervalues(self.filters_)]
    filters = np.concatenate(filters, axis=0)
    X = np.dot(filters, X)
    return X.transpose((1, 0, 2))
