Error when displaying topographic results of four conditions

Hello!

I’m trying to display the topographic results of four conditions using this code:

##group totpographic results
fig, axes = plt.subplots(nrows=4, 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 ['rest', 'eng', 'span', 'dis']")
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"),
                    ch_model_df.query("Condition in ['rest']"),
                    colorbar=False, axes=axes[0, 0],
                    vlim=(0, 20), cmap=mpl.cm.Oranges)
plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),
                    ch_model_df.query("Condition in ['eng']"),
                    colorbar=False, axes=axes[0, 0],
                    vlim=(0, 20), cmap=mpl.cm.Oranges)

plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),
                    ch_model_df.query("Condition in ['span']"),
                    colorbar=True, axes=axes[0, 1],
                    vlim=(0, 20), cmap=mpl.cm.Oranges)

plot_glm_group_topo(raw_haemo.copy().pick(picks="hbo"),
                    ch_model_df.query("Condition in ['dis']"),
                    colorbar=True, axes=axes[0, 1],
                    vlim=(0, 20), cmap=mpl.cm.Oranges)

# Cut down the dataframe just to the conditions we are interested in
ch_summary = df_cha.query("Condition in ['rest', 'eng', 'span', 'dis']")
ch_summary = ch_summary.query("Chroma in ['hbr']")

# 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="hbr"),
                    ch_model_df.query("Condition in ['rest']"),
                    colorbar=False, axes=axes[1, 0],
                    vlim=(-10, 0), cmap=mpl.cm.Blues_r),
plot_glm_group_topo(raw_haemo.copy().pick(picks="hbr"),
                    ch_model_df.query("Condition in ['eng']"),
                    colorbar=False, axes=axes[1, 0],
                    vlim=(-10, 0), cmap=mpl.cm.Blues_r)
plot_glm_group_topo(raw_haemo.copy().pick(picks="hbr"),
                    ch_model_df.query("Condition in ['span']"),
                    colorbar=True, axes=axes[1, 1],
                    vlim=(-10, 0), cmap=mpl.cm.Blues_r)       
plot_glm_group_topo(raw_haemo.copy().pick(picks="hbr"),
                    ch_model_df.query("Condition in ['dis']"),
                    colorbar=True, axes=axes[1, 1],
                    vlim=(-10, 0), cmap=mpl.cm.Blues_r)    

However instead of getting all four conditions, I’m getting this


with this warning from python:

/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:15: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbo”),
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:19: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbo”),
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:24: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbo”),
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:29: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbo”),
/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/statsmodels/regression/mixed_linear_model.py:2237: ConvergenceWarning: The MLE may be on the boundary of the parameter space.
warnings.warn(msg, ConvergenceWarning)
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:44: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbr”),
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:48: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbr”),
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:52: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbr”),
/var/folders/6t/tht29cz53j7852bcqhrxzvzcvb_389/T/ipykernel_13619/2817254903.py:56: RuntimeWarning: MNE data structure does not match regression results
plot_glm_group_topo(raw_haemo.copy().pick(picks=“hbr”),
Out[99]: <Axes: title={‘center’: ‘dis’}>

Does anyone know why only two conditions are loading? Thank you so much!

I realized that I wanted two rows and four columns instead of the other way around to display all conditions so I changed that to this:

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

However now I am getting this warning:

ValueError: Expected the given number of width ratios to match the number of columns of the grid

<Figure size 720x720 with 0 Axes>

Does anyone know what’s causing this?

Thanks!