MCPcopy
hub / github.com/mne-tools/mne-python / inverse_transform

Method inverse_transform

mne/decoding/xdawn.py:213–241  ·  view source on GitHub ↗

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.

(self, X)

Source from the content-addressed store, hash-verified

211 return X
212
213 def inverse_transform(self, X):
214 """Remove selected components from the signal.
215
216 Given the unmixing matrix, transform data, zero out components,
217 and inverse transform the data. This procedure will reconstruct
218 the signals from which the dynamics described by the excluded
219 components is subtracted.
220
221 Parameters
222 ----------
223 X : array, shape (n_epochs, n_components * n_classes, n_times)
224 The transformed data.
225
226 Returns
227 -------
228 X : array, shape (n_epochs, n_channels * n_classes, n_times)
229 The inverse transform data.
230 """
231 # Check size
232 X = self._check_data(X, check_n_features=False)
233 n_epochs, n_comp, n_times = X.shape
234 if n_comp != (self.n_components * len(self.classes_)):
235 raise ValueError(
236 f"X must have {self.n_components * len(self.classes_)} components, "
237 f"got {n_comp} instead."
238 )
239 pick_patterns = self._subset_multi_components(name="patterns")
240 # Transform
241 return np.dot(pick_patterns.T, X).transpose(1, 0, 2)
242
243
244@verbose

Callers 1

test_XdawnTransformerFunction · 0.95

Calls 2

_check_dataMethod · 0.45

Tested by 1

test_XdawnTransformerFunction · 0.76