[FieldTrip] Questions on High pass and Dft filtering

Philipp Hintze philipp.hintze at uni-muenster.de
Thu Jun 28 15:13:16 CEST 2012


Dear Jörn,

thank you for your fast response.
> Just try to change the order of the filter or increase the cut-off
> frequency.
I did that and found a stable solution for the 0.1 Hz filter at an order of 5.

> The dftfilter therefore also does not really require any padding
> (imho
> it would be even counter productive).
I read in the tutorials and in other discussions on this mailing list, that
the padding is required.
The FAQ
(http://fieldtrip.fcdonders.nl/faq/what_kind_of_filters_can_i_apply_to_my_data)
states:
"To make this dft filter very sharp, you have to pad the data to a large
amount (cfg.padding), e.g. to 5 or 10 seconds."
Rober Oostenveld wrote:
"...in preprocessing with cfg.dftfilter=yes, optionally cfg.dftfreq
(default is [50 100 150]), and what we do is cfg.padding=10 to pad
the data up to 10 seconds before subtracting the 50Hz sine wave. The
padding ensures that we only filter out a narrow 1/10 Hz wide
frequency bin. After sufficient mutitapering in the frequency domain,
you won't notice the narrow 50Hz notch any more. If you don't
filterpad, and e.g. have 0.5 s trials, you will put a wider 1/0.5=2Hz
notch in your power spectrum."

I tried using the filter without padding and the results are still acceptable,
yet there is more residual noise than if it is applied with padding.

The issue with the continuous data is the following: I tried using
     cfg                     = [];
     cfg.channel      = {'EEG'};
     cfg.datafile       = dataset;
     cfg.headerfile   = dataset;
     cfg.dataset       = dataset;

     cfg.continuous = 'yes';

     (cfg.padding         = 10;)
     cfg.dftfilter           = 'yes';

      filteredContinuousData  = ft_preprocessing(cfg);

 but looking at averaged timelocked data for the subject, the data looks
 identical to the result I get using no filter at all, i.e., contaminated by
 strong line noise. Including padding makes no difference either, therefore
 the brackets.

Best regards,
Philipp


"Jörn M. Horschig" schrieb am 2012-06-28:
> Dear Philipp,

> we are quite aware that the filter sometimes results in unstable
> solutions, see also here:
> http://bugzilla.fcdonders.nl/show_bug.cgi?id=780
> 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:
> http://fieldtrip.fcdonders.nl/faq/why_is_there_a_residual_50hz_line-n
> oise_component_after_applying_a_dft_filter
> 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:
> http://bugzilla.fcdonders.nl/show_bug.cgi?id=1318
> But as I said, I don't see the point in using padding for a
> dftfilter.

> Hope that helps!
> Best,
> Jörn


> 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

> Contact:
> 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

> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip




More information about the fieldtrip mailing list