lcnbeapp / beapp

The Batch Electroencephalography Automated Processing Platform (BEAPP)
Other
35 stars 23 forks source link

bad channel causing filtering to crash #4

Closed jdien07 closed 3 years ago

jdien07 commented 3 years ago

I’m working on a manuscript comparing EEG preprocessing packages and I want to make sure I’m giving BEAPP a fair test. The problem I’ve run into is that batch_beapp_prepp is turning bad channels into NaN values, which then causes happe_bandpass_cleanline_rejchan to throw an error when it tries to apply the pwelch function to that channel. I’m considering just adding a note that I was unable to apply HAPPE (which includes cleanline filtering) due to a bug but thought I’d give you a chance to provide a fix first. Or maybe I'm just doing something wrong?

This is with Matlab 2020a running under Linux, with the 11/16/20 version of beapp. This is with the eeglab2020_0 version of eeglab but had the same issue with the included eeglab14 version.

....Error using pwelch Expected x to be finite. Error in welchparse>parse_inputs (line 94) validateattributes(x2,{'single','double'}, {'finite','nonnan'},'pwelch','x') Error in welchparse (line 31) parse_inputs(x1,esttype,varargin{:}); Error in welch (line 43) welchparse(x,esttype,varargin{:}); Error in pwelch (line 172) [welchOut{1:nargout}] = welch(x,esttype,args{:}); Error in spectopo>spectcomp (line 928) [tmpspec,freqs] = pwelch(matsel(tmpdata,frames,0,1,e),... Error in spectopo (line 334) [eegspecdB freqs specstd] = spectcomp( data, frames, srate, epoch_subset, g); Error in pop_spectopo (line 320) eval(com) Error in pop_rejchan (line 136) [measure freq] = pop_spectopo(EEG, 1, [], 'EEG' , 'plot','off'); Error in happe_bandpass_cleanline_rejchan (line 68) EEG_tmp = pop_rejchan(EEG_tmp, 'elec',[1:length(chan_IDs)],'threshold',[-3 3],'norm','on','measure','spec','freqrange',[1 125]); Error in batch_beapp_ica (line 129) [EEG_tmp, full_selected_channels,file_proc_info.beapp_filt_max_freq] = happe_bandpass_cleanline_rejchan (EEG_orig,chan_IDs,... Error in beapp_main (line 196) grp_proc_info_main = batch_beapp_ica(grp_proc_info_main); Error in testMAAC (line 241) beapp_main(grp_proc_info)

lcnbeapp commented 3 years ago

Thank you for letting us know about this and for giving us a chance to respond. It seems like HAPPE is not being run properly--HAPPE automatically includes cleanline filtering as part of the pipeline, so you should not be running the PREP pipeline or a cleanline filter separately when running HAPPE through BEAPP. The supplementary material in our paper on BEAPP includes the modules and functions that should be toggled when running HAPPE on BEAPP. You can use this to double-check that HAPPE is being run properly. In this case, make sure to turn off PREPP and to run a 1-100 Hz bandpass filter rather than cleanline in the Filter module.

Let us know if this helps you run BEAPP properly, or if you run into any other problems. Thanks!

jdien07 commented 3 years ago

Thanks for the quick response! That fixed the problem.