Skip to content

Commit

Permalink
debug artifact rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
arnodelorme committed Sep 22, 2022
1 parent defd179 commit 27cbae3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pop_musemonitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
{ } ...
...
{ 'style' 'checkbox' 'string' 'High pass filter at 0.5 Hz and reject bad channel with' 'tag' 'rejchan' 'value' 0 } ...
{ 'style' 'edit' 'string' '25' } ...
{ 'style' 'edit' 'string' '25' 'tag' 'rejchanstr' } ...
{ 'style' 'text' 'string' 'threshold' } ...
...
{ 'style' 'checkbox' 'string' 'High pass filter at 0.5 Hz and reject bad data (ASR) with' 'tag' 'rejdata' 'value' 0 } ...
{ 'style' 'edit' 'string' '11' } ...
{ 'style' 'edit' 'string' '11' 'tag' 'rejdatastr' } ...
{ 'style' 'text' 'string' 'threshold' } ...
{} ...
...
Expand All @@ -72,8 +72,8 @@
if res.power, options = { options{:} 'power' 'on' }; end
if res.acc, options = { options{:} 'acc' 'on' }; end
if res.importall, options = { options{:} 'importall' 'on' }; end
if ~isempty(res.rejchan), options = { options{:} 'rejchan' str2num(res.rejchan) }; end
if ~isempty(res.rejdata), options = { options{:} 'rejdata' str2num(res.data) }; end
if res.rejchan, options = { options{:} 'rejchan' str2num(res.rejchanstr) }; end
if res.rejdata, options = { options{:} 'rejdata' str2num(res.rejdatastr) }; end
else
options = varargin;
end
Expand Down Expand Up @@ -169,7 +169,9 @@
EEG.srate = opt.srate;
EEG = eeg_checkset(EEG);

if ~isempty(opt.rejchan) && ~isempty(opt.rejdata)
if EEG.pnts < 1000
fprintf(2, 'Data is too short to apply artifact rejection')
elseif ~isempty(opt.rejchan) && ~isempty(opt.rejdata)
EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion','off','ChannelCriterion',opt.rejchan,'LineNoiseCriterion',5,'Highpass',[0.25 0.75],'BurstCriterion',opt.rejdata,'WindowCriterion',0.25,'BurstRejection','on','Distance','Euclidian','WindowCriterionTolerances',[-Inf 7] );
elseif ~isempty(opt.rejchan)
EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion','off','ChannelCriterion',opt.rejchan,'LineNoiseCriterion',5,'Highpass',[0.25 0.75],'BurstCriterion','off','WindowCriterion','off','BurstRejection','off','Distance','Euclidian','WindowCriterionTolerances','off');
Expand Down

0 comments on commit 27cbae3

Please sign in to comment.