Skip to content

Commit 7468d76

Browse files
FIX: Add type check for merge_channels in OPM grouping gate
1 parent 4044692 commit 7468d76

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

examples/datasets/kernel_phantom.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,14 @@
106106
)
107107
mne.viz.plot_dipole_locations(dipoles=dip, mode="arrow", color=(0.2, 1.0, 0.5), fig=fig)
108108
mne.viz.set_3d_view(figure=fig, azimuth=30, elevation=70, distance=0.4)
109+
110+
# %%
111+
# Grouped OPM topomap visualization
112+
# ==================================
113+
#
114+
# Since Kernel OPMs are triaxial sensors (measuring Bx, By, Bz directions),
115+
# we can visualize them as grouped topomaps showing radial and tangential
116+
# components side-by-side. This is only done when merge_channels=True
117+
# and there are multiple colocated channels at each location:
118+
119+
fig = evoked.plot_topomap(times=[t_peak], merge_channels=True, sphere=sphere)

mne/viz/topomap.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ def _should_use_opm_orientation_groups(info, picks, merge_channels, ch_type):
372372
if not pick_chs or not all(ch["coil_type"] in _opm_coils for ch in pick_chs):
373373
return False
374374

375+
# merge_channels should be a list of overlap sets, not a boolean
376+
if not isinstance(merge_channels, (list, tuple)):
377+
return False
378+
375379
return any(len(overlap_set) >= 3 for overlap_set in merge_channels)
376380

377381

0 commit comments

Comments
 (0)