dft filtering for 50Hz

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Feb 13 12:35:38 CET 2006

Hi Vladimir

> I looked at the data file and I see that in most trials there is a
> TMS pulse
> closer than 10 sec to the pulse I'm looking at. So I can't throw
> out trials
> where I don't get a clean 10 sec segment because then I'll throw
> out most of
> them. I think there are two options the simple one and the
> complicated one:

The method implemented in Fieldtrip to prevent filter atrifacts at
the side of the trial, and also to get a very sharp (dft) line noise
filter, is to pad the complete trial up to cfg.padding on *both*
sides of the original trial. I.e. if you have a trial of 2 seconds,
it will be padded with data for filtering with 4 seconds before and 4
seconds after the original trial. The padding segments are removed
from the data imediately after the filtering has been done.

Related to 50 or 60 Hz line noise filtering: the resulting notch is 1/
Tpadding, i.e. with 10 seconds the notch is 1/10 Hz, with 4 seconds
it would be 1/4 Hz. I leave it up to you to decide whether that is
much, it depends on the frequency and the amount of multi-taper
smoothing that you can apply afterwards. If your data consists of
short trials (e.g. 500ms), you would have a low frequency resolution
anyway (1/0.5=2Hz).

Besides using the default filter padding, you could also do it
manually by modifying the cfg.trl trial definition. In your case I
can imagine that you have plenty of time after the trial but not
before (with the TMS pulse before each trial), so you can do cfg.trl
(:,2) = cfg.trl(:,2)+N*Fsample and specify cfg.padding=0. Afterwards,
you manually have to get rid of the additional data that has been
glued at the end of each trial.

> 1) The simple one is take 4 sec segments. In this case I can get
> enough. The
> question is whether it is better to pad them to 10 sec or less. You
> say that
> if I pad them to less I'll get a wider notch. The question is what
> happens
> if I pad too short a segment to 10 sec and how short is too short?

If I were you, I would just give the 4 sec a try. You should not be
too rigid about the 10 seconds, which is a good default for our own
type of long-trial MEG experiments but which is impractically long
for most other experiments.

> 2) I can look at trials one by one, cut as long a segment as I can
> before
> the artifact and pad it if necessary to 10 sec. The question here
> is whether
> this will really improve things greatly. Also how do I implement it
> - should
> I read the data twice - first find the artifacts, rebuild the trl
> structure
> and then read again? Also can I use Fieldtrip artifact functions to
> find the
> artifacts?

Yes you can, but I am not sure what the most sensitive way is of
detecting the TMS artifacts. Look into the artifact_zvalue code and
tweak the preprocessing options (see private/preproc) to make it
sensitive to the TMS artifacts. Probbaly the settings used in
artifact_muscle are already pretty close (except that you should not
do the boxcar).


More information about the fieldtrip mailing list