Note
Click here to download the full example code
Extracting and visualizing subject head movement¶
Continuous head movement can be encoded during MEG recordings by use of HPI coils that continuously emit sinusoidal signals. These signals can then be extracted from the recording and used to estimate head position as a function of time. Here we show an example of how to do this, and how to visualize the result.
HPI frequencies¶
First let’s load a short bit of raw data where the subject intentionally moved their head during the recording. Its power spectral density shows five peaks (most clearly visible in the gradiometers) corresponding to the HPI coil frequencies, plus other peaks related to power line interference (60 Hz and harmonics).
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
from os import path as op
import mne
print(__doc__)
data_path = op.join(mne.datasets.testing.data_path(verbose=True), 'SSS')
fname_raw = op.join(data_path, 'test_move_anon_raw.fif')
raw = mne.io.read_raw_fif(fname_raw, allow_maxshield='yes').load_data()
raw.plot_psd()
Out:
Opening raw data file /home/circleci/mne_data/MNE-testing-data/SSS/test_move_anon_raw.fif...
Read a total of 12 projection items:
mag.fif : PCA-v1 (1 x 306) idle
mag.fif : PCA-v2 (1 x 306) idle
mag.fif : PCA-v3 (1 x 306) idle
mag.fif : PCA-v4 (1 x 306) idle
mag.fif : PCA-v5 (1 x 306) idle
mag.fif : PCA-v6 (1 x 306) idle
mag.fif : PCA-v7 (1 x 306) idle
grad.fif : PCA-v1 (1 x 306) idle
grad.fif : PCA-v2 (1 x 306) idle
grad.fif : PCA-v3 (1 x 306) idle
grad.fif : PCA-v4 (1 x 306) idle
Average EEG reference (1 x 60) idle
Range : 10800 ... 31199 = 9.000 ... 25.999 secs
Ready.
Reading 0 ... 20399 = 0.000 ... 16.999 secs...
Effective window size : 1.707 (s)
Effective window size : 1.707 (s)
Effective window size : 1.707 (s)
Estimating continuous head position¶
First, let’s extract the HPI coil amplitudes as a function of time:
Out:
Using 5 HPI coils: 83 143 203 263 323 Hz
Line interference frequencies: 60 120 180 240 300 360 Hz
Using time window: 83.3 ms
Fitting 5 HPI coil locations at up to 1696 time points (17.0 sec duration)
0%| | cHPI amplitudes : 0/1696 [00:00<?, ?it/s]
1%|1 | cHPI amplitudes : 23/1696 [00:00<00:01, 1386.15it/s]
3%|2 | cHPI amplitudes : 47/1696 [00:00<00:01, 1390.92it/s]
4%|4 | cHPI amplitudes : 71/1696 [00:00<00:01, 1394.11it/s]
6%|5 | cHPI amplitudes : 95/1696 [00:00<00:01, 1398.26it/s]
7%|7 | cHPI amplitudes : 119/1696 [00:00<00:01, 1402.90it/s]
8%|8 | cHPI amplitudes : 143/1696 [00:00<00:01, 1407.13it/s]
10%|9 | cHPI amplitudes : 167/1696 [00:00<00:01, 1410.30it/s]
11%|#1 | cHPI amplitudes : 191/1696 [00:00<00:01, 1413.98it/s]
13%|#2 | cHPI amplitudes : 215/1696 [00:00<00:01, 1417.35it/s]
14%|#4 | cHPI amplitudes : 239/1696 [00:00<00:01, 1419.01it/s]
16%|#5 | cHPI amplitudes : 264/1696 [00:00<00:01, 1422.84it/s]
17%|#6 | cHPI amplitudes : 288/1696 [00:00<00:00, 1426.05it/s]
18%|#8 | cHPI amplitudes : 312/1696 [00:00<00:00, 1428.62it/s]
20%|#9 | cHPI amplitudes : 336/1696 [00:00<00:00, 1431.25it/s]
21%|##1 | cHPI amplitudes : 360/1696 [00:00<00:00, 1433.84it/s]
23%|##2 | cHPI amplitudes : 384/1696 [00:00<00:00, 1436.76it/s]
24%|##4 | cHPI amplitudes : 408/1696 [00:00<00:00, 1437.64it/s]
25%|##5 | cHPI amplitudes : 432/1696 [00:00<00:00, 1440.35it/s]
27%|##6 | cHPI amplitudes : 456/1696 [00:00<00:00, 1442.04it/s]
28%|##8 | cHPI amplitudes : 480/1696 [00:00<00:00, 1444.25it/s]
30%|##9 | cHPI amplitudes : 505/1696 [00:00<00:00, 1447.03it/s]
31%|###1 | cHPI amplitudes : 529/1696 [00:00<00:00, 1448.72it/s]
33%|###2 | cHPI amplitudes : 553/1696 [00:00<00:00, 1450.64it/s]
34%|###4 | cHPI amplitudes : 577/1696 [00:00<00:00, 1450.87it/s]
35%|###5 | cHPI amplitudes : 601/1696 [00:00<00:00, 1451.96it/s]
37%|###6 | cHPI amplitudes : 625/1696 [00:00<00:00, 1453.87it/s]
38%|###8 | cHPI amplitudes : 649/1696 [00:00<00:00, 1455.62it/s]
40%|###9 | cHPI amplitudes : 673/1696 [00:00<00:00, 1457.56it/s]
41%|####1 | cHPI amplitudes : 697/1696 [00:00<00:00, 1459.49it/s]
43%|####2 | cHPI amplitudes : 721/1696 [00:00<00:00, 1461.43it/s]
44%|####3 | cHPI amplitudes : 745/1696 [00:00<00:00, 1462.58it/s]
45%|####5 | cHPI amplitudes : 768/1696 [00:00<00:00, 1461.15it/s]
47%|####6 | cHPI amplitudes : 792/1696 [00:00<00:00, 1462.80it/s]
48%|####8 | cHPI amplitudes : 816/1696 [00:00<00:00, 1464.37it/s]
50%|####9 | cHPI amplitudes : 841/1696 [00:00<00:00, 1466.02it/s]
51%|#####1 | cHPI amplitudes : 865/1696 [00:00<00:00, 1467.42it/s]
52%|#####2 | cHPI amplitudes : 889/1696 [00:00<00:00, 1468.42it/s]
54%|#####3 | cHPI amplitudes : 913/1696 [00:00<00:00, 1468.61it/s]
55%|#####5 | cHPI amplitudes : 936/1696 [00:00<00:00, 1466.67it/s]
57%|#####6 | cHPI amplitudes : 959/1696 [00:00<00:00, 1464.36it/s]
58%|#####7 | cHPI amplitudes : 982/1696 [00:00<00:00, 1461.77it/s]
59%|#####9 | cHPI amplitudes : 1005/1696 [00:00<00:00, 1459.09it/s]
61%|###### | cHPI amplitudes : 1028/1696 [00:00<00:00, 1456.48it/s]
62%|######1 | cHPI amplitudes : 1051/1696 [00:00<00:00, 1453.79it/s]
63%|######3 | cHPI amplitudes : 1074/1696 [00:00<00:00, 1451.96it/s]
65%|######4 | cHPI amplitudes : 1097/1696 [00:00<00:00, 1448.64it/s]
66%|######6 | cHPI amplitudes : 1122/1696 [00:00<00:00, 1451.24it/s]
68%|######7 | cHPI amplitudes : 1146/1696 [00:00<00:00, 1453.13it/s]
69%|######8 | cHPI amplitudes : 1170/1696 [00:00<00:00, 1455.06it/s]
70%|####### | cHPI amplitudes : 1194/1696 [00:00<00:00, 1456.62it/s]
72%|#######1 | cHPI amplitudes : 1219/1696 [00:00<00:00, 1459.16it/s]
73%|#######3 | cHPI amplitudes : 1243/1696 [00:00<00:00, 1461.10it/s]
75%|#######4 | cHPI amplitudes : 1267/1696 [00:00<00:00, 1460.71it/s]
76%|#######6 | cHPI amplitudes : 1292/1696 [00:00<00:00, 1463.28it/s]
78%|#######7 | cHPI amplitudes : 1317/1696 [00:00<00:00, 1465.35it/s]
79%|#######9 | cHPI amplitudes : 1341/1696 [00:00<00:00, 1465.67it/s]
80%|######## | cHPI amplitudes : 1365/1696 [00:00<00:00, 1466.32it/s]
82%|########1 | cHPI amplitudes : 1389/1696 [00:00<00:00, 1467.89it/s]
83%|########3 | cHPI amplitudes : 1414/1696 [00:00<00:00, 1469.42it/s]
85%|########4 | cHPI amplitudes : 1438/1696 [00:00<00:00, 1468.15it/s]
86%|########6 | cHPI amplitudes : 1462/1696 [00:00<00:00, 1469.10it/s]
88%|########7 | cHPI amplitudes : 1486/1696 [00:01<00:00, 1470.04it/s]
89%|########9 | cHPI amplitudes : 1510/1696 [00:01<00:00, 1471.48it/s]
91%|######### | cHPI amplitudes : 1535/1696 [00:01<00:00, 1473.19it/s]
92%|#########1| cHPI amplitudes : 1559/1696 [00:01<00:00, 1474.04it/s]
93%|#########3| cHPI amplitudes : 1583/1696 [00:01<00:00, 1474.52it/s]
95%|#########4| cHPI amplitudes : 1607/1696 [00:01<00:00, 1475.56it/s]
96%|#########6| cHPI amplitudes : 1631/1696 [00:01<00:00, 1476.28it/s]
98%|#########7| cHPI amplitudes : 1656/1696 [00:01<00:00, 1477.51it/s]
99%|#########9| cHPI amplitudes : 1680/1696 [00:01<00:00, 1478.13it/s]
100%|##########| cHPI amplitudes : 1696/1696 [00:01<00:00, 1473.78it/s]
Second, let’s compute time-varying HPI coil locations from these:
Out:
Computing 4385 HPI location guesses (1 cm grid in a 10.7 cm sphere)
HPIFIT: 5 coils digitized in order 5 1 4 3 2
HPI consistency of isotrak and hpifit is OK.
0%| | cHPI locations : 0/1696 [00:00<?, ?it/s]
0%| | cHPI locations : 1/1696 [00:00<01:55, 14.70it/s]
3%|2 | cHPI locations : 43/1696 [00:00<01:46, 15.47it/s]
5%|5 | cHPI locations : 87/1696 [00:00<01:38, 16.27it/s]
6%|5 | cHPI locations : 101/1696 [00:00<01:33, 17.07it/s]
8%|8 | cHPI locations : 144/1696 [00:00<01:26, 17.96it/s]
11%|#1 | cHPI locations : 188/1696 [00:00<01:19, 18.90it/s]
12%|#1 | cHPI locations : 201/1696 [00:00<01:15, 19.81it/s]
14%|#4 | cHPI locations : 245/1696 [00:00<01:09, 20.85it/s]
17%|#7 | cHPI locations : 289/1696 [00:00<01:04, 21.93it/s]
18%|#7 | cHPI locations : 301/1696 [00:00<01:00, 22.97it/s]
20%|## | cHPI locations : 345/1696 [00:00<00:55, 24.17it/s]
23%|##2 | cHPI locations : 389/1696 [00:00<00:51, 25.43it/s]
24%|##3 | cHPI locations : 401/1696 [00:00<00:48, 26.61it/s]
26%|##6 | cHPI locations : 445/1696 [00:00<00:44, 28.00it/s]
29%|##8 | cHPI locations : 490/1696 [00:00<00:40, 29.46it/s]
30%|##9 | cHPI locations : 501/1696 [00:00<00:38, 30.76it/s]
32%|###2 | cHPI locations : 544/1696 [00:00<00:35, 32.36it/s]
33%|###2 | cHPI locations : 559/1696 [00:00<00:33, 33.79it/s]
33%|###3 | cHPI locations : 568/1696 [00:00<00:32, 35.06it/s]
34%|###3 | cHPI locations : 573/1696 [00:00<00:31, 35.95it/s]
34%|###4 | cHPI locations : 577/1696 [00:00<00:30, 36.72it/s]
34%|###4 | cHPI locations : 581/1696 [00:00<00:29, 37.41it/s]
35%|###4 | cHPI locations : 587/1696 [00:00<00:28, 38.49it/s]
35%|###5 | cHPI locations : 600/1696 [00:01<00:27, 40.05it/s]
38%|###7 | cHPI locations : 643/1696 [00:01<00:25, 42.12it/s]
41%|#### | cHPI locations : 687/1696 [00:01<00:22, 44.30it/s]
41%|####1 | cHPI locations : 700/1696 [00:01<00:21, 46.07it/s]
44%|####3 | cHPI locations : 743/1696 [00:01<00:19, 48.45it/s]
46%|####6 | cHPI locations : 787/1696 [00:01<00:17, 50.95it/s]
47%|####6 | cHPI locations : 789/1696 [00:01<00:18, 49.27it/s]
47%|####6 | cHPI locations : 794/1696 [00:01<00:17, 50.13it/s]
47%|####7 | cHPI locations : 800/1696 [00:01<00:17, 51.29it/s]
47%|####7 | cHPI locations : 805/1696 [00:01<00:17, 52.03it/s]
48%|####7 | cHPI locations : 810/1696 [00:01<00:16, 52.68it/s]
48%|####8 | cHPI locations : 815/1696 [00:01<00:16, 53.33it/s]
48%|####8 | cHPI locations : 819/1696 [00:01<00:16, 53.57it/s]
49%|####8 | cHPI locations : 823/1696 [00:01<00:16, 53.75it/s]
49%|####8 | cHPI locations : 827/1696 [00:01<00:16, 53.90it/s]
49%|####9 | cHPI locations : 833/1696 [00:01<00:15, 54.86it/s]
50%|##### | cHPI locations : 848/1696 [00:01<00:14, 56.94it/s]
53%|#####2 | cHPI locations : 891/1696 [00:01<00:13, 59.87it/s]
55%|#####5 | cHPI locations : 935/1696 [00:01<00:12, 62.94it/s]
56%|#####5 | cHPI locations : 948/1696 [00:02<00:11, 65.08it/s]
58%|#####8 | cHPI locations : 991/1696 [00:02<00:10, 68.42it/s]
61%|######1 | cHPI locations : 1035/1696 [00:02<00:09, 71.92it/s]
61%|######1 | cHPI locations : 1040/1696 [00:02<00:09, 72.04it/s]
62%|######1 | cHPI locations : 1051/1696 [00:02<00:08, 74.10it/s]
63%|######2 | cHPI locations : 1062/1696 [00:02<00:08, 76.09it/s]
63%|######3 | cHPI locations : 1072/1696 [00:02<00:08, 77.99it/s]
64%|######4 | cHPI locations : 1086/1696 [00:02<00:07, 80.44it/s]
67%|######6 | cHPI locations : 1129/1696 [00:02<00:06, 84.54it/s]
69%|######9 | cHPI locations : 1173/1696 [00:02<00:05, 88.84it/s]
70%|######9 | cHPI locations : 1186/1696 [00:02<00:05, 91.21it/s]
72%|#######2 | cHPI locations : 1229/1696 [00:02<00:04, 95.84it/s]
75%|#######5 | cHPI locations : 1273/1696 [00:02<00:04, 100.69it/s]
76%|#######5 | cHPI locations : 1286/1696 [00:02<00:03, 103.23it/s]
76%|#######6 | cHPI locations : 1296/1696 [00:02<00:03, 104.71it/s]
77%|#######6 | cHPI locations : 1301/1696 [00:02<00:03, 102.64it/s]
77%|#######7 | cHPI locations : 1306/1696 [00:02<00:03, 100.51it/s]
77%|#######7 | cHPI locations : 1311/1696 [00:02<00:03, 98.51it/s]
78%|#######7 | cHPI locations : 1315/1696 [00:02<00:04, 95.12it/s]
78%|#######7 | cHPI locations : 1319/1696 [00:03<00:04, 92.51it/s]
78%|#######8 | cHPI locations : 1325/1696 [00:03<00:04, 92.13it/s]
78%|#######8 | cHPI locations : 1331/1696 [00:03<00:03, 92.36it/s]
79%|#######9 | cHPI locations : 1341/1696 [00:03<00:03, 93.93it/s]
82%|########1 | cHPI locations : 1384/1696 [00:03<00:03, 98.69it/s]
84%|########4 | cHPI locations : 1428/1696 [00:03<00:02, 103.69it/s]
85%|########4 | cHPI locations : 1441/1696 [00:03<00:02, 106.19it/s]
88%|########7 | cHPI locations : 1484/1696 [00:03<00:01, 111.55it/s]
90%|######### | cHPI locations : 1528/1696 [00:03<00:01, 117.16it/s]
91%|######### | cHPI locations : 1541/1696 [00:03<00:01, 119.40it/s]
92%|#########2| cHPI locations : 1565/1696 [00:03<00:01, 123.02it/s]
93%|#########2| cHPI locations : 1573/1696 [00:03<00:01, 121.97it/s]
93%|#########3| cHPI locations : 1580/1696 [00:03<00:00, 120.98it/s]
94%|#########3| cHPI locations : 1586/1696 [00:03<00:00, 118.66it/s]
94%|#########3| cHPI locations : 1590/1696 [00:03<00:00, 111.35it/s]
94%|#########3| cHPI locations : 1594/1696 [00:03<00:00, 106.05it/s]
94%|#########4| cHPI locations : 1599/1696 [00:03<00:00, 103.07it/s]
95%|#########4| cHPI locations : 1609/1696 [00:03<00:00, 104.78it/s]
97%|#########7| cHPI locations : 1652/1696 [00:04<00:00, 109.10it/s]
100%|#########9| cHPI locations : 1695/1696 [00:04<00:00, 114.59it/s]
100%|##########| cHPI locations : 1696/1696 [00:04<00:00, 413.56it/s]
Lastly, compute head positions from the coil locations:
head_pos = mne.chpi.compute_head_pos(raw.info, chpi_locs, verbose=True)
Out:
t=9.000: 5/5 good HPI fits, movements [mm/s] = 0.1 / 0.2 / 0.5 / 0.2 / 0.3
t=10.000: 5/5 good HPI fits, movements [mm/s] = 0.1 / 0.2 / 0.0 / 0.1 / 0.1
t=11.000: 5/5 good HPI fits, movements [mm/s] = 0.0 / 0.1 / 0.1 / 0.0 / 0.1
t=12.000: 5/5 good HPI fits, movements [mm/s] = 0.0 / 0.0 / 0.0 / 0.0 / 0.0
t=13.000: 5/5 good HPI fits, movements [mm/s] = 0.0 / 0.1 / 0.0 / 0.0 / 0.0
t=14.000: 5/5 good HPI fits, movements [mm/s] = 0.1 / 0.1 / 0.1 / 0.1 / 0.1
t=14.580: 5/5 good HPI fits, movements [mm/s] = 5.0 / 4.8 / 6.1 / 5.5 / 4.8
t=14.670: 5/5 good HPI fits, movements [mm/s] = 33.1 / 34.4 / 39.8 / 38.1 / 30.5
t=14.720: 5/5 good HPI fits, movements [mm/s] = 49.5 / 46.9 / 60.7 / 59.2 / 44.4
t=14.760: 5/5 good HPI fits, movements [mm/s] = 65.1 / 63.7 / 73.0 / 71.1 / 56.3
t=14.800: 5/5 good HPI fits, movements [mm/s] = 67.0 / 58.9 / 82.8 / 77.7 / 61.2
t=14.860: 5/5 good HPI fits, movements [mm/s] = 54.2 / 52.2 / 57.6 / 62.2 / 47.0
t=14.990: 5/5 good HPI fits, movements [mm/s] = 23.4 / 22.5 / 24.0 / 27.1 / 19.9
t=15.990: 5/5 good HPI fits, movements [mm/s] = 0.7 / 0.9 / 0.8 / 0.8 / 0.9
t=16.880: 5/5 good HPI fits, movements [mm/s] = 2.5 / 3.4 / 3.0 / 3.8 / 3.3
t=16.930: 5/5 good HPI fits, movements [mm/s] = 52.9 / 55.4 / 58.1 / 67.3 / 59.5
t=16.990: 5/5 good HPI fits, movements [mm/s] = 56.7 / 54.0 / 62.0 / 64.8 / 57.5
t=17.040: 5/5 good HPI fits, movements [mm/s] = 53.4 / 49.9 / 60.0 / 61.8 / 49.4
t=17.090: 5/5 good HPI fits, movements [mm/s] = 57.8 / 50.2 / 66.7 / 64.9 / 51.5
t=17.140: 5/5 good HPI fits, movements [mm/s] = 60.6 / 53.9 / 72.8 / 67.3 / 57.7
t=17.180: 5/5 good HPI fits, movements [mm/s] = 63.3 / 59.6 / 74.6 / 72.4 / 61.5
t=17.220: 5/5 good HPI fits, movements [mm/s] = 61.0 / 58.8 / 74.7 / 71.6 / 63.7
t=17.260: 5/5 good HPI fits, movements [mm/s] = 67.9 / 65.7 / 73.7 / 68.3 / 69.1
t=17.320: 5/5 good HPI fits, movements [mm/s] = 49.5 / 51.4 / 54.7 / 55.1 / 52.3
t=17.470: 5/5 good HPI fits, movements [mm/s] = 18.5 / 21.3 / 19.3 / 20.5 / 17.4
t=18.470: 5/5 good HPI fits, movements [mm/s] = 1.9 / 2.7 / 2.0 / 2.4 / 1.9
t=19.390: 5/5 good HPI fits, movements [mm/s] = 2.5 / 2.7 / 1.9 / 2.9 / 2.5
t=19.500: 5/5 good HPI fits, movements [mm/s] = 22.9 / 25.0 / 19.3 / 28.8 / 27.6
t=19.610: 5/5 good HPI fits, movements [mm/s] = 21.4 / 25.7 / 21.8 / 31.8 / 31.5
t=19.710: 5/5 good HPI fits, movements [mm/s] = 21.5 / 20.7 / 23.2 / 29.7 / 27.6
t=19.850: 5/5 good HPI fits, movements [mm/s] = 16.6 / 14.8 / 18.6 / 21.8 / 20.1
t=20.850: 5/5 good HPI fits, movements [mm/s] = 2.3 / 1.9 / 2.0 / 2.5 / 2.2
t=21.850: 5/5 good HPI fits, movements [mm/s] = 0.6 / 1.7 / 1.7 / 2.0 / 1.9
t=21.950: 5/5 good HPI fits, movements [mm/s] = 25.8 / 27.1 / 24.1 / 32.0 / 26.4
t=22.000: 5/5 good HPI fits, movements [mm/s] = 66.1 / 59.1 / 46.3 / 64.9 / 52.1
t=22.050: 5/5 good HPI fits, movements [mm/s] = 60.0 / 62.1 / 51.3 / 69.2 / 57.8
t=22.100: 5/5 good HPI fits, movements [mm/s] = 61.0 / 65.5 / 58.5 / 75.0 / 64.4
t=22.140: 5/5 good HPI fits, movements [mm/s] = 74.7 / 73.9 / 62.3 / 80.0 / 68.1
t=22.180: 5/5 good HPI fits, movements [mm/s] = 63.6 / 59.7 / 53.0 / 67.6 / 53.7
t=22.240: 5/5 good HPI fits, movements [mm/s] = 38.8 / 39.5 / 36.7 / 47.8 / 42.1
t=22.300: 5/5 good HPI fits, movements [mm/s] = 41.9 / 39.9 / 33.5 / 47.5 / 39.3
t=22.400: 5/5 good HPI fits, movements [mm/s] = 31.7 / 28.5 / 22.2 / 30.8 / 24.9
t=23.400: 5/5 good HPI fits, movements [mm/s] = 1.8 / 1.8 / 1.0 / 1.5 / 1.2
t=24.400: 5/5 good HPI fits, movements [mm/s] = 1.3 / 0.8 / 0.7 / 0.8 / 0.7
t=24.640: 5/5 good HPI fits, movements [mm/s] = 12.6 / 11.5 / 11.5 / 13.1 / 10.9
t=24.720: 5/5 good HPI fits, movements [mm/s] = 30.3 / 33.0 / 31.5 / 38.8 / 35.4
t=24.790: 5/5 good HPI fits, movements [mm/s] = 31.0 / 36.0 / 33.3 / 43.1 / 41.0
t=24.850: 5/5 good HPI fits, movements [mm/s] = 37.7 / 41.1 / 35.6 / 44.9 / 42.1
t=24.890: 5/5 good HPI fits, movements [mm/s] = 50.2 / 51.6 / 49.2 / 59.9 / 52.8
t=24.930: 5/5 good HPI fits, movements [mm/s] = 55.8 / 54.7 / 59.5 / 68.5 / 62.1
t=24.980: 5/5 good HPI fits, movements [mm/s] = 47.3 / 47.7 / 51.1 / 58.4 / 53.8
t=25.080: 5/5 good HPI fits, movements [mm/s] = 23.8 / 19.2 / 23.2 / 28.2 / 26.2
t=25.510: 5/5 good HPI fits, movements [mm/s] = 2.4 / 6.5 / 7.4 / 6.5 / 7.8
Note that these can then be written to disk or read from disk with
mne.chpi.write_head_pos()
and mne.chpi.read_head_pos()
,
respectively.
Visualizing continuous head position¶
We can plot as traces, which is especially useful for long recordings:
mne.viz.plot_head_positions(head_pos, mode='traces')
Or we can visualize them as a continuous field (with the vectors pointing in the head-upward direction):
mne.viz.plot_head_positions(head_pos, mode='field')
These head positions can then be used with
mne.preprocessing.maxwell_filter()
to compensate for movement,
or with mne.preprocessing.annotate_movement()
to mark segments as
bad that deviate too much from the average head position.
Total running time of the script: ( 0 minutes 12.325 seconds)
Estimated memory usage: 69 MB