plot_glm_group_topomap traceback

  • MNE version: 1.2
  • operating system: Windows 11

Hi, I have been following the Group Level GLM Analysis - Tutorial with my own data, everything works fine except when attempting to do a topomap with plot_glm_group_topomap() for which I encountered a ValueError:

  plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),
Traceback (most recent call last):

  File ~\fNIRS-project\Preprocessing_individual.py:732
    plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),

  File ~\Anaconda3\envs\old_mne\lib\site-packages\mne_nirs\visualisation\_plot_GLM_topo.py:276 in plot_glm_group_topo
    plot_topomap(

  File ~\Anaconda3\envs\old_mne\lib\site-packages\mne\viz\topomap.py:824 in plot_topomap
    return _plot_topomap(

  File ~\Anaconda3\envs\old_mne\lib\site-packages\mne\viz\topomap.py:996 in _plot_topomap
    raise ValueError("Data and pos need to be of same length. Got data of "

ValueError: Data and pos need to be of same length. Got data of length 44, pos of length 17

I do not know exactly what this means and where the problem lies. I hope you can help me!
I did the following:

# %%
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(10, 10),
                         gridspec_kw=dict(width_ratios=[1, 1]))

# Cut down the dataframe just to the conditions we are interested in
ch_summary = df_cha.query("Condition in ['RotTS', 'RotBlesser']")
ch_summary = ch_summary.query("Chroma in ['hbo']")

# Run group level model and convert to dataframe
ch_model = smf.mixedlm("theta ~ -1 + ch_name:Chroma:Condition",
                       ch_summary, groups=ch_summary["ID"]).fit(method='nm')
ch_model_df = statsmodels_to_results(ch_model)

# Plot the two conditions
plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),    # 44 x 660 
                    ch_model_df.query("Condition in ['RotTS']"),  # [44 rows x 10 columns]
                    colorbar=False, axes=axes[0, 0],
                    vlim=(0, 20), cmap=mpl.cm.Oranges)

plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),   # 44 x 660 
                    ch_model_df.query("Condition in ['RotBlesser']"), # [44 rows x 10 columns]
                    colorbar=True, axes=axes[0, 1],
                    vlim=(0, 20), cmap=mpl.cm.Oranges)

Thank you for your help and support,
Rebecka