# [FieldTrip] Frequency smoothing for beamforming

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Fri Oct 5 08:56:27 CEST 2012

```Hey Yoni,

Stephen is right, and just to make this really clear, a Hanning taper
will always give you a smoothing of your Raleigh frequency (which in
your case is 3.33Hz). Any taper can only (effectively) smooth in terms
of your frequency resolution or Raleigh frequency, thus a Hann taper
gives you the minimal smoothing (apart from a boxcar). Then, the problem
with different trial becomes more apparent, because since the frequency
resolution changes, also the smoothing of the Hanning taper changes
accordingly. I also think that making the trials having equal length is
the best approach. Having unequal trial lengths also constitutes a
problem for multitapering, cause you will end up with different tapers
and different number of tapers per trial. And also your frequency
smoothing should be a multiple of the Raleigh frequency. You can ask for
other smoothing, e.g. 8Hz with 3.33Hz resolution, but effectively you
will see the smoothing at 6.66 or 9.99Hz (depending on where you define
the end of smoothing) - it's just because you sample in 3.33Hz steps.
Here you can maybe also see, that having different trial lengths might
constitute a problem, because you will effectively get different
smoothing per trial, depending on your Raleigh frequency. The
computation of the tapers was however correct, so with 8Hz smoothing and
a 0.3s time window you get 3 tapers ;) Btw, I once played around with it
and realized that the 3 tapers you obtain are not always the same for
different parameters, e.g. for 8Hz and 0.25s window you will also get
8*0.25*2-1 = 3 tapers, but they will be different from the 3 tapers you
get with a 0.3s time window. So even that can cause a problem.

Btw, I never heard that different frequency smoothing ends up in
different part of the brain when beaming. The only reason I can see is
what Stephen already pointed out, that other frequency bands with
different functional characteristics smear into your power spectrum.

Best,
Jörn

On 10/4/2012 3:47 PM, Stephen Whitmarsh wrote:
> Hi Yoni,
>
> Indeed, a simple hanning taper will  already give you a frequency
> smoothing of +/- 3Hz. Adding tapers can only increase this, and I
> don't see why you would beamform 22 to 38 Hz if you are interested
> between in 29-31 Hz. Couldn't you just do cfg.foi = 30, with cfg.taper
> = 'hanning', giving you a measure of power between of about 27 and 33?
>
> You're right that having different trial lenghts will indeed give you
> a different frequency resolution per trial. If this is a problem is
> hard to say from here. cfg.minlength = 'maxperlen in ft_redefinetrial
> would indeed make sure they are all of the same length (i.e. the
> maximal length) - but if that is different between subjects/conditions
> that might not be enough.
>
> Best,
> Stephen
>
>
>
> On 4 October 2012 11:56, Yoni Levy <yoniilevy at gmail.com
> <mailto:yoniilevy at gmail.com>> wrote:
>
>     Hi Stephen!
>
>     My FOI is 29-31Hz; Since my time window is of 300ms, then my freq
>     smoothing should now be of +/-3.33Hz. If I use a hanning taper,
>     the parameters that i use for the freqanal (for further on doing
>     beamformer-statistics) are:
>             cfg.method ='mtmfft';
>             cfg.output ='fourier';
>             cfg.keeptrials = 'yes';
>             cfg.keeptapers = 'yes';
>             cfg.taper = 'hanning';
>             cfg.foilim = [29 31];
>     However, if I get it right, multitapering should also be an option
>     as 30Hz is not a relatively very low frequency. In that case, i
>     remove the hanning and instead include a cfg.tapsmofrq =8, so that
>     the number of tapers results in 8*0.3*2-1= 3 (I think?). Is it so?
>
>     Also, about the time window which is theoretically 300ms, but i
>     think this depends on the length of every trial; for instance,
>     before freqanal, when i redefine the trial, i input cfg.minlength
>     = 'maxperlen'. So if i alter that, the freq smoothing should be
>     different as well, correct? Ye, anyway, I wonder how to optimize
>     all those parameters for my source localization statistics.
>
>
>     Yoni
>
>
>     On Wed, Oct 3, 2012 at 3:55 PM, <fieldtrip-request at science.ru.nl
>     <mailto:fieldtrip-request at science.ru.nl>> wrote:
>
>
>         Hi Yoni!
>
>         The extend of the smoothing, I would say, is under normal
>         circumstances
>         simply what you
>         request as a smoothing paramater (given the dpss
>         characteristics), so I
>         don't understand
>         that formulation exactly.
>
>         If different smoothings give drastically different result you
>         might be
>         sampling
>         frequencies that behave differently from your frequency of
>         interest. In
>         behave differently
>         in your
>
>         I would therefor try to first figure out if your effect is, in
>         fact,
>         frequency specific
>         and try to not to smooth more than necessary to capture that
>         effect. So
>         starting with no
>         (extra) smoothing and looking at the TFR for instance. A
>         simple FFT would
>         give you a
>         frequency smoothing of +/- 1/datalength already (e.g. half a
>         second would
>         be +/- 2 Hz).
>         Simply averaging over frequencies (estimated with a Hanning
>         of using the
>         slepian tapers might be a better option.
>
>         Then again, you are limited in frequency specificity by the
>         length of the
>         data on which
>         you calculate them. If that is too short you might have
>         suboptimal and
>         unexpected
>         effects. In the case of slepian filters make sure you have at
>         least a
>         minimum of 3 tapers
>         (which is shown in the output of freqanalysis).
>
>         There is a lot more to say about tapers, smoothing etc, but I
>         hope this
>         helps.
>
>         All the best,
>         Stephen
>
>         On 3 October 2012 15:14, Yoni Levy <yoniilevy at gmail.com
>         <mailto:yoniilevy at gmail.com>> wrote:
>
>         > Dear Fieldtrippers,
>         >
>         > I am trying to locate the source of an oscillatory effect at
>         the frequency
>         > of 30Hz in a time window of interest.
>         > Before running the ft_sourceanalysis function, I run a
>         ft_freqanalysis
>         > with a frequency smoothing of 8 (cfg.tapsmofrq =8).
>         > My question is whether there is any rule of thumb by which I
>         could
>         > reliably determine the extent of the smoothing?
>         > I found out that even small changes in the 'tapsmofrq' value,
>         > significantly alter the spatial localization of the
>         resulting sources.
>         > For instance, a tapsmofreq value of 8 would point to an
>         effect in the
>         > frontal lobe, whereas a value of 10 would point to an effect
>         in the
>         > parietal lobe.
>         >
>         > Any advice would be appreciated.
>         >
>         > Yoni
>         >
>
>
>     _______________________________________________
>     fieldtrip mailing list
>     fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>     http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
>
> _______________________________________________
> 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
Neuronal Oscillations Group
FieldTrip Development Team

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