From eed9959ea81face775b9095d94cb46b271aabf49 Mon Sep 17 00:00:00 2001 From: Famous Date: Wed, 25 Feb 2026 14:11:12 +0530 Subject: [PATCH 01/13] FIX: correct sensor name ordering in plot_topomap when using Info object --- doc/changes/dev/12700.bugfix.rst | 1 + mne/viz/topomap.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 doc/changes/dev/12700.bugfix.rst diff --git a/doc/changes/dev/12700.bugfix.rst b/doc/changes/dev/12700.bugfix.rst new file mode 100644 index 00000000000..a22ed1edb4c --- /dev/null +++ b/doc/changes/dev/12700.bugfix.rst @@ -0,0 +1 @@ +Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when passing an :class:`~mne.Info` object as ``pos`` with ``names`` argument, by `Famous077 `__. \ No newline at end of file diff --git a/mne/viz/topomap.py b/mne/viz/topomap.py index 1bd585bb4f1..1315f5a6012 100644 --- a/mne/viz/topomap.py +++ b/mne/viz/topomap.py @@ -1292,9 +1292,13 @@ def _plot_topomap( pos = _find_topomap_coords(pos, picks=picks[::2], sphere=sphere) data, _ = _merge_ch_data(data[picks], ch_type, []) data = data.reshape(-1) + if names is not None: + names = [names[p] for p in picks[::2]] else: picks = list(range(data.shape[0])) pos = _find_topomap_coords(pos, picks=picks, sphere=sphere) + if names is not None: + names = [names[p] for p in picks] extrapolate = _check_extrapolate(extrapolate, ch_type) if data.ndim > 1: From 8aaae3ba11571bc578017ba1a520857cc3df34b5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 08:44:39 +0000 Subject: [PATCH 02/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne/viz/topomap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne/viz/topomap.py b/mne/viz/topomap.py index 1315f5a6012..fde53616e98 100644 --- a/mne/viz/topomap.py +++ b/mne/viz/topomap.py @@ -1298,7 +1298,7 @@ def _plot_topomap( picks = list(range(data.shape[0])) pos = _find_topomap_coords(pos, picks=picks, sphere=sphere) if names is not None: - names = [names[p] for p in picks] + names = [names[p] for p in picks] extrapolate = _check_extrapolate(extrapolate, ch_type) if data.ndim > 1: From 4eb129b14e7cab2164776059c05861be0b5d00ff Mon Sep 17 00:00:00 2001 From: Famous Date: Thu, 26 Feb 2026 19:47:16 +0530 Subject: [PATCH 03/13] ADD: changelog entry for fix sensor name ordering in plot_topomap #13686 --- doc/changes/dev/13686.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 doc/changes/dev/13686.bugfix.rst diff --git a/doc/changes/dev/13686.bugfix.rst b/doc/changes/dev/13686.bugfix.rst new file mode 100644 index 00000000000..59e957cbd95 --- /dev/null +++ b/doc/changes/dev/13686.bugfix.rst @@ -0,0 +1,2 @@ +Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when using an +:class:`~mne.Info` object to specify channel positions (:gh:`13686` by :ghuser:`Famous077`). From 5f84b29c3a7059883037f1156835807bf54b3156 Mon Sep 17 00:00:00 2001 From: Famous Date: Fri, 27 Feb 2026 02:46:42 +0530 Subject: [PATCH 04/13] FIX: fix changelog entry format and add name to names.inc --- doc/changes/dev/13686.bugfix.rst | 3 +-- doc/changes/names.inc | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changes/dev/13686.bugfix.rst b/doc/changes/dev/13686.bugfix.rst index 59e957cbd95..621a531295a 100644 --- a/doc/changes/dev/13686.bugfix.rst +++ b/doc/changes/dev/13686.bugfix.rst @@ -1,2 +1 @@ -Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when using an -:class:`~mne.Info` object to specify channel positions (:gh:`13686` by :ghuser:`Famous077`). +Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when using an :class:`~mne.Info` object to specify channel positions, by `Famous077 `__. diff --git a/doc/changes/names.inc b/doc/changes/names.inc index 09c5818b6af..d363a234f9f 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -96,6 +96,7 @@ .. _Ezequiel Mikulan: https://github.com/ezemikulan .. _Ezequiel Mikulan: https://github.com/ezemikulan .. _Fahimeh Mamashli: https://github.com/fmamashli +.. _Famous077: https://github.com/Famous077 .. _Farzin Negahbani: https://github.com/Farzin-Negahbani .. _Federico Raimondo: https://github.com/fraimondo .. _Federico Zamberlan: https://github.com/fzamberlan From f751b663067244ca7f54391340622a6675d8b59c Mon Sep 17 00:00:00 2001 From: Famous Date: Tue, 3 Mar 2026 01:15:30 +0530 Subject: [PATCH 05/13] Address review feedback: remove duplicate changelog, fix format, add test --- doc/changes/dev/12700.bugfix.rst | 1 - doc/changes/dev/13686.bugfix.rst | 2 +- mne/viz/tests/test_topomap.py | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) delete mode 100644 doc/changes/dev/12700.bugfix.rst diff --git a/doc/changes/dev/12700.bugfix.rst b/doc/changes/dev/12700.bugfix.rst deleted file mode 100644 index a22ed1edb4c..00000000000 --- a/doc/changes/dev/12700.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when passing an :class:`~mne.Info` object as ``pos`` with ``names`` argument, by `Famous077 `__. \ No newline at end of file diff --git a/doc/changes/dev/13686.bugfix.rst b/doc/changes/dev/13686.bugfix.rst index 621a531295a..fb6940652b5 100644 --- a/doc/changes/dev/13686.bugfix.rst +++ b/doc/changes/dev/13686.bugfix.rst @@ -1 +1 @@ -Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when using an :class:`~mne.Info` object to specify channel positions, by `Famous077 `__. +Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when passing an :class:`~mne.Info` object as ``pos`` with ``names`` argument, by :newcontrib:`Famous077`. \ No newline at end of file diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index 64a13b46006..e850641c328 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -987,3 +987,28 @@ def test_plot_ch_adjacency(): msg = "Editing a 3d adjacency plot is not supported." with pytest.raises(ValueError, match=msg): plot_ch_adjacency(info, adj, ch_names, kind="3d", edit=True) + +def test_plot_topomap_info_names_ordering(): + """Regression test for GH-12700. + + plot_topomap() must preserve correct sensor name ordering when + passing an Info object as pos with a names argument. + """ + import numpy as np + from mne import create_info + from mne.channels import make_standard_montage + from mne.viz import plot_topomap + + info = create_info( + ch_names=["Fp1", "Fp2", "Fz"], sfreq=1000.0, ch_types="eeg" + ) + montage = make_standard_montage("standard_1020") + info.set_montage(montage) + + data = np.array([1.0, 2.0, 3.0]) + names = ["Fp1", "Fp2", "Fz"] + + # This must not raise and must display correct sensor names + fig, _ = plot_topomap(data, info, names=names, show=False) + assert fig is not None + plt.close("all") \ No newline at end of file From 476fc4c156bedfa798c980179dfc55cf79173132 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:58:03 +0000 Subject: [PATCH 06/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne/viz/tests/test_topomap.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index e850641c328..74c51219318 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -988,6 +988,7 @@ def test_plot_ch_adjacency(): with pytest.raises(ValueError, match=msg): plot_ch_adjacency(info, adj, ch_names, kind="3d", edit=True) + def test_plot_topomap_info_names_ordering(): """Regression test for GH-12700. @@ -995,13 +996,12 @@ def test_plot_topomap_info_names_ordering(): passing an Info object as pos with a names argument. """ import numpy as np + from mne import create_info from mne.channels import make_standard_montage from mne.viz import plot_topomap - info = create_info( - ch_names=["Fp1", "Fp2", "Fz"], sfreq=1000.0, ch_types="eeg" - ) + info = create_info(ch_names=["Fp1", "Fp2", "Fz"], sfreq=1000.0, ch_types="eeg") montage = make_standard_montage("standard_1020") info.set_montage(montage) @@ -1011,4 +1011,4 @@ def test_plot_topomap_info_names_ordering(): # This must not raise and must display correct sensor names fig, _ = plot_topomap(data, info, names=names, show=False) assert fig is not None - plt.close("all") \ No newline at end of file + plt.close("all") From f291f93be72067f6771bb6b237a187cac5a34f04 Mon Sep 17 00:00:00 2001 From: Famous Date: Thu, 5 Mar 2026 01:04:39 +0530 Subject: [PATCH 07/13] TST: move imports to module level in test_plot_topomap_info_names_ordering --- mne/viz/tests/test_topomap.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index 74c51219318..f75224ce0e8 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -995,11 +995,6 @@ def test_plot_topomap_info_names_ordering(): plot_topomap() must preserve correct sensor name ordering when passing an Info object as pos with a names argument. """ - import numpy as np - - from mne import create_info - from mne.channels import make_standard_montage - from mne.viz import plot_topomap info = create_info(ch_names=["Fp1", "Fp2", "Fz"], sfreq=1000.0, ch_types="eeg") montage = make_standard_montage("standard_1020") From 166d8651baa3353a78c1f735ba1c12f11721b6e2 Mon Sep 17 00:00:00 2001 From: Famous Date: Thu, 5 Mar 2026 01:14:07 +0530 Subject: [PATCH 08/13] DOC: fix contributor name in changelog and names.inc --- doc/changes/dev/13686.bugfix.rst | 2 +- doc/changes/names.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changes/dev/13686.bugfix.rst b/doc/changes/dev/13686.bugfix.rst index fb6940652b5..58fbd5229fc 100644 --- a/doc/changes/dev/13686.bugfix.rst +++ b/doc/changes/dev/13686.bugfix.rst @@ -1 +1 @@ -Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when passing an :class:`~mne.Info` object as ``pos`` with ``names`` argument, by :newcontrib:`Famous077`. \ No newline at end of file +Fix sensor name ordering in :func:`~mne.viz.plot_topomap` when passing an :class:`~mne.Info` object as ``pos`` with ``names`` argument, by :newcontrib:`Famous Raj Bhat`. \ No newline at end of file diff --git a/doc/changes/names.inc b/doc/changes/names.inc index d363a234f9f..c6b4b00c499 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -96,7 +96,7 @@ .. _Ezequiel Mikulan: https://github.com/ezemikulan .. _Ezequiel Mikulan: https://github.com/ezemikulan .. _Fahimeh Mamashli: https://github.com/fmamashli -.. _Famous077: https://github.com/Famous077 +.. _Famous Raj Bhat: https://github.com/Famous077 .. _Farzin Negahbani: https://github.com/Farzin-Negahbani .. _Federico Raimondo: https://github.com/fraimondo .. _Federico Zamberlan: https://github.com/fzamberlan From ffe984a3c085b07d237ee8776aa2d3e26839ae30 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 19:45:41 +0000 Subject: [PATCH 09/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne/viz/tests/test_topomap.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index f75224ce0e8..c9c3bb26ad1 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -995,7 +995,6 @@ def test_plot_topomap_info_names_ordering(): plot_topomap() must preserve correct sensor name ordering when passing an Info object as pos with a names argument. """ - info = create_info(ch_names=["Fp1", "Fp2", "Fz"], sfreq=1000.0, ch_types="eeg") montage = make_standard_montage("standard_1020") info.set_montage(montage) From 14833a960c6e405043585c1a01667dac2e5476bd Mon Sep 17 00:00:00 2001 From: Famous Date: Fri, 6 Mar 2026 00:42:07 +0530 Subject: [PATCH 10/13] TST: verify displayed sensor names match expected in test_plot_topomap_info_names_ordering --- mne/viz/tests/test_topomap.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index c9c3bb26ad1..912b0ab8f20 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -86,7 +86,6 @@ def test_plot_topomap_interactive(layout): assert not evoked.proj evoked.add_proj(compute_proj_evoked(evoked, n_mag=1)) - plt.close("all") fig, ax = plt.subplots(layout=layout) canvas = fig.canvas @@ -363,12 +362,9 @@ def test_plot_topomap_basic(): # other: # ------ plt_topomap = partial(evoked.plot_topomap, **fast_test) - plt.close("all") axes = [plt.subplot(221), plt.subplot(222)] plt_topomap(axes=axes, colorbar=False) - plt.close("all") plt_topomap(times=[-0.1, 0.2]) - plt.close("all") evoked_grad = evoked.copy().crop(0, 0).pick(picks="grad") mask = np.zeros((204, 1), bool) mask[[0, 3, 5, 6]] = True @@ -396,7 +392,6 @@ def proc_names(x): plt_topomap( times, ch_type="grad", mask=mask, show_names=True, mask_params={"marker": "x"} ) - plt.close("all") p = plt_topomap( times, @@ -436,7 +431,6 @@ def get_texts(p): p = plt_topomap(times, ch_type="eeg", average=0.01) assert_equal(len(get_texts(p)), 0) - plt.close("all") # Test averaging with a scalar input averaging_times = [ev_bad.times[0], times[0], ev_bad.times[-1]] @@ -468,7 +462,6 @@ def get_texts(p): # change to no-proj mode evoked = read_evokeds(evoked_fname, "Left Auditory", baseline=(None, 0), proj=False) - plt.close("all") fig1 = evoked.plot_topomap( "interactive", ch_type="mag", proj="interactive", **fast_test ) @@ -497,7 +490,6 @@ def get_texts(p): eeg_picks = pick_types(evoked.info, meg=False, eeg=True) pos, outlines = _get_pos_outlines(evoked.info, eeg_picks, 0.1) evoked.plot_topomap(times, ch_type="eeg", outlines=outlines, **fast_test) - plt.close("all") # Test interactive cmap fig = plot_evoked_topomap( @@ -519,7 +511,6 @@ def get_texts(p): _fake_scroll(fig, 0.5, 0.5, -0.5) # scroll down _fake_scroll(fig, 0.5, 0.5, 0.5) # scroll up - plt.close("all") # Pass custom outlines with patch callable def patch(): @@ -548,12 +539,10 @@ def patch(): # height) is assumed. pos_xywh = np.c_[pos, np.zeros((n_channels, 2))] plot_topomap(data, pos_xywh) - plt.close("all") # Test peak finder axes = [plt.subplot(131), plt.subplot(132)] evoked.plot_topomap(times="peaks", axes=axes, **fast_test) - plt.close("all") evoked.data = np.zeros(evoked.data.shape) evoked.data[50][1] = 1 assert_array_equal(_find_peaks(evoked, 10), evoked.times[1]) @@ -580,7 +569,6 @@ def test_plot_psds_topomap_colorbar(): psd = np.abs(rng.standard_normal((len(picks), len(freqs)))) bands = {"theta": [4, 8]} - plt.close("all") fig_cbar = plot_psds_topomap(psd, freqs, info, colorbar=True, bands=bands) assert len(fig_cbar.axes) == 2 @@ -659,7 +647,6 @@ def test_plot_tfr_topomap(): eclick.xdata = eclick.ydata = 0.0 erelease.xdata = erelease.ydata = 0.9 tfr._onselect(eclick, erelease, None, "mean", None) - plt.close("all") # test plot_psds_topomap info = raw.info.copy() @@ -1003,6 +990,9 @@ def test_plot_topomap_info_names_ordering(): names = ["Fp1", "Fp2", "Fz"] # This must not raise and must display correct sensor names - fig, _ = plot_topomap(data, info, names=names, show=False) - assert fig is not None - plt.close("all") + im, _ = plot_topomap(data, info, names=names, show=False) + assert im is not None + # Verify the displayed sensor names match the expected ones + displayed_names = [t.get_text() for t in im.axes.texts] + for name in names: + assert name in displayed_names, f"{name!r} not found in {displayed_names}" From 9bb8f602ecd871c06952b13aee49a6874c5ef299 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:12:33 +0000 Subject: [PATCH 11/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne/viz/tests/test_topomap.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index 912b0ab8f20..63bb050785d 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -511,7 +511,6 @@ def get_texts(p): _fake_scroll(fig, 0.5, 0.5, -0.5) # scroll down _fake_scroll(fig, 0.5, 0.5, 0.5) # scroll up - # Pass custom outlines with patch callable def patch(): return Circle( From 1896bd3ff45c3d5bd9390baecbba49291eacc5d4 Mon Sep 17 00:00:00 2001 From: Famous Date: Fri, 6 Mar 2026 20:17:17 +0530 Subject: [PATCH 12/13] TST: restore plt.close('all') calls and keep new test --- mne/viz/tests/test_topomap.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index 63bb050785d..73c4d08e580 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -86,6 +86,7 @@ def test_plot_topomap_interactive(layout): assert not evoked.proj evoked.add_proj(compute_proj_evoked(evoked, n_mag=1)) + plt.close("all") fig, ax = plt.subplots(layout=layout) canvas = fig.canvas @@ -362,9 +363,12 @@ def test_plot_topomap_basic(): # other: # ------ plt_topomap = partial(evoked.plot_topomap, **fast_test) + plt.close("all") axes = [plt.subplot(221), plt.subplot(222)] plt_topomap(axes=axes, colorbar=False) + plt.close("all") plt_topomap(times=[-0.1, 0.2]) + plt.close("all") evoked_grad = evoked.copy().crop(0, 0).pick(picks="grad") mask = np.zeros((204, 1), bool) mask[[0, 3, 5, 6]] = True @@ -392,6 +396,7 @@ def proc_names(x): plt_topomap( times, ch_type="grad", mask=mask, show_names=True, mask_params={"marker": "x"} ) + plt.close("all") p = plt_topomap( times, @@ -431,6 +436,7 @@ def get_texts(p): p = plt_topomap(times, ch_type="eeg", average=0.01) assert_equal(len(get_texts(p)), 0) + plt.close("all") # Test averaging with a scalar input averaging_times = [ev_bad.times[0], times[0], ev_bad.times[-1]] @@ -462,6 +468,7 @@ def get_texts(p): # change to no-proj mode evoked = read_evokeds(evoked_fname, "Left Auditory", baseline=(None, 0), proj=False) + plt.close("all") fig1 = evoked.plot_topomap( "interactive", ch_type="mag", proj="interactive", **fast_test ) @@ -490,6 +497,7 @@ def get_texts(p): eeg_picks = pick_types(evoked.info, meg=False, eeg=True) pos, outlines = _get_pos_outlines(evoked.info, eeg_picks, 0.1) evoked.plot_topomap(times, ch_type="eeg", outlines=outlines, **fast_test) + plt.close("all") # Test interactive cmap fig = plot_evoked_topomap( @@ -511,6 +519,8 @@ def get_texts(p): _fake_scroll(fig, 0.5, 0.5, -0.5) # scroll down _fake_scroll(fig, 0.5, 0.5, 0.5) # scroll up + plt.close("all") + # Pass custom outlines with patch callable def patch(): return Circle( @@ -538,10 +548,12 @@ def patch(): # height) is assumed. pos_xywh = np.c_[pos, np.zeros((n_channels, 2))] plot_topomap(data, pos_xywh) + plt.close("all") # Test peak finder axes = [plt.subplot(131), plt.subplot(132)] evoked.plot_topomap(times="peaks", axes=axes, **fast_test) + plt.close("all") evoked.data = np.zeros(evoked.data.shape) evoked.data[50][1] = 1 assert_array_equal(_find_peaks(evoked, 10), evoked.times[1]) @@ -568,6 +580,7 @@ def test_plot_psds_topomap_colorbar(): psd = np.abs(rng.standard_normal((len(picks), len(freqs)))) bands = {"theta": [4, 8]} + plt.close("all") fig_cbar = plot_psds_topomap(psd, freqs, info, colorbar=True, bands=bands) assert len(fig_cbar.axes) == 2 @@ -646,6 +659,7 @@ def test_plot_tfr_topomap(): eclick.xdata = eclick.ydata = 0.0 erelease.xdata = erelease.ydata = 0.9 tfr._onselect(eclick, erelease, None, "mean", None) + plt.close("all") # test plot_psds_topomap info = raw.info.copy() @@ -975,6 +989,7 @@ def test_plot_ch_adjacency(): plot_ch_adjacency(info, adj, ch_names, kind="3d", edit=True) + def test_plot_topomap_info_names_ordering(): """Regression test for GH-12700. @@ -984,14 +999,10 @@ def test_plot_topomap_info_names_ordering(): info = create_info(ch_names=["Fp1", "Fp2", "Fz"], sfreq=1000.0, ch_types="eeg") montage = make_standard_montage("standard_1020") info.set_montage(montage) - data = np.array([1.0, 2.0, 3.0]) names = ["Fp1", "Fp2", "Fz"] - - # This must not raise and must display correct sensor names im, _ = plot_topomap(data, info, names=names, show=False) assert im is not None - # Verify the displayed sensor names match the expected ones displayed_names = [t.get_text() for t in im.axes.texts] for name in names: assert name in displayed_names, f"{name!r} not found in {displayed_names}" From bd396c3b02e70096c5a1f1d461450f5e4bd8bf6f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 14:47:41 +0000 Subject: [PATCH 13/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne/viz/tests/test_topomap.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py index 73c4d08e580..d50cefc46d3 100644 --- a/mne/viz/tests/test_topomap.py +++ b/mne/viz/tests/test_topomap.py @@ -989,7 +989,6 @@ def test_plot_ch_adjacency(): plot_ch_adjacency(info, adj, ch_names, kind="3d", edit=True) - def test_plot_topomap_info_names_ordering(): """Regression test for GH-12700.