[Eeglablist] Error in deprecated EEG.ref flag value

Curtis Bingham cnbingham at gmail.com
Fri Jun 18 10:24:15 PDT 2021



There is a persistent error in handling the flag for average referenced EEG data, stored in EEG.ref. 

EEG.ref  is set to ‘average’ and a number of code segments are acting upon what appears to be a deprecated ‘averef’ value.


The file averef.m has the disclaimer at the top saying “Note that this old function is not being used in EEGLAB. The function used by EEGLAB is reref().” 


The function reref() in file reref.m accepts a varargin key pair ‘averef’ but sets the elocs(x).ref field to ‘average’ on line 217 (and not ‘averef’). 


This creates problems in ICL_feature_extractor.m on line 15 (called from iclabel), where it checks to see if you’re dealing with an average reference (EEG.ref = ‘averef’) and if not, it then unnecessarily rereferences the data by calling pop_reref() on line 16. The test in ICL_feature_extractor on line 15 should read “if ~strcmp(EEG.ref, 'average')” instead of “averef’.


A search for ‘averef’ in the EEGLAB distribution shows a number of hits, some using it as a varargin input, some actually erroneously setting EEG.ref to ‘averef’ (pop_biosig16.m:261), some correcting the deprecated value, etc. 


It appears that eeg_checkset will correct this deprecated value on line 1039. 


It shouldn’t be too much effort to go through and standardize the application of ‘average’ and put in a handful of try/catches to ensure none get through the cracks.








More information about the eeglablist mailing list