<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Phillipp and Jörn,<br>
<br>
I'm pretty sure that the padding for filtering is data padding not
zero padding, so this does make sense and should not bias the
estimation of the 50Hz noise. My experience with the dft filter is
that it works very will when the line noise is stable in amplitude,
it sharply (the longer the data/padding the sharper the filter)
filters out specifically the line noise. It can do this because the
frequency of the line noise is so stable. <br>
<br>
However, when the amplitude of the line noise varies (which it did
in my data), this results in creating noise in frequencies outside
50Hz (if your interested in why, <a
href="http://fieldtrip.fcdonders.nl/example/crossfreq/phalow_amphigh">this
piece of the FieldTrip wiki</a> sheds some light on that), and the
dft filter fails. I'm using a band stop around the line noise
frequency and harmonics. I'd recommend plying with the values, and
plotting to see which settings are appropriate for your specific
circumstances. Below you can find a snipped of code I used to
determine my settings.<br>
<br>
Good luck,<br>
Ingrid<br>
<br>
------- code snippet -------<br>
widths = [0.5 1 1.5 2 3 5 10];<br>
orders = [2:6];<br>
<br>
for iWidth = 1:length(widths)<br>
for iOrd = 1:length(orders)<br>
width = widths(iWidth);<br>
<br>
%preprocess data<br>
cfg = [];<br>
%cfg.event = event;<br>
cfg.dataset = [cur_path_MFF, 'NS_EMR_', subjStr,
'_', stages{iStage}];<br>
cfg.channel = {'EOG*', 'EMG', 'EEG', '-E1', '-E9',
'-E32', '-E8', '-E25', '-E129'};<br>
cfg.demean = 'yes';<br>
cfg.hpfilter = 'yes';<br>
cfg.hpfreq = 0.3;<br>
cfg.hpfiltord = 1;<br>
cfg.bsfilter = 'yes';<br>
cfg.bsfiltord = orders(iOrd);<br>
cfg.bsfreq = [60-width 60+width; 120-width
120+width; 180-width 180+width]; %note I'm in the US so have 60Hz
line noise, you might have 50Hz<br>
cfg.pad = 0.5;<br>
cfg.trl = trl(1:100,:);<br>
data_S1_clean = ft_preprocessing(cfg);<br>
<br>
%do freqanalysis<br>
cfg = [];<br>
cfg.channel = ['EEG' BadChan];<br>
cfg.output = 'pow';<br>
cfg.method = 'mtmfft';<br>
cfg.taper = 'hanning';<br>
cfg.foilim = [30 200];<br>
freq_S1_clean = ft_freqanalysis(cfg, data_S1_clean);<br>
<br>
%plot<br>
figure;<br>
plot(freq_S1_clean.freq,freq_S1_clean.powspctrm(:,:))<br>
print(gcf, '-dpng', '-r300', [cur_path_fig, subjStr, '_',
stages{iStage}, '_W', num2str(width*10),'_O',
num2str(orders(iOrd))]);<br>
close <br>
<br>
%zoom in around 60 hz;<br>
figure;<br>
plot(freq_S1_clean.freq(22:41),freq_S1_clean.powspctrm(:,22:41))<br>
print(gcf, '-dpng', '-r300', [cur_path_fig, subjStr,
'zoomed_', stages{iStage}, '_W', num2str(width*10),'_O',
num2str(orders(iOrd))]);<br>
close <br>
end<br>
end<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 6/28/2012 7:45 AM, "Jörn M.
Horschig" wrote:<br>
</div>
<blockquote cite="mid:4FEC6E22.1040707@donders.ru.nl" type="cite">Hi
Philipp,
<br>
<br>
<blockquote type="cite">The padding ensures that we only filter
out a narrow 1/10 Hz wide frequency bin.
<br>
</blockquote>
<br>
sure, I didn't think about that - that's a pretty good reason to
use padding :) However, the estimation of the 50Hz noise will be
biased by the padded samples. I don't like the dftfilter anyway,
and I am not filtering either (the reason for me is that 50Hz
noise should be invariant to the experimental effects. I mostly
investigate TFRs).
<br>
<br>
<blockquote type="cite"> but looking at averaged timelocked data
for the subject, the data looks
<br>
identical to the result I get using no filter at all, i.e.,
contaminated by
<br>
strong line noise.
<br>
</blockquote>
<br>
I'm gonna look into this to see whether it is a bug or not. I'll
let you know soon.
<br>
<br>
Best,
<br>
Jörn
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305</pre>
<br>
<br>
</body>
</html>