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

Method transform

mne/decoding/csp.py:280–307  ·  view source on GitHub ↗

Estimate epochs sources given the CSP filters. Parameters ---------- X : array, shape (n_epochs, n_channels, n_times) The data. Returns ------- X : ndarray If self.transform_into == 'average_power' then returns the power of

(self, X)

Source from the content-addressed store, hash-verified

278 return self
279
280 def transform(self, X):
281 """Estimate epochs sources given the CSP filters.
282
283 Parameters
284 ----------
285 X : array, shape (n_epochs, n_channels, n_times)
286 The data.
287
288 Returns
289 -------
290 X : ndarray
291 If self.transform_into == 'average_power' then returns the power of
292 CSP features averaged over time and shape (n_epochs, n_components)
293 If self.transform_into == 'csp_space' then returns the data in CSP
294 space and shape is (n_epochs, n_components, n_times).
295 """
296 X = self._check_data(X)
297 X = super().transform(X)
298 # compute features (mean band power)
299 if self.transform_into == "average_power":
300 X = (X**2).mean(axis=2)
301 log = True if self.log is None else self.log
302 if log:
303 X = np.log(X)
304 else:
305 X -= self.mean_
306 X /= self.std_
307 return X
308
309 def inverse_transform(self, X):
310 """Project CSP features back to sensor space.

Callers 13

test_cspFunction · 0.95
test_regularized_cspFunction · 0.95
ems_filtering.pyFile · 0.45
_morph_volsMethod · 0.45
transformMethod · 0.45
test_resample_equivFunction · 0.45
test_transformFunction · 0.45
test_tpsFunction · 0.45
_click_overrideMethod · 0.45

Calls 2

_check_dataMethod · 0.45
meanMethod · 0.45

Tested by 6

test_cspFunction · 0.76
test_regularized_cspFunction · 0.76
test_resample_equivFunction · 0.36
test_transformFunction · 0.36
test_tpsFunction · 0.36
_get_button_xyFunction · 0.36