<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Frans,
<div class=""><br class="">
</div>
<div class="">Historically, due to RAM constraints etc. a tradition FieldTrip pipeline started with epoching, then filtering. However, currently there is no reason to load in the continuous data first, then do the filtering, and then do the epoching. Although
I didn’t read Julian’s reply in detail, I suspect that his code is doing exactly that.</div>
<div class=""><br class="">
</div>
<div class="">There is just still a lot of documentation online which reverses this optimal order.</div>
<div class=""><br class="">
</div>
<div class="">Note, in addition, that if one uses a filter with a finite impulse response, the filtered signal will not depend on the overall length of the data segment that you supply to the filter, once you get sufficiently far away from the edges. In other
words, for instance, the center piece a one minute data segment that has been filtered will look exactly the same as a filtered version of the exact same center piece obtained from the 1-hour continuous recording. </div>
<div class=""><br class="">
</div>
<div class="">Fieldtrip allows for cfg.padding in ft_preprocessing, which will allow you to obtain epoched and filtered data in a single call to ft_preprocessing, without suffering from the edge effects of the filter. Once the value for cfg.padding exceeds
the maximum epoch length + the filter order (and provided you use a finite impulse response filter) then you should be good.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 15 Feb 2023, at 11:33, Frans Nord via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hello mailing-list,
<div class=""><br class="">
</div>
<div class="">I have a question regarding the comment about Fieldtrip in the recently published paper "EEG is better left alone" [1]. While I don't agree with the conclusions of the paper there is a specific comment regarding Fieldtrip that I would like some
comments about:</div>
<div class=""><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)" class=""><br class="">
</span></div>
<div class=""><font color="#1d1c1d" face="Slack-Lato, Slack-Fractions, appleLogo, sans-serif" class=""><span style="font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)" class="">"</span></font><span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:18px" class="">We
realized that the FieldTrip preprocessing function extracts data epochs before filtering the data when provided with both filter settings and epoch information. After consulting with FieldTrip developers, for all analyses using FieldTrip, we used an alternate
multi-step implementation allowing us to extract epochs after the raw data had been filtered."</span></div>
<div class=""><span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)" class=""><br class="">
</span></div>
<div class="">Looking through the code of ft_preprocessing and how the preproc function is used in my own preprocessing pipeline i realized that I seem to do the filtering on raw data epochs with this code:<span style="color:rgb(29,28,29);font-family:Slack-Lato,Slack-Fractions,appleLogo,sans-serif;font-size:15px;font-variant-ligatures:common-ligatures;background-color:rgb(248,248,248)" class=""><br class="">
</span></div>
<div class=""><br class="">
</div>
<div class="">
<div class="gmail-rtcContent" style="padding:30px">
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg = [];</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.continuous =<span style="color:rgb(167,9,245)" class="">'yes'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.trialfun = <span style="color:rgb(167,9,245)" class="">
'ft_trialfun_general'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.trialdef.eventtype = <span style="color:rgb(167,9,245)" class="">
'STATUS'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.trialdef.eventvalue = {1,2,3,4}; <span style="color:rgb(0,128,19)" class="">
% Trigger values</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.trialdef.prestim =.5; <span style="color:rgb(0,128,19)" class="">
% -500 ms before the stimulation</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.trialdef.poststim = 2; <span style="color:rgb(0,128,19)" class="">
% +2000ms after the stimulation</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg.dataset = path_to_dataset; <span style="color:rgb(0,128,19)" class="">
% set the name of the dataset</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">cfg = ft_definetrial(cfg); <span style="color:rgb(0,128,19)" class="">
% read the list of the specific stimulus</span></span>cfg.hpfilter<span style="white-space:pre;font-size:10pt" class=""> =
</span><span style="white-space:pre;font-size:10pt;color:rgb(167,9,245)" class="">'yes';</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre;font-size:10pt" class="">cfg.hpfreq = 1;</span><span style="font-size:10pt;white-space:pre" class="">[data] =ft_preprocessing(cfg);</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-size:10pt;white-space:pre" class=""><br class="">
</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class="">I did however think that the code above would apply the high pass filter on the continuous data and not on the epochs but it seems that I was wrong. Or am I? So I'm now consulting
the E-mail list to get some clarity about this and a potential recommendation on what to do instead. Basically, how to implement the "multi-step implementation" within Fieldtrip.</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class=""><br class="">
</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class="">Thank you for providing the Fieldtrip toolbox</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class="">Best</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class="">Frans</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class=""><br class="">
</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:small" class="">[1] </span><span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px" class="">Delorme, A.
EEG is better left alone. </span><i style="box-sizing:inherit;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px" class="">Sci Rep</i><span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px" class=""> </span><span style="font-weight:bolder;box-sizing:inherit;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px" class="">13</span><span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px" class="">,
2372 (2023). <a href="https://urldefense.com/v3/__https://doi.org/10.1038/s41598-023-27528-0__;!!HJOPV4FYYWzcc1jazlU!4hjKg111dQ7s9-L3G_ddKy01SDzvgiEvo8gLx_R-WDx6Qxj6JJS0HuEwuUx1atexqoHmVc8kvd5ouM4p4smQ$" class="">
https://doi.org/10.1038/s41598-023-27528-0</a></span></div>
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!-_6L05NY4jlsfrP8C3I8I2jFQwOMSiDKS1tqSQ21aLsqyTB_rndzUnLg-8WiMQbKsVsuFCrx5lJzqbdD1tXsy2Tu8f4-RQxPapetqA$
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>