[FieldTrip] ft_singleplotER, ft_checkdata/raw2timelock and errors with negative timepoints

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Tue Mar 19 08:17:49 CET 2013


HI Daniel,

thanks for reporting this. Strange error... but it should not be related 
to having timepoint before 0. The fix of the time-axis in raw2timelock 
was implemented because of numerical inaccuracies that can occur across 
trials. For example, some trials might start at -0.24999 others at -0.25 
(this can happen during acquisition or during resampling, etc., also 
computers make errors, especially when dealing with decimals). When 
computing a common time-axis, Matlab would compare these two values and 
treat them as two samples before 0 rather than 1  (which strictly 
speaking is true). So a common time-axis needs to be build, which is 
invariant to small differences. Unfortunately, that was not very trivial 
to accomplish. I've build a test scripts which tests very many different 
cases for which this function works fine. So first, just to be sure, are 
you using the most recent version of FieldTrip?

Most colleagues in our group including myself are interested in the 
prestimulus period, so if this was a trivial error, we probably would 
have found it long time ago ;) However, it might be that it indeed 
breaks with your data nonetheless due to some reason. Since this might 
be specific to some few datasets, it would be great if you could send me 
a snippet of your data (like one or two trials) together with some lines 
of code to reproduce this error. It is quite nasty to debug this stuff, 
so in order to not keep you from doing research, just go ahead with the 
fix you implemented for this one dataset, but be aware that I am pretty 
sure that it will break for other datasets ;)

Best regards,
Jörn


On 3/18/2013 7:18 PM, Daniel Stolzberg wrote:
> Hello,
>
> I have been working with continuous data trials which begin before the 
> trigger occurs (ex: [-0.25 1.0] sec) and have run into a snag when 
> using ft_singleplotER.  The error occurs in the raw2timelock 
> subfunction of ft_checkdata after calling ft_singleplotER with a time 
> axis that includes pre-trigger (i.e. < 0) time points.  This error may 
> not be for ft_singleplotER, but it is the function I was trying to use.
>
> Here is the error:
> > Subscripted assignment dimension mismatch.
> >
> > Error in ft_checkdata>raw2timelock (line 1753)
> >     tmptrial(i,:,begsmp(i):endsmp(i)) = data.trial{i};
> >
> > Error in ft_checkdata (line 302)
> >         data = raw2timelock(data);
> >
> > Error in ft_singleplotER (line 186)
> >   varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'timelock', 
> 'freq'});
>
> After some debugging, I found that the number of samples used to 
> (re)generate the time vector is always 1 sample too small if there are 
> negative time values.  I assume that this is because the time point 0 
> is not being considered (?).  By adding the following line to 
> raw2timelock in ft_checkdata of the most recent build, I was able to 
> get around any errors in this subfunction and all is now copacetic:
>
> line 1740:    nsmp = nsmp + any(time<0); % <--- acounting for 
> timepoint at 0?
>
> I don't know if anyone else has run into this problem but I thought I 
> would share this with the community.
>
> Regards,
> Dan
>
> -- 
> Daniel Stolzberg, PhD
> Post-doctoral Fellow
> Cerebral Systems Laboratory
> Department of Physiology and Pharmacology
> Schulich School of Medicine & Dentistry
> University of Western Ontario
> http://www.cerebralsystems.ca/
>
>
> _______________________________________________
> 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

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


More information about the fieldtrip mailing list