[FieldTrip] Problem using ft_preprocessing to segment .cnt files

Ines Bramao ines.bramao at psy.lu.se
Fri Oct 24 13:47:10 CEST 2014


Dear Jan-Mathijs,

Thank you very very much for looking into this issue!
I will create the account at the bugzilla.fcdonders in order to follow up this. Please tell me if I can help in some other way (for example, provinding you more data).

Best wishes,
Inês

________________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Lam, N.H.L. (Nietzsche) [n.lam at fcdonders.ru.nl]
Sent: 24 October 2014 13:04
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Problem using ft_preprocessing to segment .cnt files

Hi Ines,
I just tried to reproduce your issue, and I can confirm the ‘repetition’ issue. With some debugging I found out that occasionally the fseek on line 364 in loadcnt fails, which results in the file pointer not being adjusted to the correct location in the file. As a consequence a fixed chunk of data is read, which I assume results in the repetition of the segments. The cause of this fseek failure seems to lie in the fact that the ‘startpos’ variable on line 364 is non-integer. This is a bit strange, because this variable is created in line 339, by a multiplication of r.t1 with h.rate (and some other things), while r.t1 is created a few lines above by a division of r.sample1 (which is an integer sample number) with h.rate. I suspect there is something going wrong with the finite numerical precision that causes c=a/b followed by b*c not to yield exactly a. I am a bit intrigued by the fact that using eeglab for segmentation works for you, but it could be that loadcnt is used in a!
 slightly different way in there. For now I don’t know a solution yet, but I will file a bug on our bugzilla.fcdonders.nl<http://bugzilla.fcdonders.nl><http://bugzilla.fcdonders.nl> website so that we can follow this up. I suggest that you create an account there so that you can be kept in the loop with respect to the resolution of this issue.

Best wishes,
Jan-Mathijs



On Oct 23, 2014, at 4:02 PM, Ines Bramao <ines.bramao at psy.lu.se<mailto:ines.bramao at psy.lu.se><mailto:ines.bramao at psy.lu.se>> wrote:

Hi all,



When I am using ft_preprocessing to segment the data from the continuous eeg .cnt file I get segments that are exactly the same. That is, pieces of the data that correspond to different trials and that are exactly the same! I don’t really know if I am doing something wrong or if there is a problem in the interaction of the ft_preprocessing and the loadcnt function!!!! I am not new using fieldtrip, but I am new with .cnt files.



I have been checking and trying different things:
1) My trl matrix seems to be properly defined;
2) When I use curry or eeglab to segment the data I don’t get this weird repeated segments;
3) Extracting the original data using ft_read_data and looking into the values that correspond to the samples of the repeated segments show that the original data of those segments is different!
4) Importantly, while I am extracting the segments from the data using ft_preprocessing I get a warning message “events imported with a time shift might be innacurate”… (this do not happen with eeglab and the function for loading .cnt files is apparently the same);
5) This is not a problem of only one participant and one of my colleagues is experiencing exactly the same problem.



Here is the configuration that I am using to run ft_preprocessing



cfg =
     dataset: 'D:\Subj01\1-OriginalData\Subj01.cnt'
     dataformat: 'ns_cnt32'
     headerformat: 'ns_cnt32'
     eventformat: 'ns_cnt32'
     demean: 'yes'
     baselinewindow: [0 0.2000]
     reref: 'yes'
     refchannel: {'A1'  'A2'}
     implicitref: {'A1'}
     channel: {'all'  '-A1'  '-TP9'  '-TP10'  '-FT10'  '-FT9'  '-Trigger'}
     trl: [312x5 double]

Using this code on the output of the preprocessing shows me that trials 12, 85, 86, 87 and 89 are exactly the same!!!!!
repeatedtrials =[];
for i = 1:length(PreProcArtifact_cue.trial)
   for j = 1:length(PreProcArtifact_cue.trial)
       if PreProcArtifact_cue.trial{i} == PreProcArtifact_cue.trial{j}
           if i ~= j
               repeatedtrials(1+end,:) = [i j];
           end
       end
   end
end

I uploaded my original data file, my trl matrix and the output of the preprocessing here:https://www.dropbox.com/sh/k2nmg50le34v8a0/AAB6odjOx8wnRz10FdG4YlyXa?dl=0<http://www.dropbox.com/sh/k2nmg50le34v8a0/AAB6odjOx8wnRz10FdG4YlyXa?dl=0>



Please can someone check if I am doing something wrong in order to get exactly the same segment in a different sample interval after using ft_preprocessing? It has been really frustrating to try to figure out what can be wrong and I am starting to believe that there is a problem in ft_preprocessing while segmenting .cnt files? Can this be the case????



Thank you very very much!
Inês Bramão
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl><mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip






_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip



More information about the fieldtrip mailing list