Skip to content

Commit 3d7722f

Browse files
authored
FIX: Fix add_reference_channels for passing two channels names (#13466)
1 parent e50d565 commit 3d7722f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

doc/changes/dev/13466.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug with :func:`mne.add_reference_channels` not working correctly when passing more than one channel name, by `Michael Straube`_.

mne/_fiff/reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def add_reference_channels(inst, ref_channels, copy=True):
316316
"unit_mul": FIFF.FIFF_UNITM_NONE,
317317
"unit": FIFF.FIFF_UNIT_V,
318318
"coord_frame": FIFF.FIFFV_COORD_HEAD,
319-
"loc": ref_dig_array,
319+
"loc": ref_dig_array.copy(),
320320
}
321321
inst.info["chs"].append(chan_info)
322322
inst.info._update_redundant()

mne/_fiff/tests/test_reference.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,10 @@ def test_add_reference():
744744
ref_data, _ = raw[[ref_idx, ref_idy]]
745745
assert_array_equal(ref_data, 0)
746746

747+
loc1 = raw.info["chs"][ref_idx]["loc"]
748+
loc2 = raw.info["chs"][ref_idy]["loc"]
749+
assert loc1 is not loc2
750+
747751
# add reference channel to epochs
748752
raw = read_raw_fif(fif_fname, preload=True)
749753
events = read_events(eve_fname)

0 commit comments

Comments
 (0)