The order in which you perform assigning a montage and adding a reference matters, which probably shouldn't be the case.
Consider the following example using the testing data from mne/io/brainvision/tests/data/test.* (the first two lines could be combined by supplying the montage argument in the call to mne.io.read_raw_brainvision):
raw = mne.io.read_raw_brainvision("test.vhdr", preload=True)
raw.set_montage("standard_1020")
raw = mne.io.add_reference_channels(raw, "T3")
This assigns the montage first and then adds a new reference channel which wasn't part of the data. This produces a RuntimeWarning: The locations of multiple reference channels are ignored (set to zero)., which results in an incorrect location of the newly added channel T3.
If instead you first add the reference channel and then set the montage, everything works as expected:
raw = mne.io.read_raw_brainvision("test.vhdr", preload=True)
raw = mne.io.add_reference_channels(raw, "T3")
raw.set_montage("standard_1020")
The order in which you perform assigning a montage and adding a reference matters, which probably shouldn't be the case.
Consider the following example using the testing data from
mne/io/brainvision/tests/data/test.*(the first two lines could be combined by supplying themontageargument in the call tomne.io.read_raw_brainvision):This assigns the montage first and then adds a new reference channel which wasn't part of the data. This produces a
RuntimeWarning: The locations of multiple reference channels are ignored (set to zero)., which results in an incorrect location of the newly added channel T3.If instead you first add the reference channel and then set the montage, everything works as expected: