Back to the main page.

Bug 2783 - ft_definetrial doesn't work with timelock data of 'rpt_chan_time' with only 1 trial

Status CLOSED FIXED
Reported 2014-12-15 18:09:00 +0100
Modified 2019-08-10 12:31:18 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also: http://bugzilla.fcdonders.nl/show_bug.cgi?id=2782

Johanna - 2014-12-15 18:09:46 +0100

Hello, Similar to the bug I just filed (bug 2782), I again have a timelock structure with dimord 'rpt_chan_time' and only 1 trial (in the .trial field). If I run this: cfg=[]; cfg.trials=1; cfg.offset=-67; tmp=ft_redefinetrial(cfg,timelock) then I get tmp out with .avg field rather than .trial. The reason for this is that on line 108, the data is converted to raw and the dimord is not saved. Then the processing is done, and then at the end on line 321 it converts it back to timelock. However, because only 1 trial exists, ft_checkdata assumes it is averaged data and creates a .avg field rather than the original .trial. This is incorrect and causes problems for my code further on expecting a .trial field. Unlike bug 2782 in which the user (me) is a bit silly to call ft_selectdata to select 1 trial when there is already only 1 trial, in this case the cfg.offset is doing something necessary so I can't skip the call to ft_redefinetrial. Thank you, Johanna


Eelke Spaak - 2015-01-27 13:42:55 +0100

This should be fixed now. Since there is no way of determining from raw data with one trial (which is what ft_redefinetrial works with in its main body) whether it originated from timelock-data with only a .avg or (also) a .trial, I added the latter as a special case. (This is also how timelock data in general was already being treated by ft_redefinetrial.) I considered adding some option 'forcesinglerpt' or so to ft_checkdata, to handle the special case there, but in the end I think that would be rather ugly, since the bookkeeping of what the original data type was belongs in the function calling ft_checkdata anyway. bash-4.1$ svn commit ft_redefinetrial.m test/test_bug2783.m Sending ft_redefinetrial.m Adding test/test_bug2783.m Transmitting file data .. Committed revision 10126.


Robert Oostenveld - 2019-08-10 12:31:18 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.