Description of the problem
Plotting topomaps when EEG sensor positions are digitized keeps being problematic. And that is not surprising, as it is a difficult problem. Today's problem has to do with fitting the head sphere to the digitized points.
I'm preparing the lesson materials for PracticalMEEG2025 during which we will work with the Henson and Wakeman ds000117 dataset. For some reason, they included only the front of the face as "extra" head shape digitization points and otherwise digitized the EEG and HPI positions. This does not play well with the MNE-Python default behavior when fitting a sphere to the headshape, as it sees the head shape points and uses that by default (a sane default!). However, because these points only cover the front of the face, the sphere is way off.
Steps to reproduce
from pathlib import Path
import mne
import pooch
pooch.retrieve("https://zenodo.org/records/7405048/files/ds000117_pruned.zip?download=1", known_hash="44db832fe7d6075a736d9b3318543c643a6cd7c4f98b85db9e3478837f2779c7", processor=pooch.Unzip(extract_dir=Path.cwd() / "data"))
raw = mne.io.read_raw("./data/ds000117_pruned/derivatives/meg_derivatives/sub-01/ses-meg/meg/sub-01_ses-meg_task-facerecognition_run-01_proc-sss_meg.fif")
# Both of these produce bad results
raw.plot_sensors(ch_type="eeg")
raw.plot_sensors(ch_type="eeg", sphere="auto")
Link to data
No response
Expected results
Actual results
Additional information
You can fix the plot by manually specifying the sphere, but the code for it is not very pretty:
radius, center, _ = mne.bem.fit_sphere_to_headshape(raw.info, dig_kinds="eeg")
sphere = tuple(center) + (radius,)
raw.plot_sensors(ch_type="eeg", sphere=sphere)
Description of the problem
Plotting topomaps when EEG sensor positions are digitized keeps being problematic. And that is not surprising, as it is a difficult problem. Today's problem has to do with fitting the head sphere to the digitized points.
I'm preparing the lesson materials for PracticalMEEG2025 during which we will work with the Henson and Wakeman ds000117 dataset. For some reason, they included only the front of the face as "extra" head shape digitization points and otherwise digitized the EEG and HPI positions. This does not play well with the MNE-Python default behavior when fitting a sphere to the headshape, as it sees the head shape points and uses that by default (a sane default!). However, because these points only cover the front of the face, the sphere is way off.
Steps to reproduce
Link to data
No response
Expected results
Actual results
Additional information
You can fix the plot by manually specifying the sphere, but the code for it is not very pretty: