[FieldTrip] Questions on High pass and Dft filtering

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Thu Jun 28 11:40:19 CEST 2012

Dear Philipp,

we are quite aware that the filter sometimes results in unstable 
solutions, see also here:
How to avoid this, however, is already explained in the error message. 
Just try to change the order of the filter or increase the cut-off 
frequency. The order/cutoff frequency needed is something I cannot tell 
you from the top of my head, to just try some values (for the order, 
look at the default, which is around 4 or so and then increase/decrease 
by one stepwise).

The dft-filter basically works by fitting a 50Hz sine wave to substract 
the line noise, thereby leaving a residual when the amplitude is not 
constant. In contrast a bandstop filter removes activity in a specified 
frequency band. This is explained in more details in our FAQ on the webpage:
The dftfilter therefore also does not really require any padding (imho 
it would be even counter productive).

I don't quite get with what you mean by saying that there is no effect 
on the continuous data set, can you give an example (e.g. explain with 
what cfg options you call ft_preprocessing).

Your problem concerning filter padding with data in memory will be 
handled soon, by implementing additional options for padding, see here:
But as I said, I don't see the point in using padding for a dftfilter.

Hope that helps!

On 6/27/2012 3:30 PM, Philipp Hintze wrote:
> Dear mailing list members,
> I continue to run into errors during my first FieldTrip analysis:
> I would like to use a high pass filter on my data prior to the segmentation
> into trials, the reason being that the trial duration is ~900 ms and I would
> like to filter low frequencies. The continuous data set is 900 seconds long.
> Simply using
>       cfg.continuous          = 'yes';
>       cfg.hpfilter                 = 'yes';
>       cfg.hpfreq                  = 0.1;
>       filteredContinuousData  = ft_preprocessing(cfg);
> as my first run of preprocessing, I am confronted with an error stating
> Calculated filter coefficients have poles on or outside the unit circle and
> will not be stable. Try a higher cutoff frequency or a different
> type/order of filter.
> How can I avoid this?
> Another problem I have concernes the line noise filtering. I would like to use
> the dft filter to get rid of the line noise. Using it on the segmented trials,
> I still notice residual 50 Hz noise, despite using cfg.padding = 10. A
> combination of the dft filter and a band stop filter using cfg.bsfreq =
> [49:0.1:51 99:0.1:101 149:0.1:151] leads to acceptable filtering of the line
> noise.
> The problem I have concerns the order of the filtering steps: I would like to
> use the high pass filter described above, given it works, on the continuous
> data. If I use the dft filter on the continuous data set, there is no effect
> on the averaged trials. Is this trivial or is there a mistake on my part?
> However, I can hardly use the dft filter on data that was preprocessed as
> continuous and than segmented using ft_redefinetrial, because I can not set
> any filter padding (because the data is not read from the dataset).
> Is there something I am overlooking or doing wrong or has someone used a
> different approach to a similar problem?
> Thank you in advance for your time and effort,
> Philipp
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands

More information about the fieldtrip mailing list