<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Titel" content="">
<meta name="Stichwörter" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:Calibri;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.E-Mail-Formatvorlage17
{mso-style-type:personal-compose;
font-family:Calibri;
color:windowtext;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0cm;
margin-bottom:.0001pt;
font-size:8.5pt;
font-family:Calibri;}
span.s1
{mso-style-name:s1;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:Calibri;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">Dear FieldTrip Community,</span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt"> </span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span class="s1"><span lang="EN-US">My name is Alexandrina Guran, I am a PhD Student at the University of Lübeck and I have recently started working with FieldTrip in order to preprocess (and later analyse) EEG data. I have encountered
an odd problem, </span></span><span lang="EN-US">that I nor people I asked in the lab could solve, also using the help function and google<span class="s1">:</span></span><span class="s1"><span style="font-family:"Times New Roman";mso-fareast-language:DE"><o:p></o:p></span></span></p>
<p class="p1"><o:p> </o:p></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">After running the epoching (trial length 5s), filtering (high-pass, low-pass and notch, for a time-frequency analysis) and downsampling (to 250 Hz), I wanted to do an automatic artifact
rejection, in order to have exploratory information of how many of my trials would be affected by artifacts and if there were participants that blinked on a majority of trials in order to determine whether I should shorten my trial length and/or conduct an
ICA.<o:p></o:p></span></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">I used the ft_artifact_threshold function, in Matlab R2016b, with different FieldTrip versions (march 2017 as well as end 2016 and end 2015).</span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">However, the automatic artifact detection did not work – that is, it would stop rejecting artifacts after a number x of trials (usually between 90 and 140 trials), depending on participant.
I would get an error message but then the artifact rejection would go on, telling me all trials were ok (even if I set 1 microvolt as a threshold).
</span><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">The error message I got is the following:<o:p></o:p></span></span></p>
<p class="p1"><o:p> </o:p></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">“(…) threshold artifact scanning: trial 128 from 320 exceeds max-threshold<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 129 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 130 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 131 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:#ED7D31">Warning: data contains NaNs, no filtering or preprocessing applied
<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:#ED7D31">> In ft_warning (line 184)<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:#ED7D31"> In preproc (line 283)<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:#ED7D31"> In ft_artifact_threshold (line 164)<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:#ED7D31"> In preprocessing (line 266)
<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 132 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 133 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 134 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 135 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 136 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 137 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 138 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 139 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 140 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 141 from 320 is ok<o:p></o:p></span></p>
<p class="p1" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt">threshold artifact scanning: trial 142 from 320 is ok (…)”</span><span lang="EN-US" style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">This was however only the case if I ran the artifact detection on down-sampled data. It worked fine with just filtered data.</span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt"> </span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">However, I checked the preprocessed (downsampled) data for NaNs (using the isnan-MATLAB function) and there were none to be found (I also checked visually in one dataset).
</span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt"> </span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">Has anyone encountered this problem and found a solution?</span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt"> </span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US" style="font-size:12.0pt">Of course, I considered just doing the downsampling after the automatic and visual artifact rejection, but I would like to be sure that the downsampling will work correctly at any point
of the preprocessing and right now I am a little flummoxed at “what is happening” with the data in that function.</span></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Down below you can find code excerpts for both the artifact rejection and the downsampling. Both were looped over participants but the error appears regardless of that.
<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Downsampling: <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE">
</span><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE">cfg = []; <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.dataset = [<span style="color:#B245F3">'tfdata_filtfilt_'</span> num2str(subj(s))
<span style="color:#B245F3">'.mat'</span>]; <span style="color:#25992D">%tfdata_filtfilt_ is the epoched and filtered data</span><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.resamplefs = 250;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.detrend =
<span style="color:#B245F3">'no'</span>;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.inputfile = [<span style="color:#B245F3">'tfdata_filtfilt_'</span> num2str(subj(s))
<span style="color:#B245F3">'.mat'</span>];<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.outputfile = [<span style="color:#B245F3">'tfdata_filt_rs_'</span> num2str(subj(s))
<span style="color:#B245F3">'.mat'</span>];<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> datatfrs = ft_resampledata(cfg) <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"><o:p> </o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Artifact rejection<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg = [];<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> config = load([<span style="color:#B245F3">'tfcfg_'</span> num2str(subj(s))
<span style="color:#B245F3">'.mat'</span>]); <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.trl = config.cfg.trl;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.continuous =
<span style="color:#B245F3">'no'</span> ; <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.artfctdef.threshold.channel = [1:28 33:63];
<span style="color:#25992D">%exclude eye channels 'VEOG1' 'VEOG2' 'HEOG1' 'HEOG2'</span><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.artfctdef.threshold.max = 75;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.artfctdef.threshold.min = -75; <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.artfctdef.threshold.bpfilter =
<span style="color:#B245F3">'no'</span>; <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.inputfile = [<span style="color:#B245F3">'tfdata_filt_rs_'</span> num2str(subj(s))
<span style="color:#B245F3">'.mat'</span>];<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg.outputfile = [<span style="color:#B245F3">'tfdata_artif_'</span> num2str(subj(s))
<span style="color:#B245F3">'.mat'</span>]; <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> cfg = ft_artifact_threshold(cfg);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:Courier;mso-fareast-language:DE"> save (cfg.outputfile,
<span style="color:#B245F3">'cfg'</span>) <o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Since I am new to FieldTrip, I can imagine it to be a “simple/stupid” error having to do with the cfg.<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Thank you for reading this and trying to help
</span><span lang="EN-US" style="font-size:12.0pt;font-family:Wingdings">J</span><span lang="EN-US" style="font-size:12.0pt">
<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Best regards<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US" style="font-size:12.0pt">Alexandrina <o:p></o:p></span></p>
<p class="p1"><span class="s1"><span lang="EN-US"> <o:p></o:p></span></span></p>
<p class="p1"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">--<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">C.-N. Alexandrina Guran, M.Sc.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">PhD student<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">Institute of Psychology I<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">University of Lübeck<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">Maria-Goeppert-Straße 9a<br>
23562 Lübeck<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">Germany<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:black">Building MFC 8, 1st Floor, Room 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Phone: +49 451 3101 3635<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Fax: +49 451 3101 3604<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>