|
145 | 145 | # %% |
146 | 146 | # We can see that GOF varies between 50 and more than 95 % |
147 | 147 | # variance explained for dipoles. |
148 | | -# %% |
| 148 | + |
149 | 149 | # Estimated vs true dipole locations |
150 | 150 | # ------------------------------- |
151 | 151 | # Finally, we compare the estimated to the true dipole locations. |
|
190 | 190 | # of the estimated and true dipoles. |
191 | 191 | actual_amp = np.ones(len(dip)) # fake amp, needed to create Dipole instance |
192 | 192 | actual_gof = np.ones(len(dip)) # fake goodness-of-fit (GOF) |
| 193 | +# setup dipole objects for true and estimated dipoles |
193 | 194 | dip_true = mne.Dipole(dip.times, actual_pos, actual_amp, actual_ori, actual_gof) |
| 195 | +dip_estimated = mne.Dipole(dip.times, dip_pos, dip_amplitude, dip_ori, actual_gof) |
194 | 196 |
|
195 | 197 | subject = "phantom_otaniemi" |
196 | 198 | trans = mne.transforms.Transform("head", "mri", np.eye(4)) |
|
210 | 212 | fig = mne.viz.plot_dipole_locations( |
211 | 213 | dipoles=dip_true, mode="arrow", subject=subject, color=(0.0, 0.0, 0.0), fig=fig |
212 | 214 | ) |
213 | | -for dip in dip_all: |
214 | | - # Plot the position and the orientation of the estimated dipole in green |
215 | | - fig = mne.viz.plot_dipole_locations( |
216 | | - dipoles=dip, mode="arrow", subject=subject, color=(0.2, 1.0, 0.5), fig=fig |
217 | | - ) |
| 215 | +# Plot the position and the orientation of the estimated dipole in green |
| 216 | +fig = mne.viz.plot_dipole_locations( |
| 217 | + dipoles=dip_estimated, mode="arrow", subject=subject, color=(0.2, 1.0, 0.5), fig=fig |
| 218 | +) |
218 | 219 | mne.viz.set_3d_view(figure=fig, azimuth=70, elevation=80, distance=0.5) |
219 | 220 | # %% |
220 | 221 | # We can see that the dipoles overlap, have approximately the same magnitude |
|
0 commit comments