Back to the main page.

Bug 2260 - ft_selectdata_new removes .avg field in timelock data if keeptrials = 'yes'

Reported 2013-08-22 10:15:00 +0200
Modified 2014-06-18 12:33:12 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Jim Herring - 2013-08-22 10:15:56 +0200

When keeptrials='yes', the dimord of timelock data is rpt_chan_time, ft_select_data therefore decides that the .trial field is the relevant data field and .avg is then ignored. I ran into this bug when attempting to use ft_math on two timelock structures. A quick hack would be to add the .avg field to 'keep' (a variable that contains other fields that should be kept) if datatype is 'timelock'. Joern, I noticed that you have been working on this function so I've added you to the cc list.

Johanna - 2013-08-22 10:21:29 +0200

Just curious though: what is the desired value to retain in the .avg field in this case? The mathematical operation applied to the 2 separate .avg fields, or the recomputed average of the new .trial structure to which the mathematical operation has been applied?

Jim Herring - 2013-08-22 10:31:30 +0200

In ft_math you select which parameter (field) to apply the operation to. So in this case I specified parameter = '.avg'. I therefore wish to apply the operation on the .avg fields. It is a good point though although in my case I would wonder what to do with the .trial field? Maybe it makes more sense to remove the .trial field in this case and change the dimord to match the .avg field.

Jörn M. Horschig - 2013-08-22 11:02:52 +0200

did you check what ft_selectdata_old does in that case? The timelock-structure is weird to me anyway: with keeptrials, the .trials field is the relevant part, else the .avg. Imho there should be either-or and the fieldname should be the same, just like for freq structures and powspctrm. btw, the selectdata_new function is mostly JMs work, and Diego and me also worked on it a bit. Maybe they have an idea?

Jim Herring - 2013-08-22 11:14:21 +0200

ft_selectdata_old keeps both the .avg and .trial field. I've added JM to the cc list. I think what should happen is that ft_selectdata should retrieve the field specified in cfg.parameter and reconstruct the dimord (if possible), if the dimord does not relate to the selected data field.

Jan-Mathijs Schoffelen - 2014-04-07 16:39:15 +0200

added Robert to CC list to join the party...

Robert Oostenveld - 2014-04-15 18:57:35 +0200

ft_selectdata_newer will also retain both avg and trial field. I am presently sorting out all bugs related to selectdata and (if the newer implementation addresses all of them) will make the newer implementation the final one.