-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description of the problem
Reported on the forum:
https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127
When calling add_reference_channels() with two channel names and subsequently setting a montage, both reference channels will be placed in the exact same location (which is only correct for one of the channels):
Doing two separate calls to add_reference_channels() instead (i.e., one per channel) yields the expected behavior.
Steps to reproduce
# %%
import mne
ssvep_folder = mne.datasets.ssvep.data_path()
ssvep_data_raw_path = (
ssvep_folder / "sub-02" / "ses-01" / "eeg" / "sub-02_ses-01_task-ssvep_eeg.vhdr"
)
ssvep_raw = mne.io.read_raw_brainvision(
ssvep_data_raw_path, preload=True, verbose=False
)
# Add ref channels in single call
ssvep_raw.drop_channels(["TP9", "TP10"])
ssvep_raw.add_reference_channels(["TP9", "TP10"])
ssvep_raw.set_montage("easycap-M1")
fig = ssvep_raw.plot_sensors(show_names=True)
# Add ref channels in separate calls
ssvep_raw.drop_channels(["TP9", "TP10"])
ssvep_raw.add_reference_channels("TP9")
ssvep_raw.add_reference_channels("TP10")
ssvep_raw.set_montage("easycap-M1")
fig = ssvep_raw.plot_sensors(show_names=True)Link to data
No response
Expected results
Actual results
Additional information
Platform macOS-15.4.1-arm64-arm-64bit
Python 3.12.8 (main, Dec 6 2024, 19:42:06) [Clang 18.1.8 ]
Executable /Users/richardhochenberger/Development/mne-python/.venv/bin/python
CPU Apple M2 Pro (10 cores)
Memory 32.0 GiB
Core
├☑ mne 1.10.0.dev96+gc18908cb6 (devel, latest release is 1.9.0)
├☑ numpy 2.2.5 (unknown linalg bindings)
├☑ scipy 1.15.2
└☑ matplotlib 3.10.1 (backend=module://matplotlib_inline.backend_inline)
Numerical (optional)
├☑ sklearn 1.6.1
├☑ numba 0.61.2
├☑ nibabel 5.3.2
├☑ nilearn 0.11.1
├☑ dipy 1.11.0
├☑ openmeeg 2.5.15
├☑ pandas 2.2.3
├☑ h5io 0.2.5
├☑ h5py 3.13.0
└☐ unavailable cupy
Visualization (optional)
├☑ pyvista 0.45.0 (OpenGL 4.1 Metal - 89.4 via Apple M2 Pro)
├☑ pyvistaqt 0.11.2
├☑ vtk 9.4.2
├☑ qtpy 2.4.3 (PyQt6=6.9.0)
├☑ ipympl 0.9.7
├☑ pyqtgraph 0.13.7
├☑ mne-qt-browser 0.7.1
├☑ ipywidgets 8.1.6
├☑ trame_client 3.8.0
├☑ trame_server 3.4.0
├☑ trame_vtk 2.8.15
└☑ trame_vuetify 3.0.1
Ecosystem (optional)
├☑ neo 0.14.1
├☑ eeglabio 0.0.3
├☑ edfio 0.4.8
├☑ mffpy 0.10.0
├☑ pybv 0.7.6
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline

