[FieldTrip] TFR zero padding duration?

Ioanna Zioga i.zioga at qmul.ac.uk
Fri Jun 28 00:08:53 CEST 2019


Dear Fieldtrip community!

I would like to ask for your advice on zero padding when doing TFR analysis.

I'm analysing trials of different lengths, so I loop over the trials to run ft_freqanalysis.
I read in the tutorials that the padding length should be >= to the length of the trial.

Therefore, I prepared these parameters:

cfg = [];
cfg.method = 'wavelet';
cfg.output = 'pow';
cfg.foi = [2:1:40];
cfg.width = 6;
cfg.keeptrials = 'yes';
cfg.toi = data.time{1};
cfg.pad = round(length(data.time{1}(1,:))/500)+5; % duration of trial plus 5 seconds
% my sampling rate is 500
res = ft_freqanalysis(cfg,data);

Even if I add 5 seconds more to the length of the cfg.pad, SOMETIMES (and I
cannot figure out a pattern..), I get this error:
Error using ft_specest_wavelet (line 60)
the padding that you specified is shorter than the data

Error in ft_freqanalysis (line 505)
        [spectrum,foi,toi] = ft_specest_wavelet(dat, time, 'timeoi', cfg.toi, 'width', cfg.width, 'gwidth', cfg.gwidth,options{:},
        'feedback', fbopt);

The length of the above trial was 20 seconds (+5 secs padding).
Do you have any idea what is the problem?

Freqanalysis runs smoothly in trials with other trials with smaller or longer duration, and I can't find a pattern of when this error comes up..

Any idea would be extremely helpful, thanks so so much in advance!

Best,
Ioanna

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190627/315aeb32/attachment-0001.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list