Back to the main page.

Bug 3379 - ft_redefinetrial fails on overlapping trials

Reported 2017-12-04 10:07:00 +0100
Modified 2018-03-02 15:05:31 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Robert Oostenveld - 2017-12-04 10:07:43 +0100

test_bug3267 us currently broken as a consequence of, which See #3267. See also the related #79, #128 and #1013.

Giorgos Michalareas - 2018-01-12 21:38:41 +0100

Created attachment 854 Issue with overlapping data and ft_fetch_data and ft_redefinetrial

Giorgos Michalareas - 2018-01-12 21:41:59 +0100

Comment on attachment 854 Issue with overlapping data and ft_fetch_data and ft_redefinetrial there seems to be a problem with ft_redefinetrial and ft_fetch_data when one puts data with overlapping trials. I have attached the file testdatafile containing variables testdata and a tmpcfg with a new trial definition. check the trial definition of the first trial in testdata and in tmpcfg. It is the same. But when u put in ft_redefinetrial the data comes out messed up with a discontinuity! %================================= load testdatafile testdata tmpcfg testdata2 = ft_redefinetrial(tmpcfg, testdata); iTrl=1; figure; hold on; plot(testdata.time{iTrl},testdata.trial{iTrl}(1,:)); plot(testdata2.time{iTrl},testdata2.trial{iTrl}(1,:),'r'); %==================================

Jan-Mathijs Schoffelen - 2018-01-16 13:29:45 +0100

I looked into this, and have two observations: 1) the data is inconsistent in its overlap (probably due to filtering or detrending or so) 2) ft_fetch_data should have thrown an error, because there's some specific code in place to test for this issue. I created a test function, and updated ft_fetch_data, so that now an error is correctly thrown when the test data supplied by Giorgos are used. PS: @ Giorgos, why do you not use ft_selectdata in this case, with the option cfg.trials, since you only seem to throw away a few trials completely. I am not yet sure whether the issue reported by Giorgos is related to the original reason why this current bug has been filed. I have created a branch for this bug in my fork of the repo. I will only pull once I have an idea what's going on here in relation to the original report. If you want to use the fixed version of ft_fetch_data, for now you can pull it from https:/ (branch bug3379)

Jan-Mathijs Schoffelen - 2018-01-16 13:35:37 +0100

The original reason for this bug report is the fact that test_bug3267 explicitly throws an error in the presence of a sampleinfo field in a timelock structure. This has nothing to do with Giorgos' report. Rather, it was introduced by me addressing bug 3354

Jan-Mathijs Schoffelen - 2018-01-26 09:49:09 +0100

This one can be closed, because it turned out to be a user error that went undetected because a flaw in the code that was supposed to check for this. This has now been addressed, and merged into the FT repo with PR 646

Jan-Mathijs Schoffelen - 2018-03-02 15:05:31 +0100