<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear Per,<div class=""><br class=""></div><div class="">Thank you for your reply.</div><div class=""><br class=""></div><div class="">Well if I don’t know how much trust I can have in it, it is because the sampling frequency inputted on my side (in the settings of the Cheetah DAS) is indeed 32kHz, that was the default. Now it is an old system so maybe it is doing something differently, who knows.</div><div class="">However, when I filter the raw data with ft_preprocbandstopfilter I get the desired result for a sampling frequency of 16k. So Fieldtrip is probably right about this, and is self-consistent up till then.</div><div class="">The problem for me is that within the data outputted by ft_preprocessing you get two different Fsample values: data.hdr.fs = 16k vs data.fsample = 8k. This sounds strange to me, however you look at it.</div><div class="">Also, that 8kHz comes out of nowhere, there is no warning and no rationale for it. So, it seems like an intempestive division by two of the sampling rate that happens during the correction fieldtrip does when it reads the data.</div><div class=""><br class=""></div><div class="">Also, the second problem is that for which I am most interested in the answer: whether it is possible - and if so, how - to filter the 50Hz line noise <u class="">before</u> feeding the data into ft_preprocessing.</div><div class=""><br class=""></div><div class="">All the best,</div><div class=""><br class=""><div class="">
<span class="Apple-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; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="">Florian</div></span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 15 Oct, 2016, at 9:18 PM, Per Knutsen <<a href="mailto:knutsenpm@gmail.com" class="">knutsenpm@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size:small">Dear Florian,</div><div class="gmail_default" style="font-size:small">You are not clear about your actual sample rate:</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">> I do not know either how much trust I have to put in that warning and correction of the sampling rate in the first place.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Clearly, you should know your own sampling rate from the Neurolynx acquisition software.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">It would seem this is the primary thing you need to resolve.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Regards,</div><div class="gmail_default" style="font-size:small">Per</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"> </div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><div dir="ltr" class=""><div class=""><b class=""><br class=""></b></div><div class=""><b class="">Per M Knutsen</b></div><div class=""><font size="1" class="">University of Oslo</font></div><div class=""><font size="1" class="">Dept. of Molecular Medicine, Physiology Sect.</font></div><div class=""><font size="1" class="">PB 1103 Blindern, NO-0317 Oslo</font></div><div class=""><font color="#1155cc" size="1" class=""><a href="tel:%2B47.45103762" value="+4745103762" target="_blank" class="">+47.45103762</a></font></div></div></div></div><div dir="ltr" class=""><div style="font-size:small" class=""></div></div></div></div></div><div dir="ltr" class=""><div style="font-size:small" class=""></div></div></div></div></div>
<br class=""><div class="gmail_quote">On Sat, Oct 15, 2016 at 9:25 AM, Florian Gerard-Mercier <span dir="ltr" class=""><<a href="mailto:florian@brain.riken.jp" target="_blank" class="">florian@brain.riken.jp</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Dear all,<div class=""><br class=""></div><div class="">I am wondering, was my question unclear, or maybe no one is using Neuralynx data?</div><div class="">I can think of ways to avoid these two problems, but I would prefer to find a proper solution if possible. </div><div class=""><br class=""></div><div class="">Thanks in advance,</div><div class=""><br class=""><div class="">
<span class="m_-3099422565437113932Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: 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 class="">Florian Gerard-Mercier</div><div class=""><br class=""></div></span><br class="m_-3099422565437113932Apple-interchange-newline">
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On 14 Oct, 2016, at 3:08 PM, Florian Gerard-Mercier <<a href="mailto:florian@brain.riken.jp" target="_blank" class="">florian@brain.riken.jp</a>> wrote:</div><br class="m_-3099422565437113932Apple-interchange-newline"><div class=""><div style="word-wrap:break-word" class="">Dear community,<div class=""><br class=""></div><div class=""><br class=""></div><div class="">My name is Florian Gerard-Mercier and I work in Keiji Tanaka’s laboratory in Riken BSI, Japan.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I am new to Fieldtrip.</div><div class="">My goal is to do a simple analysis of ECoG data in response to electrical stimulation (all in monkey cortex). To this effect I followed the TMS-EEG tutorial (since the issues are almost identical).</div><div class="">The recording system is Neuralynx.</div><div class=""><br class=""></div><div class="">I have encountered 2 problems which I don’t believe are related.</div><div class="">I have basically followed the tutorials to the letter so except if I mention otherwise, the cfg, etc. are standard.</div><div class=""><br class=""></div><div class=""><u class=""><b class="">1) Fsample discrepancy between data and header.</b></u></div><div class="">When I load Neuralynx data, I get warnings that the sample rate is actually half that in the header, and is thus being corrected (note, 16129 instead of 32258Hz).</div><div class="">This is no problem, until I get the final results where I noticed that my 50Hz noise is now represented as lasting 40ms for each cycle (= twice longer than it actually is).</div><div class="">Navigating in the workspace, I noticed that even though cfg.Fs is 16129 as expected, somehow the data outputted by ft_preprocessing has a field fsample equal to half that number (8064.5).</div><div class="">This later gives many conflicts such as: if I force data.fsample to be 16129, I have the correct time axis in the end, but now my trial duration is only half that which I want…</div><div class="">Any idea on how to solve this issue? I haven’t found any previous ticket on this Fsample discrepancy issue.</div><div class="">I do not know either how much trust I have to put in that warning and correction of the sampling rate in the first place.</div><div class=""><br class=""></div><div class=""><u class=""><b class="">2) 50Hz line noise filtering</b></u></div><div class="">The previous point makes it so that if I filter 50Hz, of course nothing happens. But even if I filter 25Hz (or 50Hz with the Fsample corrected back to 16129), the attenuation is far too small (whether I use padding or not). I did look up the similar problems that had been submitted to this list in the past, but didn’t find any satisfactory fix.</div><div class="">To give an idea:</div><div class=""><div class="">cfg = [];</div><div class="">cfg.Fsample = 1000; % I downsampled the data in the meantime as said in the tuto</div><div class="">cfg.bsfilter = 'yes';</div><div class="">cfg.bsfiltord = 2; % somehow I have an error that the filtering doesn’t work every time I try to run it with an order >2</div><div class="">cfg.bsfreq = [49.9 50.1];</div><div class="">filtDat = ft_preprocessing(cfg, data_lite);</div><div class=""><br class=""></div><div class=""><div class="">cfgbrowse = []; cfgbrowse.viewmode = 'butterfly';</div><div class="">ft_databrowser(cfgbrowse, dat_lite /// filtDat); % screenshots of both below</div></div><div class=""><br class=""></div><div class="">changes this</div><div class=""><span id="m_-3099422565437113932cid:A61F9FBF-4C22-4418-BF33-2A7E0474BE79@bnf.brain.riken.jp" class=""><data_lite.jpeg></span></div><div class=""><br class=""></div><div class="">into that</div><div class=""><br class=""></div><div class=""><span id="m_-3099422565437113932cid:D9CEB025-4841-41D7-AEA6-DB89088A2C37@bnf.brain.riken.jp" class=""><filtDat.jpeg></span></div><div class=""><br class="m_-3099422565437113932webkit-block-placeholder"></div><div class="">{Note also the issue with Fsample: here I have a time axis that corresponds to my 50Hz noise, but the duration of the trial is reduced from [-0.05, 0.45] by a factor of 2.}</div><div class=""><br class=""></div><div class="">This is in stark contrast to what happens if I use the bandstop filter directly on the raw data:</div><div class=""><div style="margin:0px;line-height:normal" class="">dat = ft_read_data(dataset_dir);</div></div><div class=""><div style="margin:0px;line-height:normal" class="">dat_filt = ft_preproc_bandstopfilter(dat, 16129, [49.9 50.1], 2);</div></div><div class="">changes this</div><div class=""><span id="m_-3099422565437113932cid:4FF67112-09FC-4A3B-A444-C64EB817293E@bnf.brain.riken.jp" class=""><RawData.jpeg></span></div><div class=""><br class=""></div><div class="">into that</div><div class=""><br class=""></div><div class=""><span id="m_-3099422565437113932cid:DAD0B9D2-A389-4AC0-AF4F-D22BC8CC53AF@bnf.brain.riken.jp" class=""><RawData_after_filter.jpeg></span></div><div class=""><br class=""></div><div class="">Which should be perfect for my simple purposes. (Here I just did a simple Matlab plot, so the x axis numbering is not actual time)</div><div class=""><br class=""></div><div class="">Of course, I tried to feed that filtered data into the preprocessing pipeline by doing </div><div class=""><div style="margin:0px;line-height:normal" class="">cfg = ft_rejectartifact(cfg_<wbr class="">artifact); %cfg_artifact is defined as in the tutorial, it is to reject the electrical stimulation artifacts. The problem should not stem from here.</div></div><div class=""><div style="margin:0px;line-height:normal" class="">data_artifact_rejected = ft_preprocessing(cfg, dat_filt);</div></div><div class="">But I get the error that dat_filt is not raw or comp data.</div><div class=""><br class=""></div><div class="">I have read that it is recommended to do the line noise filtering after the trial segmentation and stimulation artefact removal, but 1) it doesn’t seem to work well, 2) I don’t really understand why, given that my artefacts are nowhere near the 50Hz frequency.</div><div class=""><br class=""></div><div class="">So for this point:</div><div class="">- how to make the (recommended) 50Hz post processing work?</div><div class="">- or more simply, how could I feed prefiltered data to ft_preprocessing?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thank you very much for your consideration and I look forward to your help.</div><div class=""><br class=""></div><div class="">All the best,</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">
<span class="m_-3099422565437113932Apple-style-span" style="border-collapse:separate;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;line-height:normal;border-spacing:0px"><div class="">Florian</div></span>
</div>
<br class=""></div></div>______________________________<wbr class="">_________________<br class="">fieldtrip mailing list<br class=""><a href="mailto:fieldtrip@donders.ru.nl" target="_blank" class="">fieldtrip@donders.ru.nl</a><br class=""><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/<wbr class="">mailman/listinfo/fieldtrip</a></div></blockquote></div><br class=""></div></div><br class="">______________________________<wbr class="">_________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/<wbr class="">mailman/listinfo/fieldtrip</a><br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">fieldtrip mailing list<br class=""><a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</div></blockquote></div><br class=""></div></body></html>