EEG reference in MNE-objects

External Email - Use Caution

Thanks for the reference to add_reference_channels()..
This one is handy, but it does not add reference info either.

According to the doc, reference position should be stored with each channel individually in info['chs']['loc']:

loc - array, shape (12,)
Channel location. For MEG this is the position plus the normal given by a 3x3 rotation matrix. For EEG this is the position followed by reference position (with 6 unused). The values are specified in device coordinates for MEG and in head coordinates for EEG channels, respectively.

Yet after loading my data, ref locations for all channels are default [0, 0, 0] and there seems to be no dedicated function to update the variable.
in my case loc is also not modified by mne.add_reference_channels() (I set standard montage information, but no exact digitization points).
Info['custom_ref_applied'] is modified, but just a Boolean with no further information about the reference.

I did some digging in the code (mne/io/reference.py) and found that my case is simply not implemented.
add_reference_channels() only updates ref locations if digitization points are present, not if only a montage was set. There is a note on this:
# we should actually be able to do this from the montage, but
# it looks like the montage isn't stored, so we can't extract
# this information. The user will just have to call set_montage()
# by setting this to zero, we fall back to the old behavior
# when missing digitization
    
Nevermind..
I can see that having specific ref channel information in the object is often not too relevant.
I will open an enhancement issue on github and live with it __

thanks for your comments Eric!
Dominik

External Email - Use Caution

it's very possible that ref loc is not set properly everywhere as this
aspect of the FIF
spec was realised after the first work on EEG reference was started in
MNE-Python

please open an issue on github with a code snippet to replicate potential bug.

thanks
Alex