[Mne_analysis] EEG reference in MNE-objects

Welke, Dominik dominik.welke at ae.mpg.de
Fri Mar 13 08:43:06 EDT 2020
Search archives:

        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



>    Can you see if this answers your question?
>    
>    https://mne.tools/dev/auto_tutorials/preprocessing/plot_55_setting_eeg_reference.html#setting-or-changing-the-reference-channel
>    
>    Eric
    
    
    





More information about the Mne_analysis mailing list