[FieldTrip] TFR with different trial lengths

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Wed Jun 26 11:58:32 CEST 2019


Dear Ionna,

 

First of all, in general FieldTrip works very well with different trial
durations (that's why there is a 'time' field for every trial in a 'raw'
data structure), at least in those functions where it makes sense, although
it's definitely something to always check (never hurts).

 

Secondly, in my memory at least, 'mtmfft' returns NaNs where there is no
data, but the implementation of 'tfr' might be different and I trust that
you have 0s J But it's something to keep in mind as this suggests that you
might have unexpected results if you change methods. It also emphasizes that
you are asking freqanalysis to calculate power of data that doesn't exist
and although it seems handy, it might not be the most consistent way of
scripting your analysis in the end. In particular when you will be
averaging, calculating relative differences (baseline correction e.g.),
etc., where you might not keep track of the fact that you are using 0s as if
this was true data.

 

In such situations as you describe, I myself typically do two different
analysis: first I preprocess and epoch the stimulus-locked timecourse data
once using the full (different) trial lengths, and then split my
time-frequency-analysis up into one stimulus-locked analysis, and one
response-locked analysis  (after re-aligning stimulus-locked data to the end
of the trial), both using the shortest time duration. This allows me to
easily average the time-frequency-data over trials without having different
time-points/windows that I would have gotten if I was trying to
response-lock TFR data that was calculated on stimulus-locked data. This is
especially the case when using sliding time-windows (method = 'mtmfft')
where those time-windows won't perfectly align in time. (and using sliding
time-windows with mtmfft, using steps of e.g. 0.05s will be more
memory-efficient than calculating a wavelet for every time-point). Also, it
would mean that all my power-estimates over time will have the same amount
of trials.

 

You can also ofcourse, if you really want to, loop over trials and append
the trials (powspctrm and time) afterwards.

 

Although not a direct answer to your question perhaps, I hope this helps.

 

Cheers,

Stephen

 

 

 

 

 

 

From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Ioanna Zioga
Sent: Wednesday, June 26, 2019 11:12 AM
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] TFR with different trial lengths

 

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

 

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