@@ -54,17 +54,16 @@ pop_editoptions( 'option_storedisk', 1); % only one dataset in memory at a time
5454ALLEEG = pop_select( ALLEEG,'rmchannel',{'EXG1','EXG2','EXG3','EXG4','EXG5','EXG6','EXG7','EXG8', 'GSR1', 'GSR2', 'Erg1', 'Erg2', 'Resp', 'Plet', 'Temp'}); 
5555
5656% compute average reference 
57- ALLEEG = pop_reref( ALLEEG,[]); 
57+ ALLEEG = pop_reref( ALLEEG,  []); 
5858
5959% clean data using the clean_rawdata plugin 
6060ALLEEG = pop_clean_rawdata( ALLEEG,'FlatlineCriterion',5,'ChannelCriterion',0.87, ... 
6161    'LineNoiseCriterion',4,'Highpass',[0.25 0.75] ,'BurstCriterion',20, ... 
6262    'WindowCriterion',0.25,'BurstRejection','on','Distance','Euclidian', ... 
6363    'WindowCriterionTolerances',[-Inf 7] ,'fusechanrej',1); 
6464
65- % recompute average reference interpolating missing channels (and removing 
66- % them again after average reference - STUDY functions handle them automatically) 
67- ALLEEG = pop_reref( ALLEEG,[],'interpchan',[]); 
65+ % recompute average reference 
66+ ALLEEG = pop_reref( ALLEEG,[]); 
6867
6968% run ICA reducing the dimension by 1 to account for average reference  
7069plugin_askinstall('picard', 'picard', 1); % install Picard plugin 
@@ -74,6 +73,14 @@ ALLEEG = pop_runica(ALLEEG, 'icatype','picard','concatcond','on','options',{'pca
7473ALLEEG = pop_iclabel(ALLEEG, 'default'); 
7574ALLEEG = pop_icflag( ALLEEG,[NaN NaN;0.9 1;0.9 1;NaN NaN;NaN NaN;NaN NaN;NaN NaN]); 
7675
76+ % Optional: remove flagged ICA components (otherwise done at the STUDY level), then recompute the   
77+ % average reference using the Huber method interpolating missing channels (and removing them again  
78+ % after average reference). See tutorial section 5.b. 
79+ if 0 
80+     ALLEEG = pop_subcomp(ALLEEG, []); 
81+     ALLEEG = pop_reref( ALLEEG,[],'huber', 25, 'interpchan',[]); 
82+ end 
83+ 
7784% extract data epochs 
7885ALLEEG = pop_epoch( ALLEEG,{'oddball_with_reponse','standard'},[-1 2] ,'epochinfo','yes'); 
7986ALLEEG = eeg_checkset( ALLEEG ); 
@@ -123,7 +130,7 @@ pop_editoptions( 'option_storedisk', 1); % only one dataset in memory at a time
123130ALLEEG = pop_select( ALLEEG,'rmchannel',{'EXG1','EXG2','EXG3','EXG4','EXG5','EXG6','EXG7','EXG8', 'GSR1', 'GSR2', 'Erg1', 'Erg2', 'Resp', 'Plet', 'Temp'}); 
124131
125132% compute average reference 
126- ALLEEG = pop_reref( ALLEEG,[]); 
133+ ALLEEG = pop_reref( ALLEEG,  []); 
127134
128135% clean data using the clean_rawdata plugin 
129136ALLEEG = pop_clean_rawdata( ALLEEG,'FlatlineCriterion',5,'ChannelCriterion',0.87, ... 
@@ -133,7 +140,7 @@ ALLEEG = pop_clean_rawdata( ALLEEG,'FlatlineCriterion',5,'ChannelCriterion',0.87
133140
134141% recompute average reference interpolating missing channels (and removing 
135142% them again after average reference - STUDY functions handle them automatically) 
136- ALLEEG = pop_reref( ALLEEG,[],'interpchan', []); 
143+ ALLEEG = pop_reref( ALLEEG,  []); 
137144
138145% run ICA reducing the dimension by 1 to account for average reference  
139146plugin_askinstall('picard', 'picard', 1); % install Picard plugin 
@@ -143,6 +150,14 @@ ALLEEG = pop_runica(ALLEEG, 'icatype','picard','concatcond','on','options',{'pca
143150ALLEEG = pop_iclabel(ALLEEG, 'default'); 
144151ALLEEG = pop_icflag( ALLEEG,[NaN NaN;0.9 1;0.9 1;NaN NaN;NaN NaN;NaN NaN;NaN NaN]); 
145152
153+ % Optional: remove flagged ICA components (otherwise done at the STUDY level), then recompute the   
154+ % average reference using the Huber method interpolating missing channels (and removing them again  
155+ % after average reference). See tutorial section 5.b. 
156+ if 0 
157+     ALLEEG = pop_subcomp(ALLEEG, []); 
158+     ALLEEG = pop_reref( ALLEEG,[],'huber', 25, 'interpchan',[]); 
159+ end 
160+ 
146161% extract data epochs 
147162% this is not necessary if you have resting state data or eyes open 
148163% eyes closed data, you need to define the design in the STUDY 
0 commit comments