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

Function _compute_csd

mne/preprocessing/_csd.py:38–51  ·  view source on GitHub ↗

Compute the CSD.

(G_precomputed, H, radius)

Source from the content-addressed store, hash-verified

36
37
38def _compute_csd(G_precomputed, H, radius):
39 """Compute the CSD."""
40 n_channels = H.shape[0]
41 data = np.eye(n_channels)
42 mu = data.mean(0)
43 Z = data - mu
44
45 Gi, TC, sgi = G_precomputed
46
47 Cp2 = np.dot(Gi, Z)
48 c02 = np.sum(Cp2, axis=0) / sgi
49 C2 = Cp2 - np.dot(TC[:, np.newaxis], c02[np.newaxis, :])
50 X = np.dot(C2.T, H).T / radius**2
51 return X
52
53
54@verbose

Callers 1

Calls 2

meanMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected