[FieldTrip] correction for tapers

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Mon May 17 11:58:54 CEST 2021


Hi Jack,

> Thanks, by single-sided I meant 0-Nyquist scaled to account for the negative frequencies, so that was the exact information I was looking for. If you don't mind, I was also wondering if/what correction or scaling is applied to compensate for using tapers in 'ft_freqanalysis'. I can see that tapers are normalised in 'ft_specest_mtmfft' but I'm not clear on why that is or if that is related (e.g., see l.219-221 in ft_specest_mtmfft).
> 
> To be clear, could you please explain why the tapers are normalised and are any corrections applied to account for potential power lost by using tapers?

The tapers are normalised to have a frobenius norm (i.e. sum of squared values) of 1, in order to avoid the arbitrary scale (amplitude) of the taper (and the to some extent arbitrary choice of taper) to arbitrarily affect the scale of the estimated power spectrum. No corrections are performed to account for power loss induced by the tapers (I assume that you mean the loss of signal amplitude towards the edge of the finite time series, which is exactly the point of the whole tapering endeavour, since it reduces the spectral leakage).

Best wishes,
Jan-Mathijs


> In case it is relevant, in my current code I am using a Hanning taper (I actually plan to apply 10% hanning taper) with non-overlapping epochs of 2 seconds, as shown below.
> 
>   cfg = [];
>   cfg.method	= 'mtmfft';
>   cfg.output      = 'fourier';
>   cfg.taper       	= 'hanning';    
>   cfg.channel    	= 'all';
>   cfg.keeptaper = 'yes';
>   cfg.foi         	= [0.5:0.5:30];    % frequencies of interest, specific to mtfft
> 
>   % Run the frequency analysis and retain output for this subject
>   ac_data{1,s} = ft_freqanalysis(cfg,data);
> 
> Thanks again!
> Jack
> 
> 
> Date: Tue, 4 May 2021 07:04:17 +0000
> From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] does ft_freqanalysis output single or
> 	double-sided FFT amplitudes?
> Message-ID: <83DC54C9-3566-4608-8781-CED811C5FE20 at donders.ru.nl>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi Jack,
> 
> I don’t fully understand what you mean with single- or double-sided, but the basic output from Fieldtrip is the spectrum from 0-Nyquist, where the spectral quantities are normalised with sqrt(2/nsmp); the ‘2’ is to account for the negative frequencies. The correction step that you refer to in l.846-854 is to counteract the factor 2, because the DC and Nyquist frequency bins occur only once in the FFT output.
> 
> Best wishes,
> Jan-Mathijs
> 
> 
> 
> On 4 May 2021, at 03:41, Jack Fogarty <jf752 at uowmail.edu.au<mailto:jf752 at uowmail.edu.au>> wrote:
> 
> Hi Fieldtrip team,
> 
> Could you please clarify, do the ‘ft_freqanalysis’ or ‘ft_specest_mtmfft’ functions output data reflecting the single or double-sided fourier spectrum? The lines 846-854 in ft_freqanalysis suggests to me it should be single-sided – is that correct?
> 
> % correct the 0 Hz or Nyqist bin if present, scaling with a factor of 2 is only appropriate for ~0 Hz
> if ~isempty(hasdc_nyq)
>   if keeprpt>1
>     fourierspctrm(:,:,hasdc_nyq,:) = fourierspctrm(:,:,hasdc_nyq,:)./sqrt(2);
>   else
>     fourierspctrm(:,hasdc_nyq,:) = fourierspctrm(:,hasdc_nyq,:)./sqrt(2);
>   end
> end
> freq.fourierspctrm = fourierspctrm;
> 
> 
> Best,
> 
> Jack Fogarty, PhD
> Postdoctoral Research Officer
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qINdjeh1UTIFU2LkaE6z2ycCzrh_BDR7bl7WEt6Hqmbio_8Nz9Gbj0hgUltzns2FdV4m09qC$
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210504/125d4258/attachment-0001.htm>
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!oHGnoAhP4VUb9n_n9qGzCJ-GOrrtr_zbB6YFyIcFKrJ9lB8lbmuyMGfKgXwRYRUoPG_-CG2v$ 
> 
> 
> ------------------------------
> 
> End of fieldtrip Digest, Vol 126, Issue 3
> *****************************************
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!oHGnoAhP4VUb9n_n9qGzCJ-GOrrtr_zbB6YFyIcFKrJ9lB8lbmuyMGfKgXwRYRUoPG_-CG2v$ 








More information about the fieldtrip mailing list