[FieldTrip] Padding with mtmfft and mtmconvol

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Sep 21 11:53:05 CEST 2017


Hi to all who’s reading along,

Perhaps the two cases will become more similar once the ‘timwin’ is increased in length for the mtmconvol case….

Best wishes,

JM

On 20 Sep 2017, at 16:26, Robert Oostenveld <r.oostenveld at donders.ru.nl<mailto:r.oostenveld at donders.ru.nl>> wrote:

Hi Vladimir,

I suggest that you first start with a simpler case, like this

fsample = 1000;
time = (1:1000)/fsample;
dat = randn(size(time));

[spectrum1,ntaper1,freqoi1] = ft_specest_mtmfft(dat, time, 'taper', 'hanning');

power1 = abs(spectrum1).^2;
power1 = squeeze(power1);

[spectrum2,ntaper2,freqoi2,timeoi2] = ft_specest_mtmconvol(dat, time, 'taper', 'hanning', 'timeoi', mean(time), 'timwin', 0.5);

power2 = abs(spectrum2).^2;
power2 = squeeze(power2);

figure
plot(freqoi1, power1);
hold on
plot(freqoi2, power2, 'r');

Note that these are not the same (albeit similar), which I had expected…

best
Robert



On 20 Sep 2017, at 12:56, Vladimir Litvak <litvak.vladimir at gmail.com<mailto:litvak.vladimir at gmail.com>> wrote:

Dear Fieldtrippers,

I'm looking into an issue of one of SPM users who gets different results when doing TF decomposition compared to computing a spectrum for the same time window. I'm not sure I got to the bottom of it yet but one thing I found is that ft_specest_mtmfft and ft_specest_mtmconvol are affected differently by increasing padding. For short padding the results are similar but with increasing padding there are differences both in offset of the spectrum and its overall shape. See attached images where the top one shows original spectra and the bottom one aligns the lowermost bin to zero.

Is this a bug or a feature?

Below is the script that produces these plots. I could provide the data as well but this could probably be reproduced with any data.

Thanks,

Vladimir


-------------------------------------

pad = 0.5;%1%10


freqoi = 5:45;
timwin = 0.4+0*freqoi;

[spectrum,ntaper,freqoi,timeoi] = ft_specest_mtmconvol(data, time, 'taper', 'hanning', 'timeoi', 1.2, 'freqoi', freqoi,...
    'timwin', timwin, 'tapsmofrq', 1, 'verbose', 0, 'pad', pad);

s1 = squeeze(mean(mean(abs(spectrum), 4), 2));

figure;
subplot(2,1,1)
plot(freqoi, s1);
subplot(2,1,2);
plot(freqoi, s1-s1(1));
%%
[spectrum,ntaper,freqoi] = ft_specest_mtmfft(data, time, 'taper', 'hanning', 'freqoi', freqoi,...
    'tapsmofrq', 1, 'verbose', 0, 'pad', pad);

s2 = squeeze(mean(mean(abs(spectrum), 2), 1));

subplot(2,1,1)
hold on
plot(freqoi, s2, 'r');
subplot(2,1,2)
hold on
plot(freqoi, s2-s2(1), 'r');
<pad0_5.png><pad1.png><pad10.png>_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170921/88d79bf6/attachment-0002.html>


More information about the fieldtrip mailing list