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

Function compute_bias

examples/preprocessing/otp.py:56–78  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

54
55
56def compute_bias(raw):
57 events = find_events(raw, "STI201", verbose=False)
58 events = events[1:] # first one has an artifact
59 tmin, tmax = -0.2, 0.1
60 epochs = mne.Epochs(
61 raw,
62 events,
63 dipole_number,
64 tmin,
65 tmax,
66 baseline=(None, -0.01),
67 preload=True,
68 verbose=False,
69 )
70 sphere = mne.make_sphere_model(r0=(0.0, 0.0, 0.0), head_radius=None, verbose=False)
71 cov = mne.compute_covariance(epochs, tmax=0, method="oas", rank=None, verbose=False)
72 idx = epochs.time_as_index(0.036)[0]
73 data = epochs.get_data(copy=False)[:, :, idx].T
74 evoked = mne.EvokedArray(data, epochs.info, tmin=0.0)
75 dip = fit_dipole(evoked, cov, sphere, verbose=False)[0]
76 actual_pos = mne.dipole.get_phantom_dipoles()[0][dipole_number - 1]
77 misses = 1000 * np.linalg.norm(dip.pos - actual_pos, axis=-1)
78 return misses
79
80
81bias = compute_bias(raw)

Callers 1

otp.pyFile · 0.70

Calls 5

find_eventsFunction · 0.90
fit_dipoleFunction · 0.90
normMethod · 0.80
time_as_indexMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected