[FieldTrip] timeseries analysis

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Fri Feb 21 11:57:38 CET 2014


Hi Tim,

interesting approach to use FieldTrip for fMRI data, keep us updated on 
your progress, please!

Your error is rather straightforward. You need to specify a time-axis 
for each trial rather than a common time-axis. And pay attention to the 
dimensions. data.trial has to be cell-array where each trial is defined 
as nChans x nSamples. data.time needs to be cell-array and it's elements 
need to be 1 x nSamples. Lastly, data.label needs to be a cell-array 
with dimensions nChans x 1. for more information, see here:
http://fieldtrip.fcdonders.nl/faq/how_can_i_import_my_own_dataformat

Regarding your questions:
> 1. Am I on the right track?
yes, but maybe better define time in seconds than in samples, otherwise 
you're good.
> 2. Is there a better function to be using?
probably no, you need to hack it yourself together
> 3. Am I using the proper data format as an import?
if FT cannot read your data it by ft_read_data, then yes, this is the 
best (and only) way
> 4. The code is 'assuming that the trials are consecutive segments of a 
> continuous recording', which is not the case for me, so what 
> can/should I do about that?
you can define data.sampleinfo which specifies at what sample your trial 
started and ended relative to the actual recording. But, this 
information might not be necessary for now, so maybe just ignore the 
warning until you run into other problems.
> 5. Does anyone have a template matlab script and demo dataset (for 
> timeseries analysis) that runs without errors, that I could look at? 
> It would help me to just step through the analysis to see what's 
> happening, and an example of input data/parameters.
please see the link above for examples.

Best,
Jörn




On 2/18/2014 8:44 PM, Timothy J Wanger wrote:
> Hi,
>
> My name is Tim Wanger, I am a graduate student working with Dean 
> Sabatinelli at the University of Georgia. This is my first attempt at 
> using Field Trip. In order to familiarize myself with the software and 
> learn how it can analyze data collected at our lab, I put together a 
> small dataset containing fMRI timeseries from two different 
> experimental conditions(arousing/not-arousing). After looking through 
> the documentation on the Field Trip website, I came to the conclusion 
> that 'ft_timelockanalysis' could be used to analyse timeseries data. 
> After setting up a cfg variable, and importing my data(does not need 
> preprocessing), I tried running ft_timelockanalysis, but there were 
> some errors that I am not sure how to fix. I was wondering if anyone 
> could help me sort this out.
>
> data.label=region'; % region info
> data.fsample=4; % 250ms sampling rate (4Hz)
> data.trial=timeseriesdata; % our data, <158x50 cell> matrix. trials 
> have already been excised from raw data
> data.time=num2cell(1:length(timeseriesdata)); % represent time in samples
> data.trialinfo=arousalrating'; % experimental condition information
>
> cfg.channel='all';
> cfg.trials= 'all';
> cfg.covariance='no';
> cfg.covariancewindow='all';
> cfg.keeptrials='no';
> cfg.removemean='yes';
> cfg.vartrllength=2; % some trials are missing the 50th sample
>
>
> Here is the error I am currently receiving, with some relevant Matlab 
> command window output.
>
> the input is raw data with 1 channels and 158 trials
> Warning: removing inconsistent sampleinfo
> > In ft_datatype_raw at 109
> In ft_checkdata at 213
> In ft_timelockanalysis at 105
> In testing_fieldtrip at 49
> Warning: the data does not contain a trial definition
> > In utilities/private/warning_once at 116
> In utilities/private/fixsampleinfo at 66
> In ft_datatype_raw at 158
> In ft_checkdata at 213
> In ft_timelockanalysis at 105
> In testing_fieldtrip at 49
> Warning: reconstructing sampleinfo by assuming that the trials are 
> consecutive segments of a continuous
> recording
> > In utilities/private/warning_once at 116
> In utilities/private/fixsampleinfo at 79
> In ft_datatype_raw at 158
> In ft_checkdata at 213
> In ft_timelockanalysis at 105
> In testing_fieldtrip at 49
>
> ??? Index exceeds matrix dimensions.
> Error in ==> fixsampleinfo at 95
> offset(i) = time2offset(data.time{i}, data.fsample);
> Error in ==> ft_datatype_raw at 158
> data = fixsampleinfo(data);
> Error in ==> ft_checkdata at 213
> data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);
> Error in ==> ft_timelockanalysis at 105
> data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback', 
> 'yes', 'hassampleinfo', 'yes');
> Error in ==> testing_fieldtrip at 49
> [timelock] = ft_timelockanalysis(cfg, data);
>
>
> So, my questions are:
> 1. Am I on the right track?
> 2. Is there a better function to be using?
> 3. Am I using the proper data format as an import?
> 4. The code is 'assuming that the trials are consecutive segments of a 
> continuous recording', which is not the case for me, so what 
> can/should I do about that?
> 5. Does anyone have a template matlab script and demo dataset (for 
> timeseries analysis) that runs without errors, that I could look at? 
> It would help me to just step through the analysis to see what's 
> happening, and an example of input data/parameters.
>
> Thanks in advance!
> -Tim Wanger​
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands




More information about the fieldtrip mailing list