[FieldTrip] TFR with different trial lengths

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Jun 26 11:30:51 CEST 2019


Dear Ioanna,

Yes, FieldTrip can work with trials of different duration. Normally, the missing data are represented as NaN, and not as a 0 (as it seems to be in your case). Many downstream functions know how to handle the missing data.

Could you try and run ft_freqanalysis with cfg.method = ‘wavelet’, and check whether there are now NaNs, instead of 0’s? The method ’tfr’ is very slow and not recommended. Therefore, this code is not very actively maintained, so it could be that the 0’s are just a remnant of a distant past. If so, this should be changed. Perhaps (once you have verified that indeed ’tfr’ returns 0’s, where ‘wavelet’ returns NaNs) you could look into how the correct impelmentation should be, and post a suggested fix to the ’tfr’-code on github as a PR?

Thanks in advance,

Jan-Mathijs


On 26 Jun 2019, at 11:12, Ioanna Zioga <i.zioga at qmul.ac.uk<mailto:i.zioga at qmul.ac.uk>> wrote:

Hello Fieldtrip community!

I want to do TFR analysis on datasets with trials with different lengths (as I'm analysing the time period from the onset of a stimulus until participant's response, which differs from trial to trial).

These are the parameters:

cfgft                   = [];
cfgft.method    = 'tfr';
cfgft.output      = 'pow';
cfgft.foi              = exp(linspace(log(2),log(45),50));
cfgft.toi              = [];
cfgft.width         = 6;
cfgft.keeptrials  = 'yes';


The result I get from the freqanalysis (powspctrm) is a trial x chan x freq x time matrix, in which the time is the time of the trial with the largest duration. The datapoints of the trials with smaller durations are filled with zeros.

I would prefer to get the powspctrm without the zeros at the end, but maybe I can just exclude them later on from the analysis?
Do you know if Fieldtrip works fine with trials of different durations? And if there is any other more efficient way to analyse trials with different durations?

Any help would be extremely appreciated, thanks so much in advance!

Best wishes,
Ioanna

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190626/10aacd5a/attachment-0002.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