<html xmlns:v="urn:schemas-microsoft-com:vml" 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=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple" style="word-wrap:break-word">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hello <span>Konstantinos Tsilimparis</span>,</p>
<p><br>
</p>
<div>Thank you very much for the useful information.<br>
<br>
I tried padding, but it doesn't work for me, so I did it with the <span>bandstop</span> filter, to remove for example the noise of power lines at 50 Hz, I chose the frequency interval from [49 51 Hz].</div>
<br>
<p>Thanks again, <br>
</p>
<p>Hasnae<br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> fieldtrip <fieldtrip-bounces@science.ru.nl> de la part de Konstantinos Tsilimparis via fieldtrip <fieldtrip@science.ru.nl><br>
<b>Envoyé :</b> jeudi 11 juillet 2024 01:24:57<br>
<b>À :</b> FieldTrip discussion list<br>
<b>Cc :</b> Konstantinos Tsilimparis<br>
<b>Objet :</b> Re: [FieldTrip] Issue with DFT filter used to remove power line noise at 50 Hz</font>
<div> </div>
</div>
<div>
<div style="border:solid #a1c2ff 1px;text-align: center">
<p class="x_MsoNormal" style="line-height: 1.4; background: #eee; padding: 10px;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 16px; fill: #1F63DE;"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448zm0 480A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM208 352c-8.8 0-16 7.2-16 16s7.2 16 16 16h96c8.8 0 16-7.2 16-16s-7.2-16-16-16H272V240c0-8.8-7.2-16-16-16H216c-8.8 0-16 7.2-16 16s7.2 16 16 16h24v96H208zm48-168a24 24 0 1 0 0-48 24 24 0 1 0 0 48z"></path></svg><span style="font-size: 0.875rem;color: #272424">Ce
mail provient de l'extérieur, restons vigilants</span> </p>
</div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Hello Hasnae,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">The Fieldtrip’s FAQ might provide you with an answer:
<a href="https://www.fieldtriptoolbox.org/faq/why_is_there_a_residual_50hz_line-noise_component_after_applying_a_dft_filter/">
https://www.fieldtriptoolbox.org/faq/why_is_there_a_residual_50hz_line-noise_component_after_applying_a_dft_filter/</a></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">. An alternative to the DFT filter is the bandstop filter.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">As mentioned in the webpage:
<a href="https://www.fieldtriptoolbox.org/faq/what_kind_of_filters_can_i_apply_to_my_data/">
https://www.fieldtriptoolbox.org/faq/what_kind_of_filters_can_i_apply_to_my_data/</a></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> , you can apply padding to make the DFT filter sharper. I am not sure if this would help you, but you
can play with the padding and see if your results improve.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">All the best,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Konstantinos Tsilimparis<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> fieldtrip <fieldtrip-bounces@science.ru.nl>
<b>On Behalf Of </b>AGOURAM Hasnae via fieldtrip<br>
<b>Sent:</b> Wednesday, July 10, 2024 2:26 PM<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Cc:</b> AGOURAM Hasnae <hasnae.AGOURAM@univ-amu.fr><br>
<b>Subject:</b> [FieldTrip] Issue with DFT filter used to remove power line noise at 50 Hz<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div id="divtagdefaultwrapper">
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black">Hello everyone,
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black">I am having a small issue with the DFT filter used to remove power line noise at 50 Hz. Even after applying the filter, I still observe line noise in the power spectral density.<br>
<br>
I am using the </span><a href="https://www.fieldtriptoolbox.org/reference/preproc/ft_preproc_dftfilter" target="_blank"><b><span style="font-size:13.0pt;font-family:"Arial",sans-serif;color:#0097A7">ft_preproc_dftfilter</span></b></a><span style="font-family:"Calibri",sans-serif;color:black">
function from the Fieldtrip toolbox, which applies a narrow-band notch filter to eliminate the 50 Hz noise.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<p><span style="font-family:"Calibri",sans-serif;color:black">Here is the snippet of code I am using<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Calibri",sans-serif;color:#006FC9">%filtre the data
</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> cfg = [];</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> cfg.hpfilter = 'yes'; % High-pass filter</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> cfg.hpfreq = 1 ; % High-pass frequency</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> cfg.dftfilter = 'yes'; % enable notch filtering to eliminate power line noise</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> cfg.dftfreq = [50]; %set frequencies for notch filtre</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> dataContinuousResampled_filtred = ft_preprocessing(cfg,dataContinuousResampled);</span></b><b><span style="font-family:"Calibri",sans-serif;color:black"><br>
</span></b><b><span style="font-family:"Calibri",sans-serif;color:#006FC9"> </span>
</b><span style="font-family:"Calibri",sans-serif;color:black"><o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black">If you have any suggestions, please let me know.
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><b><span style="font-family:"Calibri",sans-serif;color:black">Hasnae Agouram<br>
PhD student</span></b><span style="font-family:"Calibri",sans-serif;color:black"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>