vferat/pycrostates

Failure with mne-main due to 'dev_head_t'

Closed this issue · 2 comments

I started looking in the failure with mne-main. MRE:

from mne.datasets import testing
from mne.io import read_raw_fif

from pycrostates.cluster import ModKMeans


directory = testing.data_path() / "MEG" / "sample"
fname = directory / "sample_audvis_trunc_raw.fif"
raw = read_raw_fif(fname, preload=False)
raw = raw.crop(0, 10).pick("eeg").load_data().apply_proj()

ModK = ModKMeans(
    n_clusters=4,
    n_init=10,
    max_iter=100,
    tol=1e-4,
    random_state=1,
)
ModK.fit(raw, n_jobs=1)
ModK.plot(block=False)

I'm a bit surprised it did not pop up earlier. The line dev_head_t = info['dev_head_t'] which is raising with a KeyError has been in for 3 years.

So... it's actually due to a change I made 😅 mne-tools/mne-python#11081
Checking if that change on mne-main broke anything (like changing how a plot looks, which is not captured by the tests)..
And we should probably support the coordinate transformation in a ChInfo.

And indeed it broke something on MNE side: mne-tools/mne-python#11133
I'm getting the same kind of topomap when using #71, so I think #71 and adding support for coordinate transformation is the way to go, but there is also a bug in MNE.