@@ -797,6 +797,43 @@ def test_plot_topomap_opm():
797797 assert len (fig_evoked .axes ) == 5
798798
799799
800+ def test_prepare_topomap_plot_opm_non_quspin_coils ():
801+ """Test colocated OPM handling for non-QuSpin OPM coil types."""
802+ ch_names = ["OPM001" , "OPM002" , "OPM003" , "OPM004" ]
803+ info = create_info (ch_names , 1000.0 , ch_types = "mag" )
804+ # Two colocated pairs with different orientations.
805+ positions = np .array (
806+ [
807+ [0.03 , 0.00 , 0.05 ],
808+ [0.03 , 0.00 , 0.05 ],
809+ [- 0.03 , 0.00 , 0.05 ],
810+ [- 0.03 , 0.00 , 0.05 ],
811+ ]
812+ )
813+ orientations = np .array (
814+ [
815+ [0.5145 , 0.0000 , 0.8575 ], # radial-ish
816+ [0.0000 , 1.0000 , 0.0000 ], # tangential-ish
817+ [- 0.5145 , 0.0000 , 0.8575 ], # radial-ish
818+ [0.0000 , 1.0000 , 0.0000 ], # tangential-ish
819+ ]
820+ )
821+ with info ._unlock ():
822+ for idx , ch in enumerate (info ["chs" ]):
823+ ch ["coil_type" ] = FIFF .FIFFV_COIL_FIELDLINE_OPM_MAG_GEN1
824+ ch ["loc" ][:3 ] = positions [idx ]
825+ ch ["loc" ][9 :12 ] = orientations [idx ]
826+ evoked = EvokedArray (np .zeros ((len (ch_names ), 5 )), info )
827+
828+ picks , _pos , merge_channels , merged_names , * _ = topomap ._prepare_topomap_plot (
829+ evoked , "mag"
830+ )
831+
832+ assert len (picks ) == 4
833+ assert merge_channels
834+ assert sum (name .endswith ("MERGE-REMOVE" ) for name in merged_names ) == 2
835+
836+
800837def test_plot_topomap_nirs_overlap (fnirs_epochs ):
801838 """Test plotting nirs topomap with overlapping channels (gh-7414)."""
802839 fig = fnirs_epochs ["A" ].average (picks = "hbo" ).plot_topomap ()
0 commit comments