Skip to content

Commit 3b4200f

Browse files
committed
prettify and spelling
1 parent a7c42e7 commit 3b4200f

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

tutorials/inverse/80_brainstorm_phantom_elekta.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
# Mark known bad channels
5555
raw.info["bads"] = ["MEG1933", "MEG2421"]
5656

57-
# The first 32 events correspond to dipole activations.
57+
# The first 32 events correspond to dipole activations
5858
events = find_events(raw, "STI201")
5959

6060

@@ -71,15 +71,16 @@
7171
raw, events, event_id, tmin, tmax, baseline=(None, bmax), preload=False
7272
)
7373

74-
# We drop the first and last event, it can contains dipole-switching artifacts
74+
# We drop the first and last event, it can contain dipole-switching artifacts
7575
epochs_clean = epochs[1:-1]
7676

7777
# We select the first simulated dipole for visualisation purposes
7878
epochs_firstdip = epochs_clean["1"]
7979

8080
# %%
81-
# Let's look at the evoked response for the first clean dipole
82-
# We can see that the phantom was set to produce 20 Hz sinusoidal bursts of current.
81+
# Let's look at the evoked response for the first clean dipole.
82+
#
83+
# We can see that the phantom was set to produce 20 Hz sinusoidal bursts of current
8384
# and the burst envelope repeats at approximately 3 Hz.
8485

8586
epochs_firstdip.average().plot(time_unit="s")
@@ -92,6 +93,7 @@
9293

9394
# Get the evoked signal of the first dipole
9495
evoked_tmp = epochs_firstdip.average()
96+
9597
# Calculate GFP
9698
gfp = np.std(evoked_tmp.data, axis=0)
9799

@@ -116,14 +118,12 @@
116118
evoked = mne.EvokedArray(np.array(evoked.data), evoked.info, tmin=0.0)
117119
evokeds.append(evoked)
118120
# %%
119-
# Next, we need to compute the noise covariance to capture the sensor noise structure.
120-
# We use the baseline window to estimate covariance.
121-
# You can explore the covariance tutorial for details: :ref:`tut-compute-covariance`.
121+
# Next, we need to compute the noise covariance in the baseline window
122+
# to capture the sensor noise structure (for details: :ref:`tut-compute-covariance`).
122123

123124
cov = mne.compute_covariance(epochs_clean, tmax=bmax)
124125
del epochs # delete to save memory
125126
# %%
126-
# %%
127127
# We use a :ref:`sphere head geometry model <eeg_sphere_model>`
128128
# because the Elekta phantom is designed to approximate a spherical
129129
# conductor with known dipole locations.
@@ -146,7 +146,7 @@
146146
# Evaluate goodness of fit
147147
# ------------------------
148148
# The dipole object stores the goodness of fit (GOF) for each dipole.
149-
# Some dipoles have lower GOF because...
149+
# Some dipoles have a low GOF (< 60 %).
150150
gof = [dip.gof[0] for dip in dip_all]
151151
colors = ["#E69F00" if val < 60 else "#0072B2" for val in gof]
152152
plt.bar(event_id, gof, color=colors)
@@ -157,9 +157,9 @@
157157
# %%
158158
# Dipoles with low goodness of fit
159159
# --------------------------------
160-
# Why do some dipoles have a low (<60) GOF?
161-
# Here we plot the dipole locations of the dipoles with low GOF.
162-
# The dipoles with low GOF are deep in the brain which might explain
160+
# Why do some dipoles have a low GOF?
161+
# Here we plot the dipole locations of the dipoles with low GOF
162+
# We can see that dipoles with low GOF are deep in the brain which might explain
163163
# the low GOF.
164164

165165
# Get indices of low GOF dipoles
@@ -174,6 +174,7 @@
174174
subject = "phantom_otaniemi"
175175
trans = mne.transforms.Transform("head", "mri", np.eye(4))
176176

177+
# Plot the position and the orientation of the dipoles with low GOF
177178
fig = mne.viz.plot_alignment(
178179
evoked.info,
179180
trans,
@@ -186,15 +187,14 @@
186187
subjects_dir=subjects_dir,
187188
)
188189

189-
# Plot the position and the orientation of the dipoles with low GOF
190190
fig = mne.viz.plot_dipole_locations(
191191
dipoles=low_dips, mode="arrow", subject=subject, color=(1.0, 0.2, 0.2), fig=fig
192192
)
193193
# %%
194194
# Compare estimated and true dipoles
195195
# ----------------------------------
196196
# The dipole fits closely match the true phantom data,
197-
# achieving sub-centimeter accuracy (mean position error 2.7mm).
197+
# achieving sub-centimeter accuracy (mean position error 2.4mm).
198198

199199
# We get the true dipole positions from the phantoms
200200
actual_pos, actual_ori = mne.dipole.get_phantom_dipoles()

0 commit comments

Comments
 (0)