From 6fad8595e1c3b40ed9db61796cc78de166924d1a Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Sat, 6 Jan 2024 15:48:35 +0100 Subject: [PATCH] correctly retrieve idx of bad channels --- mne/viz/topo.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mne/viz/topo.py b/mne/viz/topo.py index 1db92b26d1f..358f00f1d78 100644 --- a/mne/viz/topo.py +++ b/mne/viz/topo.py @@ -975,7 +975,15 @@ def _plot_evoked_topo( if layout is None: layout = find_layout(info, exclude=exclude) else: - layout = layout.pick("all", exclude=_picks_to_idx(info, "all", exclude=exclude)) + layout = layout.pick( + "all", + exclude=_picks_to_idx( + info, + exclude if exclude != "bads" else info["bads"], + exclude=(), + allow_empty=True, + ), + ) if not merge_channels: # XXX. at the moment we are committed to 1- / 2-sensor-types layouts