# Channel location not correctly recognized when adding two reference channels using \`add\_reference\_channels\`

**URL:** <https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127>\
**Category:** Support & Discussions\
**Created:** [April 24, 2025, 4:45pm UTC](https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127 "2025-04-24T16:45:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaohanch](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/chaohanch/32/3524_2.png) [@chaohanch](https://mne.discourse.group/u/chaohanch)\
**Post date:** [April 24, 2025, 4:45pm UTC](https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127/1 "2025-04-24T16:45:51Z")

</div>

- MNE version: 1.9.0
- operating system: macOS 15

Hello,

I was trying to add two reference channels. But it looks like the channel locations are not correctly loaded when I add the two reference channels together by `mne.add_reference_channels(raw, ref_channels = ['TP9', 'TP10'])` (both channels show up at the location of `TP10`.):

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/5/56753bfd8aa5c3ed71175ee95c52a987c3f45c47.png)

But if I add the two channels sequentially by  
`mne.add_reference_channels(raw, ref_channels = ['TP9'])`  
`mne.add_reference_channels(raw, ref_channels = ['TP10'])`  
the channel locations are correct:

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/2/295dff7c8d98ff424e7b3a3d433b34e2e99f7bc9.png)

I wonder if if it’s a bug or did I miss something?

Thank you!

Here is the code snipeets to reproduce the figures:

```python

# load data
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, verbose=False, preload=True)

# Apply a template montage directly, without preloading
ssvep_raw.set_montage("easycap-M1")
# remove TP9 and TP10
ssvep_raw.drop_channels(['TP9', 'TP10'])

# add 2 reference channels together
raw1 = mne.add_reference_channels(ssvep_raw, ref_channels = ['TP9', 'TP10'])
raw1.set_montage("easycap-M1")
fig = raw1.plot_sensors(show_names=True)

# add 2 reference channels separately
raw2 = mne.add_reference_channels(ssvep_raw, ref_channels = ['TP9'])
raw2 = mne.add_reference_channels(raw2, ref_channels = ['TP10'])
raw2.set_montage("easycap-M1")
fig = raw2.plot_sensors(show_names=True)

```

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [April 25, 2025, 12:44pm UTC](https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127/2 "2025-04-25T12:44:18Z")

</div>

Hello @chaohanch and welcome to the forum! This seems like a bug to me … I’ll try to reproduce and report back.

Richard

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [April 25, 2025, 1:04pm UTC](https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127/3 "2025-04-25T13:04:16Z")

</div>

I’ve reported the issue on the GitHub issue tracker:

> <https://github.com/mne-tools/mne-python/issues/13229>
>
> \### Description of the problem
> 
> Reported on the forum:
> https://mne.discourse.gro…up/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
> 
> \`\`\`Python
> \# %%
> 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
> 
> !\[Image\](https://github.com/user-attachments/assets/d14d3d1f-94c4-4349-a059-6410b638db69)
> 
> \### Actual results
> 
> !\[Image\](https://github.com/user-attachments/assets/1fe82e9f-f025-4152-a36c-0bd0ae945763)
> 
> \### 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

---

<div class="post-metadata">

**Author:** ![chaohanch](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/chaohanch/32/3524_2.png) [@chaohanch](https://mne.discourse.group/u/chaohanch)\
**Post date:** [April 25, 2025, 3:10pm UTC](https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127/4 "2025-04-25T15:10:31Z")

</div>

Thank you for reporting this!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 2, 2025, 3:10pm UTC](https://mne.discourse.group/t/channel-location-not-correctly-recognized-when-adding-two-reference-channels-using-add-reference-channels/11127/5 "2025-05-02T15:10:43Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
