Back to the main page.

Bug 2884 - Bug in ft_definetrial

Reported 2015-04-29 14:31:00 +0200
Modified 2015-07-15 13:31:09 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P5 major
Assigned to: Robert Oostenveld
Depends on:
See also:

kevin Prinsloo - 2015-04-29 14:31:07 +0200

Hi there, While doing some standard pre-processing I have come across a bug in ft_definetrial. The error is not in the script as it is the same one I have been using for a while. The data is not an issue as I have already pre-processed this data before with no problems. I would attached one subjects' data from 1 block but it is too large. The same problem comes up with any c,rfDC datafile This is using the latest version of Fieldtrip Below is the script % triggers trig = 10:2:48; cfg = []; cfg.headerfile = 'c,rfDC'; cfg.datafile = cfg.headerfile; = {'all'}; cfg.continuous = 'yes'; cfg.trialfun = 'ft_trialfun_general'; cfg.trialdef.eventtype = 'TRIGGER'; cfg.trialdef.eventvalue = trig; cfg.trialdef.prestim = 1; %seconds cfg.trialdef.poststim = 2; %seconds cfg.headerformat = '4d'; cfg.detrend = 'yes'; cfg = ft_definetrial(cfg); My apologies if this is not the correct way to submit a bug, this is the first time I am doing this. Many Thanks Kevin data{idir} = ft_preprocessing(cfg);

Jim Herring - 2015-04-29 14:36:41 +0200

Hi Kevin, could you please describe what the error message is that you get or what you think is wrong?

kevin Prinsloo - 2015-04-29 14:44:15 +0200

The error message is: Error using ft_definetrial (line 184) no trials were defined, see FT_DEFINETRIAL for help. This is the same error when my colleagues get when trying to pre-process their data. We have gone back to some participants data that we know is good and should have any issue. The error persists even wehn changing the script slightly for looking at different data sets with different trigger values, or different trials events. Thanks Kevin

Diego Lozano Soldevilla - 2015-04-29 14:49:51 +0200

(In reply to kevin Prinsloo from comment #2) Hi Kevin and Jim, I got the same issue today. The error is due to ft_trialfun_general introduced in r10345 No clue what's the eventtype=gui option but probably it's a new feature Robert is working on Diego

Robert Oostenveld - 2015-04-29 18:14:38 +0200

(In reply to Diego Lozano Soldevilla from comment #3) bummer, that is indeed something I have been messing with. The option was there for ages already (it is used in SPM), but I made some "improvements" to it. @Kevin and Diego: would it be possible to send me the header and event (i.e. output of ft_read_header and ft_read_event) of the dtaaset, together with the cfg that you pass into ft_definetrial? That should allow me to debug...

Diego Lozano Soldevilla - 2015-04-30 00:31:28 +0200

(In reply to Robert Oostenveld from comment #4) Hi Robert, Thank you for your prompt reply. I cannot attach cfg, hdr and event becuase it was too big. But using tutorial data and inserting a debug break point in ft_trialfun_general line 95 you'll get the info you need dataset = '/home/common/matlab/fieldtrip/data/Subject01.ds'; cfg = []; cfg.dataset = dataset; cfg.trialdef.eventtype = 'backpanel trigger'; cfg.trialdef.prestim = 1; cfg.trialdef.poststim = 2; cfg.trialdef.eventvalue = 3; cfg = ft_definetrial(cfg);

Robert Oostenveld - 2015-04-30 08:52:56 +0200

(In reply to Diego Lozano Soldevilla from comment #5) thanks, that was indeed sufficient to reproduce It was due to a stupid mistake, as I added more complex checks for event type I forgot to test for a simple strcmp. I now also see that some of the test scripts started failing, e.g. I fixed it. mac011> svn commit trialfun/ ft_definetrial.m Sending ft_definetrial.m Sending trialfun/ft_trialfun_general.m Transmitting file data .. Committed revision 10356. @Kevin: This evenings ftp version will have the fix. If you cannot wait, add the following lines to the "ismatch" helper function at the bottom of ft_trialfun_general. elseif ischar(x) && ischar(y) s = strcmp(x, y);

Diego Lozano Soldevilla - 2015-04-30 09:21:45 +0200

(In reply to Robert Oostenveld from comment #6) Thank you very much for your quick fix Robert!

kevin Prinsloo - 2015-04-30 09:42:23 +0200

Hi Robert, Thank you for your prompt reply and the quick solution to the problem! @ Diego thank you for helping out with this issue.

Robert Oostenveld - 2015-07-15 13:31:09 +0200

closed several bugs at once that were recently fixed