Skip to content

Commit e6b0253

Browse files
authored
MAINT: Fixes for matplotlib and pandas (#11574)
1 parent a4a8782 commit e6b0253

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

mne/time_frequency/tests/test_spectrum.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def test_unaggregated_spectrum_to_data_frame(raw, long_format, method):
151151
# sorting at the agg step *sigh*
152152
_inplace(orig_df, 'sort_values', by=grouping_cols, ignore_index=True)
153153
# aggregate
154-
gb = df.drop(columns=drop_cols).groupby(grouping_cols, as_index=False)
154+
gb = df.drop(columns=drop_cols).groupby(
155+
grouping_cols, as_index=False, observed=False)
155156
if method == 'welch':
156157
agg_df = gb.aggregate(np.nanmean)
157158
else:

mne/viz/tests/test_topomap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,20 @@ def test_plot_topomap_interactive(constrained_layout):
7272
res=8, time_unit='s')
7373
evoked.copy().plot_topomap(proj=False, **kwargs)
7474
canvas.draw()
75-
image_noproj = np.frombuffer(canvas.tostring_rgb(), dtype='uint8')
75+
image_noproj = np.frombuffer(canvas.tostring_argb(), dtype='uint8')
7676
assert len(plt.get_fignums()) == 1
7777

7878
ax.clear()
7979
evoked.copy().plot_topomap(proj=True, **kwargs)
8080
canvas.draw()
81-
image_proj = np.frombuffer(canvas.tostring_rgb(), dtype='uint8')
81+
image_proj = np.frombuffer(canvas.tostring_argb(), dtype='uint8')
8282
assert not np.array_equal(image_noproj, image_proj)
8383
assert len(plt.get_fignums()) == 1
8484

8585
ax.clear()
8686
fig = evoked.copy().plot_topomap(proj='interactive', **kwargs)
8787
canvas.draw()
88-
image_interactive = np.frombuffer(canvas.tostring_rgb(), dtype='uint8')
88+
image_interactive = np.frombuffer(canvas.tostring_argb(), dtype='uint8')
8989
assert_array_equal(image_noproj, image_interactive)
9090
assert not np.array_equal(image_proj, image_interactive)
9191
assert len(plt.get_fignums()) == 2
@@ -97,7 +97,7 @@ def test_plot_topomap_interactive(constrained_layout):
9797
assert _proj_status(fig, 'matplotlib') == [True]
9898
canvas.draw()
9999
image_interactive_click = np.frombuffer(
100-
canvas.tostring_rgb(), dtype='uint8')
100+
canvas.tostring_argb(), dtype='uint8')
101101
corr = np.corrcoef(
102102
image_proj.ravel(), image_interactive_click.ravel())[0, 1]
103103
assert 0.99 < corr <= 1
@@ -108,7 +108,7 @@ def test_plot_topomap_interactive(constrained_layout):
108108
_fake_click(proj_fig, proj_fig.axes[0], [0.5, 0.5], xform='ax')
109109
canvas.draw()
110110
image_interactive_click = np.frombuffer(
111-
canvas.tostring_rgb(), dtype='uint8')
111+
canvas.tostring_argb(), dtype='uint8')
112112
corr = np.corrcoef(
113113
image_noproj.ravel(), image_interactive_click.ravel())[0, 1]
114114
assert 0.99 < corr <= 1

0 commit comments

Comments
 (0)