<div dir="ltr">Hi Maximilien and Florian,<div><br></div><div>Thank for letting us know. I can reproduce your problem and the problem relies in an unfortunate combination of fieldtrip defaults in some functions. The issue starts with the cfg.artfctdef.eog.fltpadding default which is 0.1. This parameter introduces a 0.1s padding with NaNs (line 301 in ft_artifact_zvalue) and the private function preproc.m does not filter the data because it contains NaNs. For now, set explicitly cfg.artfctdef.eog.fltpadding = 0; to carry on while we fix it:</div><div><br></div><div><div>cfg=[];</div><div>cfg.artfctdef.eog            = [];</div><div>cfg.artfctdef.eog.bpfilter   = 'yes';</div><div>cfg.artfctdef.eog.bpfilttype = 'but';</div><div>cfg.artfctdef.eog.bpfreq     = [8 10];</div><div>cfg.artfctdef.eog.bpfiltord  = 4;</div><div><br></div><div>cfg.artfctdef.eog.channel       = 'MLF22';</div><div>cfg.artfctdef.eog.trlpadding    = 0;</div><div>cfg.artfctdef.eog.fltpadding    = 0;</div><div>cfg.artfctdef.eog.interactive   = 'yes';</div><div>cfg.artfctdef.eog.cutoff        = 2.5;</div><div><br></div><div>[cfg, artifact]      = ft_artifact_eog(cfg,data);</div></div><div><br></div><div>You can follow the development of the issue here: <a href="http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3193">http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3193</a></div><div><br></div><div>Best,</div><div><br></div><div>Diego</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 October 2016 at 14:36, Florian Gerard-Mercier <span dir="ltr"><<a href="mailto:florian@brain.riken.jp" target="_blank">florian@brain.riken.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Dear all,<div><br></div><div>Note that I encountered the same problem (absence of intended filtering) when using high-level ft_preprocessing function (I talked about it in a a precedent email).</div><div>I solved the problem by doing the filtering separately, as a first step, and using the low-level ft_preprocbandstopfilter function.</div><div>Anyway I needed access to the data in an unstructured format (i.e. just a matrix, easy to manipulate), so in the end this low-level function fitted my needs better.</div><div><br></div><div>All the best,</div><div><br><div>
<span class="m_3005620692593643864Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>Florian</div></span>

</div>
<br><div><blockquote type="cite"><span class=""><div>On 26 Oct, 2016, at 9:27 PM, Maximilien Chaumon <<a href="mailto:maximilien.chaumon@gmail.com" target="_blank">maximilien.chaumon@gmail.com</a>> wrote:</div><br class="m_3005620692593643864Apple-interchange-newline"></span><div><div dir="ltr"><span class="">Thank you Diego for your quick reply.<div>Whether or not I include those filter parameters explicitly does not change anything.</div><div>This is what i have now:</div><div><br></div><div><div><span style="font-family:monospace">        cfg.artfctdef.eog               = [];</span><br></div><div><font face="monospace"> </font><span style="font-family:monospace">        cfg.artfctdef.eog.bpfilter   = 'yes';</span></div><div><font face="monospace">        cfg.artfctdef.eog.bpfilttype = 'but';</font></div><div><font face="monospace">        cfg.artfctdef.eog.bpfreq     = [1 15];</font></div><div><font face="monospace">        cfg.artfctdef.eog.bpfiltord  = 4;</font></div><br class="m_3005620692593643864inbox-inbox-Apple-interchange-newline"><div><font face="monospace">       cfg.artfctdef.eog.channel       = eogchans;</font></div><div><font face="monospace">        cfg.artfctdef.eog.trlpadding    = 0;</font></div><div><font face="monospace">        cfg.artfctdef.eog.interactive   = 'yes';</font></div><div><font face="monospace">        cfg.artfctdef.eog.cutoff        = 2.5;</font></div><div><font face="monospace">        </font></div><div><font face="monospace">        [cfg, artifact{iC,iD}]      = ft_artifact_eog(cfg,data);</font></div></div><div><font face="monospace"><br></font></div><div><font face="monospace"><br></font></div><div>but the resulting interactive window looks like this:</div><div><br></div><div><br></div></span><div><div class="h5"><div>Seems like the preprocessing step isn't applied... any clue why that is?</div><div><br></div><br><div class="gmail_quote"><div dir="ltr">Le mer. 26 oct. 2016 à 11:35, Diego Lozano-Soldevilla <<a href="mailto:dlozanosoldevilla@gmail.com" target="_blank">dlozanosoldevilla@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_3005620692593643864gmail_msg">Dear Maximilien,<div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg">You should specify the filter parameters in the cfg:</div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg"><pre style="padding:0.5em;margin-top:0px;margin-bottom:1em;font-size:12px;border:1px dashed rgb(204,204,204);overflow:hidden;font-family:consolas,'andale mono',menlo,monaco,monospace;background-color:rgb(247,249,250);white-space:pre-wrap;width:640px;text-align:justify" class="m_3005620692593643864gmail_msg">    cfg.artfctdef.eog.bpfilter   = 'yes'
   cfg.artfctdef.eog.bpfilttype = 'but';% or any other filter type you want to use, see help ft_preprocessing for more details
    cfg.artfctdef.eog.bpfreq     = [1 15]
    cfg.artfctdef.eog.bpfiltord  = 4; % goes hand-by-hand with the filter type; see <br class="m_3005620692593643864gmail_msg"></pre></div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg">Take a look to the fft_artifact_eog.m documentation. To know more about filtering you might want to take a look here:</div><div class="m_3005620692593643864gmail_msg"><a href="http://www.fieldtriptoolbox.org/example/determine_the_filter_characteristics" class="m_3005620692593643864gmail_msg" target="_blank">http://www.fieldtriptoolbox.<wbr>org/example/determine_the_<wbr>filter_characteristics</a><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg">Best,</div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg">Diego</div></div><div class="gmail_extra m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"><div class="gmail_quote m_3005620692593643864gmail_msg"></div></div><div class="gmail_extra m_3005620692593643864gmail_msg"><div class="gmail_quote m_3005620692593643864gmail_msg">On 26 October 2016 at 10:42, Maximilien Chaumon <span dir="ltr" class="m_3005620692593643864gmail_msg"><<a href="mailto:maximilien.chaumon@gmail.com" class="m_3005620692593643864gmail_msg" target="_blank">maximilien.chaumon@gmail.com</a>></span> wrote:<br class="m_3005620692593643864gmail_msg"></div></div><div class="gmail_extra m_3005620692593643864gmail_msg"><div class="gmail_quote m_3005620692593643864gmail_msg"><blockquote class="gmail_quote m_3005620692593643864gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_3005620692593643864gmail_msg">Dear all,<div class="m_3005620692593643864gmail_msg">when attempting to detect blinks automatically on a continuous recording without EOGs, I use a few frontal sensors and ft_artifact_eog as follows:</div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></font></div><div class="m_3005620692593643864gmail_msg"><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg                         = [];</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.dataset                 = fullfile(rootdir,f{iD});</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.layout                  = 'neuromag306mag.lay';</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.trialdef.eventtype      = 'STI101';</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.trialdef.eventvalue      = {255};</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg                          = ft_definetrial(cfg);</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">       </font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.trl                     = [cfg.trl(1,1) cfg.trl(end,2) 0];</font></div><div class="m_3005620692593643864gmail_msg"><span style="font-family:monospace" class="m_3005620692593643864gmail_msg">        cfg.channel                 = 'megmag'; </span><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.continuous              = 'yes';</font></div><div class="m_3005620692593643864gmail_msg"><span style="font-family:monospace" class="m_3005620692593643864gmail_msg">        data                        = ft_preprocessing(cfg);</span><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg"><span style="font-family:monospace" class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></span></div><span style="font-family:monospace" class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></span></div><div class="m_3005620692593643864gmail_msg"><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.artfctdef.eog           = [];</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.artfctdef.eog.channel   = eogchans;</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.artfctdef.eog.trlpadding = 0;</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        cfg.artfctdef.eog.interactive = 'yes';</font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        </font></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg">        [cfg, artifact{iC,iD}]      = ft_artifact_eog(cfg,data);</font></div><div style="font-family:monospace" class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div></div><div class="m_3005620692593643864gmail_msg">This opens an interactive window in which the EOG signal is not BPfiltered, and contains in particular slow drifts that make the threshold detection pretty inefficient. I'm surprised because cfg.artfctdef is supposed to bpfilter 1-15Hz the data, isn't it?</div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg">Is this normal?</div><div class="m_3005620692593643864gmail_msg">Thanks,</div><div class="m_3005620692593643864gmail_msg">Max</div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div><div class="m_3005620692593643864gmail_msg"><font face="monospace" class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></font></div><div class="m_3005620692593643864gmail_msg"><br class="m_3005620692593643864gmail_msg"></div></div>
<br class="m_3005620692593643864gmail_msg"></blockquote></div></div><div class="gmail_extra m_3005620692593643864gmail_msg"><div class="gmail_quote m_3005620692593643864gmail_msg"><blockquote class="gmail_quote m_3005620692593643864gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">______________________________<wbr>_________________<br class="m_3005620692593643864gmail_msg">
fieldtrip mailing list<br class="m_3005620692593643864gmail_msg">
<a href="mailto:fieldtrip@donders.ru.nl" class="m_3005620692593643864gmail_msg" target="_blank">fieldtrip@donders.ru.nl</a><br class="m_3005620692593643864gmail_msg">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" class="m_3005620692593643864gmail_msg" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br class="m_3005620692593643864gmail_msg"></blockquote></div><br class="m_3005620692593643864gmail_msg"></div>
______________________________<wbr>_________________<br class="m_3005620692593643864gmail_msg">
fieldtrip mailing list<br class="m_3005620692593643864gmail_msg">
<a href="mailto:fieldtrip@donders.ru.nl" class="m_3005620692593643864gmail_msg" target="_blank">fieldtrip@donders.ru.nl</a><br class="m_3005620692593643864gmail_msg">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" class="m_3005620692593643864gmail_msg" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a></blockquote></div></div></div></div><div><div class="h5">
______________________________<wbr>_________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a></div></div></div></blockquote></div><br></div></div><br>______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>