[Eeglablist] Inconsistent results using clean_artifacts

Delorme, Arnaud adelorme at ucsd.edu
Wed Apr 22 08:05:16 PDT 2020


Dear Yarden,

Yes, looking forward to see the script. If you can make it self contained (no need to reload or do manipulations) that would be great though (I just run the script and it clearly demonstrate the problems). Will save time and potential confusion.

Cheers,

Arno

> On Apr 22, 2020, at 5:06 AM, Yarden Ben Horin <benhoriy at post.bgu.ac.il> wrote:
> 
> Dear  Arno,
> 
> First I wish to apologize for my late (very late) response. I'll provide you  with one of our subject dataset and the code we use. 
> Also, we continued to debug this issue on our side and we think we got some insights. 
> 
> In the attached archive file you may find a subject dataset and our wrapping function that calls clean_artifacts. Please note that this function also calculates a signal to noise ratio and adds it along with clean_artifacts' eliminated channels list to the EEG.etc struct. (we have found it helpful when checking the ASR results.)
> For recreate the inconsistent issue, please run the following:
> eeglab
> % load the dataset file
> [EEG, EEG_org, SNR, eliminatedChannels, signal, noise] = ASRCleaning (EEG, ALLEEG, CURRENTSET, 15, 1); 
> 
> Before running the dataset through ASRCleaning a second time, please clear the matlab environment, and load the dataset file again.
> 
> As I wrote at the beginning, after a few days of messing with this issue, we managed to work something out.
> We have noticed that one of clean_artifacts sub functions "clean_channels" uses rand(). Once we run "rng(0);" prior to calling our ASRCleaning function, we get consistent results at each run.
> We believe this work around will do for us and we can go back to our data analysis. 
> Though we are wondering if this is the desirable solution. Might we run into this issue because of our matlab version (R2018a)? Or is this the expected results when working with "clean_channels"?
> 
> Thanks a lot.
> Yarden.  
> 
> 
> ‫בתאריך יום ג׳, 14 באפר׳ 2020 ב-23:48 מאת ‪Delorme, Arnaud‬‏ <‪adelorme at ucsd.edu‬‏>:‬
> Dear Yarden,
> 
> I have tried to use only the ChannelCriterion. I have run this rejection only on the tutorial dataset (rejecting 17 channels) and I obtained the exact same result 20 times in a row.
> 
> EEGNEW = clean_artifacts(EEG, 'FlatlineCriterion','off','ChannelCriterion',0.98,'LineNoiseCriterion','off','Highpass','off','BurstCriterion','off','WindowCriterion','off','BurstRejection','off','Distance','Euclidian’);
> 
> Would you mind to share a dataset and the exact command you use that create problems.
> 
> Best wishes,
> 
> Arno
> 
> > On Apr 11, 2020, at 11:32 AM, Yarden Ben Horin <benhoriy at post.bgu.ac.il> wrote:
> > 
> > Dear Arno,
> > 
> > Thank you for your reply. First of all, we made sure we all work with the latest versions of eeglab and clean_rawdata. (you may find a snippet from eeglab loading below.)
> > We had continued digging into the problem and found that the option that causes the inconsistent results is 'ChannelCriterion'  ("min acceptable correlation between nearby channels"). When we set it to 0.8 the clean_artifacts start behaving randomly (removing different channels at every run). We turned this option off and it seems that  clean_artifacts works as expected, though we would like to use this feature.
> > 
> > One more thing. Before we use clean_artifacts we run:
> > EEG = pop_rmdat( EEG, {'3' '8' '9'},[-4 0.06] ,0); % cutting data by event
> > 
> > and we get the following output:
> > eeg_insertbound(): 99 boundary (break) events added.
> > eeg_checkset note: upper time limit (xmax) adjusted so (xmax-xmin)*srate+1 = number of frames
> > Warning: converting all event types to strings
> > eeg_insertbound(): 99 boundary (break) events added.
> > BUG 1971 WARNING: IF YOU ARE USING A SCRIPT WITTEN FOR A PREVIOUS VERSION OF EEGLAB (<2017)
> > TO CALL THIS FUNCTION, BECAUSE YOU ARE REJECTING THE ONSET OF THE DATA, EVENTS MIGHT HAVE
> > BEEN CORRUPTED. EVENT LATENCIES ARE NOW CORRECT (SEE https://sccn.ucsd.edu/wiki/EEGLAB_bug1971);
> > 
> > When we run clean_artifacts just after and turn 'ChannelCriterion' on we get some warnings (I removed "clean_channel:   1/79 blocks, 0.1 minutes remaining." rows):   
> > Scanning for bad channels...
> > clean_channel:   1/79 blocks, 0.1 minutes remaining.
> > ...
> > clean_channel:  79/79 blocks, 0.0 minutes remaining.
> > Removing 5 channel(s)...
> > Finding a clean section of the data...
> > Determining time window rejection thresholds...done.
> > Keeping 34.3% (137 seconds) of the data.
> > eeg_insertbound(): 99 boundary (break) events added.
> > eeg_insertbound(): event latencies recomputed and 203 events removed.
> > eeg_checkset note: upper time limit (xmax) adjusted so (xmax-xmin)*srate+1 = number of frames
> > Warning: duplicate boundary event removed
> > eeg_insertbound(): 99 boundary (break) events added.
> > eeg_insertbound(): event latencies recomputed and 206 events removed.
> > BUG 1971 WARNING: IF YOU ARE USING A SCRIPT WITTEN FOR A PREVIOUS VERSION OF EEGLAB (<2017)
> > TO CALL THIS FUNCTION, BECAUSE YOU ARE REJECTING THE ONSET OF THE DATA, EVENTS MIGHT HAVE
> > BEEN CORRUPTED. EVENT LATENCIES ARE NOW CORRECT (SEE https://sccn.ucsd.edu/wiki/EEGLAB_bug1971);
> > Warning: Discrepency when recomputing event latency.
> > Try to reproduce the problem and send us your dataset 
> > > In eeg_eegrej (line 173)
> >   In pop_select (line 553)
> >   In clean_windows (line 137)
> >   In clean_asr (line 146)
> >   In clean_artifacts (line 233)
> >   In Utils.DS.ASRCleaning (line 9)
> >   In Pipeline (line 101) 
> > Warning: Inconsistency in boundary event duration.
> > Try to reproduce the problem and send us your dataset 
> > > In eeg_eegrej (line 188)
> >   In pop_select (line 553)
> >   In clean_windows (line 137)
> >   In clean_asr (line 146)
> >   In clean_artifacts (line 233)
> >   In Utils.DS.ASRCleaning (line 9)
> >   In Pipeline (line 101) 
> > Estimating calibration statistics; this may take a while...
> > Determining per-component thresholds...done.
> > Now cleaning data in 25 blocks.........................
> > Use vis_artifacts to compare the cleaned data to the original.
> > 
> > 
> >  Hope this helps, and have a great weekend.
> > Yarden.
> > 
> > 
> > eeglab loading:
> > 
> > [ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
> > Some menus items hidden. Use Preference menu to show them all.
> > eeglab: options file is C:\Users\Yarden\eeg_options.m
> > Retrieving plugin versions from server...
> > Retreiving download statistics...
> > EEGLAB: adding "CleanLine" v1.04 (see >> help eegplugin_cleanline)
> > EEGLAB: adding "ICLabel" v1.2.5 (see >> help eegplugin_iclabel)
> > EEGLAB: adding "biosig4octmat-" to the path; subfolders (if any) might be missing from the path
> > EEGLAB: adding "clean_rawdata" v2.1 (see >> help eegplugin_clean_rawdata)
> > EEGLAB: adding "dipfit" v3.3 (see >> help eegplugin_dipfit)
> > EEGLAB: adding "firfilt" v2.4 (see >> help eegplugin_firfilt)
> > You are using the latest version of EEGLAB.
> > 
> > 
> > 
> >       בלי וירוסים. https://urldefense.com/v3/__http://www.avast.com__;!!Mih3wA!Vz75aa3yKoOZ7KzJBdO4I85U6NZOf3hv3aLgT99DZpIviNoVwvg66Km0GI-TeRHC1wQKhA$  [avast.com]
> > 
> > ‫בתאריך יום ה׳, 9 באפר׳ 2020 ב-10:26 מאת ‪Delorme, Arnaud‬‏ <‪adelorme at ucsd.edu‬‏>:‬
> > Dear Yarden,
> > 
> > Are you sure you are using the latest version of the clean_rawdata (v2.1) https://urldefense.com/v3/__https://github.com/sccn/clean_rawdata__;!!Mih3wA!Vz75aa3yKoOZ7KzJBdO4I85U6NZOf3hv3aLgT99DZpIviNoVwvg66Km0GI-TeRHxrNLHdQ$  [github.com]
> > Slight difference due to memory available has been removed by default in this version.
> > 
> > Let us know. I have just tried ASR with this version twice on the same dataset and got identical results.
> > 
> > EEG2 = clean_artifacts(EEG, 'FlatlineCriterion','off','ChannelCriterion','off','LineNoiseCriterion','off','Highpass','off','BurstCriterion',20,'WindowCriterion','off','BurstRejection','on','Distance','Euclidian');
> > Tmp = rand(10000,10000); % reserve 80Mb of memory
> > EEG3 = clean_artifacts(EEG, 'FlatlineCriterion','off','ChannelCriterion','off','LineNoiseCriterion','off','Highpass','off','BurstCriterion',20,'WindowCriterion','off','BurstRejection','on','Distance','Euclidian');
> > isequal(EEG2, EEG3)
> > 
> > 1
> > 
> > Best wishes,
> > 
> > Arno
> > 
> > > On Apr 6, 2020, at 2:28 PM, John Johnson <john.johnson at gatech.edu> wrote:
> > > 
> > > Hello Yarden,
> > > 
> > > ASR's processing depends on the amount of available memory on the computer it is running on.
> > > To obtain more consistent results, you can specify the amount of memory it should use.
> > > More here:
> > > https://sccn.ucsd.edu/wiki/Artifact_Subspace_Reconstruction_(ASR)#The_option_.27availableRAM_GB.27_is_available_to_fix_the_length_of_final_output.
> > > 
> > > Regards,
> > > John
> > > 
> > > 
> > > On 6 Apr 2020, at 7:37, Yarden Ben Horin wrote:
> > > 
> > >> Hi all,
> > >> 
> > >> My colleagues and I ran into a very strange problem while using eeglab
> > >> plugin clean_rawData.
> > >> We tried to use the clean_artifacts function to clean our data, but we got
> > >> inconsistent result at each run. By inconsistent, the meaning is that
> > >> different numbers of channels were removed from the data.
> > >> 
> > >> The code:
> > >> EEG_clean = clean_artifacts(EEG,
> > >> 'FlatlineCriterion',5,'ChannelCriterion',0.8,'LineNoiseCriterion',4,'Highpass','off','BurstCriterion',20,'WindowCriterion','off','BurstRejection','off','Distance','Euclidian');
> > >> 
> > >> We merely used EEG = pop_eegfiltnew(EEG, 'locutoff',4,'plotfreqz',0);
> > >> before running clean_artifacts. We ran the code on several computers (all
> > >> with the latest versions  of eeglab and clean_rawData), and each run on the
> > >> same dataset produced different result (even on the same computer.)
> > >> 
> > >> Does clean_artifacts, or one of its sub functions, not
> > >> deterministic function?
> > >> 
> > >> Hopefully you could help us with this frustrating situation.
> > >> Many thanks,
> > >> Yarden Ben Horin.
> > >> 
> > >> 
> > >> <https://urldefense.com/v3/__https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail__;!!Mih3wA!Vz75aa3yKoOZ7KzJBdO4I85U6NZOf3hv3aLgT99DZpIviNoVwvg66Km0GI-TeRHXsLTf2A$  [avast.com]>
> > >> בלי
> > >> וירוסים. https://urldefense.com/v3/__http://www.avast.com__;!!Mih3wA!Vz75aa3yKoOZ7KzJBdO4I85U6NZOf3hv3aLgT99DZpIviNoVwvg66Km0GI-TeRHC1wQKhA$  [avast.com]
> > >> <https://urldefense.com/v3/__https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail__;!!Mih3wA!Vz75aa3yKoOZ7KzJBdO4I85U6NZOf3hv3aLgT99DZpIviNoVwvg66Km0GI-TeRHXsLTf2A$  [avast.com]>
> > >> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> > >> _______________________________________________
> > >> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> > >> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> > >> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
> > > _______________________________________________
> > > Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> > > To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> > > For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
> > 
> > _______________________________________________
> > Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> > To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> > For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
> > 
> >       בלי וירוסים. https://urldefense.com/v3/__http://www.avast.com__;!!Mih3wA!Vz75aa3yKoOZ7KzJBdO4I85U6NZOf3hv3aLgT99DZpIviNoVwvg66Km0GI-TeRHC1wQKhA$  [avast.com]
> 
> <inconsistent_issue.zip>




More information about the eeglablist mailing list