Back to the main page.
Bug 1496 - fixsampleinfo bug with timelock data without trials
Status | CLOSED FIXED |
Reported | 2012-05-30 12:22:00 +0200 |
Modified | 2012-08-23 10:33:50 +0200 |
Product: | FieldTrip |
Component: | fileio |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P3 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Martin Vinck - 2012-05-30 12:22:02 +0200
fixedsampleinfo currently rejects timelock structures that do not have a trial field (where cfg.keeptrials was 'no') as they are then treated incorrectly as a raw structure. -- ??? Cell contents reference from a non-cell array object. Error in ==> fixsampleinfo at 95 offset(i) = time2offset(data.time{i}, data.fsample); perhaps I'm missing something
Robert Oostenveld - 2012-05-31 16:46:14 +0200
this must be in "utilities/ft_checkdata.m" line 591 where if isequal(hassampleinfo, 'yes') || isequal(hassampleinfo, 'ifmakessense') data = fixsampleinfo(data); end because the only other call to fixsampleinfo is in ft_datatype_raw, which will only be called on raw data (and hence have a trial cell-array). sampleinfo is only valid for raw data. "utilities/ft_checkdata.m" line 175 has if israw data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo); elseif ... That means that the call on line 591 is not needed, because the sampleinfo will be (conditionally on the data being raw) be fixed on line 175. I removed the lines around 175. Note to self: I still have to commit, the changed file is on mbp/fieldtrip-clean .
Robert Oostenveld - 2012-05-31 16:47:04 +0200
(In reply to comment #1) The statement "I removed the lines around 175" should have read "I removed the lines around 591"
Robert Oostenveld - 2012-05-31 16:55:29 +0200
there is one potential case where the change won't work. Imagine ft_checkdata(timelock, 'datatype', 'raw', 'hassampleinfo', 'yes') where timelock is the output from ft_timelockanalysis with keeptrials=yes and without sampleinfo. This also applies for other input types that can be converted to raw. The conversion will be done from line 228 onward, whereas the sampleinfo is added on line 175 only in case if the data is raw at that moment. actually, now that I think of it the whole section % the ft_datatype_XXX functions ensures the consistency of the XXX datatype % and provides a detailled description of the dataformat and its history is done before all conversions, which means that the converted input data xxx data after xxx2yyy is not passed through ft_datatype_yyy The initial pass through ft_datatype_xxx is ok, but after the conversion it should also be passed through ft_datatype_yyy. I suggest to change the sections if isequal(dtype(iCell), {'source'}) && isvolume data = volume2source(data); .... into if isequal(dtype(iCell), {'source'}) && isvolume data = volume2source(data); data = ft_checkdata_source(data); .... and idem for all other conversions
Robert Oostenveld - 2012-06-01 09:19:14 +0200
(In reply to comment #3) I have implemented it as suggested in comment 3. All calls to ft_datatype_raw include the optional hassampleinfo flag. mbp> svn commit utilities/ft_checkdata.m Sending utilities/ft_checkdata.m Transmitting file data . Committed revision 5836.