.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/tutorials/megin/30_cHPI.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_tutorials_megin_30_cHPI.py: .. _tut-cHPI: Correct head movements with cHPI ================================ .. include:: ../../../links.inc .. important:: This example requires the ``meg_wiki`` package to download the sample dataset. This package can be installed with ``pip``: .. code-block:: bash $ pip install git+https://github.com/fcbg-platforms/meg-wiki :ref:`Signal-Space Separation (SSS) and Maxwell filter `\ :footcite:p:`sss_2005,tsss_2006` can be used to compensate for head movements during a recording. To run SSS, you can use either MEGIN's software on the :ref:`DANA ` or `MNE-Python `_'s implementation. .. tip:: The enhanced version available in `MNE-Python `_ is recommended. See :func:`mne.preprocessing.maxwell_filter`. The fine calibration file and the cross-talk correction are available in the `sample dataset`_ ( see :func:`meg_wiki.datasets.sample.data_path`). .. GENERATED FROM PYTHON SOURCE LINES 31-48 .. code-block:: Python from pathlib import Path from matplotlib import pyplot as plt from mne.chpi import ( compute_chpi_amplitudes, compute_chpi_locs, compute_head_pos, filter_chpi, ) from mne.datasets import fetch_fsaverage from mne.io import read_raw_fif from mne.preprocessing import maxwell_filter from mne.viz import plot_alignment, plot_head_positions, set_3d_view from meg_wiki.datasets import sample .. GENERATED FROM PYTHON SOURCE LINES 49-62 Head Position Indicator (HPI) ----------------------------- :ref:`Head Position Indication (HPI) ` is a technique to measure the head position with respect to the MEG sensors. 5 coils are placed on the participant head and digitized (see this :ref:`section about digitization `) in the head coordinate frame. At the beginning of a recording, an electromagnetic pulse is delivered on the 5 coils at 5 unique frequencies. The coil position with respect to the MEG sensors is estimated by measuring the magnetic field produced by this pulse on the MEG sensors. The initial HPI measurement is used to determine the device to head affine transformation matrix stored in ``raw.info["dev_head_t"]``. .. GENERATED FROM PYTHON SOURCE LINES 62-68 .. code-block:: Python raw = read_raw_fif( sample.data_path() / "recordings" / "sample-chpi-raw.fif", preload=True ) raw.info["dev_head_t"] .. rst-class:: sphx-glr-script-out .. code-block:: none head> [[ 0.99706715 -0.0762954 0.00600351 0.00164202] [ 0.07619333 0.99696928 0.01570909 -0.00272158] [-0.00718385 -0.01520559 0.99985856 0.03805892] [ 0. 0. 0. 1. ]] .. GENERATED FROM PYTHON SOURCE LINES 69-77 The initial head position can be visualized within the sensor helmet with :func:`mne.viz.plot_alignment`. .. note:: The figure below uses fsaverage MRI from `MNE-Python `_'s dataset, which does not correspond to the subject in the ``raw`` recording. In practice, the subject's individual MRI should be used. .. GENERATED FROM PYTHON SOURCE LINES 77-91 .. code-block:: Python subjects_dir = Path(fetch_fsaverage()).parent fig = plot_alignment( raw.info, trans="fsaverage", subject="fsaverage", subjects_dir=subjects_dir, surfaces="head-dense", meg=("helmet", "sensors"), dig="fiducials", show_axes=True, ) set_3d_view(fig, 35, 70, distance=0.6, focalpoint=(0.0, 0.0, 0.0)) .. image-sg:: /generated/tutorials/megin/images/sphx_glr_30_cHPI_001.png :alt: 30 cHPI :srcset: /generated/tutorials/megin/images/sphx_glr_30_cHPI_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 92-104 continuous Head Position Indicator (cHPI) ----------------------------------------- If the recording is short, if the participant behaves and is focused on the task, one can assume that the head remained still during the recording. In this case, the initial device to head transformation estimated during the HPI measurement can be assumed to be constant. cHPI is a technique to continuously monitor the head position during the recording, useful when the previous assumption does not hold. When cHPI is enabled, the 5 HPI coils are continuously excited at 5 unique frequencies. The magnetic field produced by the coils is measured by the MEG sensors alongside brain activity. .. GENERATED FROM PYTHON SOURCE LINES 104-119 .. code-block:: Python fig = raw.plot( duration=4, n_channels=10, scalings=dict(grad=4e-10), show_scrollbars=False, show_scalebars=False, ) fig.axes[0].axvline(1.492, color="darkgreen", linestyle="--") fig.axes[0].text( 1.492 - 0.992, fig.axes[0].get_ylim()[0] * 0.05, "cHPI OFF", fontsize=18 ) fig.axes[0].text(1.492 + 1.1, fig.axes[0].get_ylim()[0] * 0.05, "cHPI ON", fontsize=18) plt.show() .. image-sg:: /generated/tutorials/megin/images/sphx_glr_30_cHPI_002.png :alt: 30 cHPI :srcset: /generated/tutorials/megin/images/sphx_glr_30_cHPI_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 120-124 .. code-block:: Python raw.compute_psd(fmin=280, fmax=340).plot() plt.show() .. image-sg:: /generated/tutorials/megin/images/sphx_glr_30_cHPI_003.png :alt: Gradiometers, Magnetometers :srcset: /generated/tutorials/megin/images/sphx_glr_30_cHPI_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 125-128 The signal produced by the HPI coils can be used to estimate the position of the 5 emitting coils at different time points, and thus to track the time-varying head position. .. GENERATED FROM PYTHON SOURCE LINES 130-145 Estimating the head position ---------------------------- In `MNE-Python `_, the head position is estimated through 3 steps: - Estimate the cHPI amplitudes with :func:`mne.chpi.compute_chpi_amplitudes` - Estimate the cHPI positions with :func:`mne.chpi.compute_chpi_locs` - Estimate the head position with :func:`mne.chpi.compute_head_pos` .. note:: The function :func:`mne.chpi.compute_head_pos` returns an array of shape ``(n_pos, 10)`` containing the translations as ``(x, y, z)`` and the rotations as quaternions ``(q1, q2, q3)``. The translations and rotations can be converted to translation and rotation matrixes with :func:`mne.chpi.head_pos_to_trans_rot_t`. .. GENERATED FROM PYTHON SOURCE LINES 145-150 .. code-block:: Python chpi_amplitudes = compute_chpi_amplitudes(raw) chpi_locs = compute_chpi_locs(raw.info, chpi_amplitudes) head_pos = compute_head_pos(raw.info, chpi_locs) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.000: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.06, 0.06, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.010: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.08, 0.06, 0.07, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.020: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.08, 0.08, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.030: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.08, 0.08, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.040: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.06, 0.08, 0.07, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.050: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.06, 0.08, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.060: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.06, 0.07, 0.08, 0.05 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.070: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.05, 0.09, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.080: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.07, 0.10, 0.09, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.090: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.08, 0.07, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.100: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.08, 0.08, 0.05, 0.05 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.110: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.06, 0.09, 0.07, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.120: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.07, 0.11, 0.08, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.130: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.06, 0.11, 0.06, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.140: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.07, 0.10, 0.06, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.150: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.08, 0.11, 0.06, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.160: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.08, 0.11, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.170: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.07, 0.07, 0.08, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.180: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.06, 0.07, 0.06, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.190: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.07, 0.06, 0.07, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.200: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.07, 0.05, 0.07, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.210: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.06, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.220: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.08, 0.07, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.230: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.12, 0.08, 0.07, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.240: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.10, 0.11, 0.07, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.250: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.11, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.260: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.08, 0.14, 0.10, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.270: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.08, 0.11, 0.12, 0.05 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.280: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.07, 0.10, 0.10, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.290: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.07, 0.11, 0.09, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.300: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.07, 0.10, 0.08, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.310: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.06, 0.13, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.320: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.06, 0.15, 0.09, 0.05 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.330: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.06, 0.14, 0.10, 0.05 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.340: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.07, 0.10, 0.09, 0.14 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.350: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.07, 0.06, 0.06, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.360: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.08, 0.07, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.370: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.08, 0.07, 0.05, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.380: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.08, 0.05, 0.08, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.390: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.08, 0.07, 0.08, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.400: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.08, 0.07, 0.10, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.410: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.08, 0.06, 0.07, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.420: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.12, 0.06, 0.06, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.430: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.09, 0.10, 0.11, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.440: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.07, 0.10, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.450: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.08, 0.07, 0.09, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.460: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.07, 0.10, 0.09, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.470: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.07, 0.12, 0.11, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.480: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.07, 0.07, 0.08, 0.14 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.490: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.08, 0.08, 0.13 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.500: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.09, 0.06, 0.10, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.510: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.08, 0.08, 0.08, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.520: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.07, 0.05, 0.07, 0.12 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.530: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.06, 0.07, 0.12 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.540: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.09, 0.06, 0.08, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.550: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.07, 0.08, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.560: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.07, 0.09, 0.07, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.570: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.08, 0.13, 0.07, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.580: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.12, 0.07, 0.13 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.590: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.07, 0.10, 0.07, 0.13 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.600: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.06, 0.08, 0.07, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.610: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.07, 0.09, 0.06, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.620: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.08, 0.09, 0.05, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.630: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.09, 0.06, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.640: 0/5 good HPI fits, cannot determine the transformation (0.05, 0.07, 0.12, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.650: 0/5 good HPI fits, cannot determine the transformation (0.05, 0.07, 0.11, 0.08, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.660: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.09, 0.08, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.670: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.06, 0.07, 0.07, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.680: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.10, 0.08, 0.06, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.690: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.10, 0.07, 0.08, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.700: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.07, 0.05, 0.13, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.710: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.07, 0.05, 0.10, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.720: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.08, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.730: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.09, 0.07, 0.11, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.740: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.11, 0.08, 0.06, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.750: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.12, 0.09, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.760: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.10, 0.09, 0.07, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.770: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.10, 0.08, 0.07, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.780: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.08, 0.08, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.790: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.08, 0.06, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.800: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.07, 0.06, 0.09, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.810: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.08, 0.10, 0.08, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.820: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.07, 0.12, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.830: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.05, 0.10, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.840: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.07, 0.11, 0.10, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.850: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.07, 0.10, 0.07, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.860: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.10, 0.10, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.870: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.07, 0.08, 0.10, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.880: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.07, 0.07, 0.08, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.890: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.07, 0.08, 0.11, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.900: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.07, 0.09, 0.08, 0.12 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.910: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.08, 0.08, 0.09, 0.14 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.920: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.07, 0.09, 0.09, 0.12 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.930: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.06, 0.07, 0.08, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.940: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.06, 0.06, 0.06, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.950: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.07, 0.06, 0.07, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.960: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.06, 0.09, 0.06, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.970: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.07, 0.08, 0.07, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.980: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.08, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=38.990: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.07, 0.08, 0.07, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.000: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.05, 0.09, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.010: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.08, 0.07, 0.08, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.020: 0/5 good HPI fits, cannot determine the transformation (0.16, 0.06, 0.06, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.030: 0/5 good HPI fits, cannot determine the transformation (0.16, 0.07, 0.07, 0.07, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.040: 0/5 good HPI fits, cannot determine the transformation (0.14, 0.10, 0.09, 0.06, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.050: 0/5 good HPI fits, cannot determine the transformation (0.15, 0.08, 0.09, 0.06, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.060: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.10, 0.08, 0.06, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.070: 0/5 good HPI fits, cannot determine the transformation (0.13, 0.07, 0.08, 0.10, 0.05 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.080: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.07, 0.09, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.090: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.08, 0.08, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.100: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.06, 0.08, 0.10, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.110: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.06, 0.09, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.120: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.10, 0.08, 0.09, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.130: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.08, 0.06, 0.09, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.140: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.09, 0.08, 0.10, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.150: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.08, 0.09, 0.10, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.160: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.10, 0.10, 0.10, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.170: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.10, 0.09, 0.08, 0.12 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.180: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.10, 0.07, 0.07, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.190: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.09, 0.09, 0.08, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.200: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.15, 0.08, 0.11, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.210: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.10, 0.10, 0.09, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.220: 0/5 good HPI fits, cannot determine the transformation (0.10, 0.10, 0.10, 0.06, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.230: 0/5 good HPI fits, cannot determine the transformation (0.11, 0.08, 0.10, 0.08, 0.09 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.240: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.09, 0.09, 0.11 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.250: 0/5 good HPI fits, cannot determine the transformation (0.08, 0.06, 0.10, 0.10, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.260: 0/5 good HPI fits, cannot determine the transformation (0.06, 0.06, 0.10, 0.08, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.270: 0/5 good HPI fits, cannot determine the transformation (0.07, 0.07, 0.10, 0.08, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.280: 0/5 good HPI fits, cannot determine the transformation (0.09, 0.10, 0.14, 0.07, 0.12 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.290: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.09, 0.13, 0.07, 0.10 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.300: 0/5 good HPI fits, cannot determine the transformation (0.14, 0.08, 0.10, 0.06, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.310: 0/5 good HPI fits, cannot determine the transformation (0.13, 0.08, 0.09, 0.08, 0.08 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.320: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.08, 0.09, 0.07, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.330: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.06, 0.07, 0.09, 0.06 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.340: 0/5 good HPI fits, cannot determine the transformation (0.12, 0.07, 0.08, 0.10, 0.07 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.350: 0/5 good HPI fits, cannot determine the transformation (0.23, 0.31, 0.34, 0.20, 0.22 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.360: 0/5 good HPI fits, cannot determine the transformation (0.22, 0.33, 0.33, 0.30, 0.31 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.370: 0/5 good HPI fits, cannot determine the transformation (0.47, 0.43, 0.39, 0.40, 0.42 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.380: 0/5 good HPI fits, cannot determine the transformation (0.92, 0.51, 0.42, 0.49, 0.51 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.390: 0/5 good HPI fits, cannot determine the transformation (0.94, 0.63, 0.50, 0.63, 0.56 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.400: 0/5 good HPI fits, cannot determine the transformation (0.96, 0.78, 0.61, 0.76, 0.55 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.410: 0/5 good HPI fits, cannot determine the transformation (0.97, 0.83, 0.78, 0.90, 0.65 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.420: 2/5 good HPI fits, cannot determine the transformation (0.99, 0.86, 0.98, 0.99, 0.95 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.440: 1/5 good HPI fits, cannot determine the transformation (0.98, 0.87, 0.95, 0.96, 0.91 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.460: 1/5 good HPI fits, cannot determine the transformation (0.99, 0.93, 0.94, 0.95, 0.93 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) /home/runner/work/meg-wiki/meg-wiki/tutorials/megin/30_cHPI.py:148: RuntimeWarning: t=39.480: 2/5 good HPI fits, cannot determine the transformation (0.99, 0.96, 0.98, 0.98, 0.97 GOF)! head_pos = compute_head_pos(raw.info, chpi_locs) .. GENERATED FROM PYTHON SOURCE LINES 151-153 The estimated head position can be plotted in function of time with :func:`mne.viz.plot_head_positions`. .. GENERATED FROM PYTHON SOURCE LINES 153-158 .. code-block:: Python plot_head_positions(head_pos, mode="traces") plot_head_positions(head_pos, mode="field") plt.show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /generated/tutorials/megin/images/sphx_glr_30_cHPI_004.png :alt: Position (mm), Rotation (quat) :srcset: /generated/tutorials/megin/images/sphx_glr_30_cHPI_004.png :class: sphx-glr-multi-img * .. image-sg:: /generated/tutorials/megin/images/sphx_glr_30_cHPI_005.png :alt: 30 cHPI :srcset: /generated/tutorials/megin/images/sphx_glr_30_cHPI_005.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 159-173 Compensate head movements ------------------------- Now that the head position at different timepoints, this information can be used to compensate for the head movements during the recording. The function :func:`mne.preprocessing.maxwell_filter` uses the returned head positions in the argument ``head_pos`` to apply the compensation and estimate the signal at every sensor position as if the head was still, i.e., in the position measured by the initial HPI measurement. .. tip:: It is important to first remove the cHPI signal from the recording and to mark bad channels. .. GENERATED FROM PYTHON SOURCE LINES 173-190 .. code-block:: Python raw = filter_chpi(raw) raw.info["bads"] = [ # strict selection for this example "MEG1531", "MEG1532", "MEG1533", "MEG1542", "MEG1522", "MEG1541", "MEG1321", ] calibration = sample.data_path() / "calibration" / "sss_cal.dat" cross_talk = sample.data_path() / "cross-talk" / "ct_sparse.fif" raw_sss = maxwell_filter( raw, calibration=calibration, cross_talk=cross_talk, head_pos=head_pos ) .. GENERATED FROM PYTHON SOURCE LINES 191-194 Let's visualize the effect on a triplet of sensors located on the top of the head. Note however that this represents the effect of SSS and movemvent compensation together. .. GENERATED FROM PYTHON SOURCE LINES 194-206 .. code-block:: Python f, ax = plt.subplots(3, 1, sharex=True, figsize=(10, 5), layout="constrained") times = raw.times[raw.time_as_index(30)[0] :] picks = ["MEG0711", "MEG0712", "MEG0713"] for k, pick in enumerate(picks): data = raw.get_data(picks=pick, tmin=30).squeeze() ax[k].plot(times, data, label="Raw" if k == 0 else None) data = raw_sss.get_data(picks=pick, tmin=30).squeeze() ax[k].plot(times, data, color="red", label="SSS" if k == 0 else None) ax[k].set_title(f"{'MAG:' if k == 0 else 'GRAD:'} {pick}") plt.show() .. image-sg:: /generated/tutorials/megin/images/sphx_glr_30_cHPI_006.png :alt: MAG: MEG0711, GRAD: MEG0712, GRAD: MEG0713 :srcset: /generated/tutorials/megin/images/sphx_glr_30_cHPI_006.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 207-216 Magnetometers which are more sensitive to distant fields and thus to environmental artifacts are more affected by SSS than gradiometers. .. note:: Note that on top of movement compensation, SSS can also transform the signal as if it was emitted from a different head position, through the argument ``destination``. This can be useful to compare signal between subjects in sensor space or to bring back a tilted head to a more upright position. .. GENERATED FROM PYTHON SOURCE LINES 218-222 References ---------- .. footbibliography:: .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 39.135 seconds) **Estimated memory usage:** 803 MB .. _sphx_glr_download_generated_tutorials_megin_30_cHPI.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 30_cHPI.ipynb <30_cHPI.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 30_cHPI.py <30_cHPI.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 30_cHPI.zip <30_cHPI.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_