Back to the main page.

Bug 2464 - ft_selectdata "cfg.foilim" setting is ignored but its use is recommended in the help

Status CLOSED FIXED
Reported 2014-01-30 12:20:00 +0100
Modified 2014-03-06 15:36:32 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Philipp Taesler - 2014-01-30 12:20:22 +0100

Created attachment 588 sample data reduced in size to reproduce the reported behaviour ft_selectdata (or rather ft_selectdata_new) will ignore the cfg.foilim setting (at least for frequency data). The cfg.frequency setting is the one that seems to work, however the help section for ft_selectdata_new is advocating the use of "foilim" ("cfg.frequency = [beg end] -> this is less common, preferred is to use foilim" (from help)): freq = label: {61x1 cell} dimord: 'chan_freq_time' freq: [1x44 double] time: [0 0.0520 0.1000] powspctrm: [61x44x3 double] cumtapcnt: [45x44 double] cfg: [] cfg = foilim: [10 20] test = ft_selectdata(cfg, freq) the call to "ft_selectdata_new" took 0 seconds test = label: {61x1 cell} dimord: 'chan_freq_time' freq: [1x44 double] time: [0 0.0520 0.1000] powspctrm: [61x44x3 double] cumtapcnt: [45x44 double] cfg: [1x1 struct] Whereas cfg = frequency: [10 20] produces test = label: {61x1 cell} dimord: 'chan_freq_time' freq: [1x11 double] time: [0 0.0520 0.1000] powspctrm: [61x11x3 double] cumtapcnt: [45x44 double] cfg: [1x1 struct] Also, the cumtapcnt field seems unaffected, but I'm not sure if this is intended or not. Tested with fieldtrip-20140121. May be related to bug 1881


Jan-Mathijs Schoffelen - 2014-02-12 14:27:07 +0100

will look into it, thanks for reporting.


Jan-Mathijs Schoffelen - 2014-02-14 14:33:26 +0100

Hi Philipp, I have been fooling around with ft_selectdata_new for some other purpose, but it seems to have resolved your problem along the way (with revision 9200). That is, cfg.foilim and cfg.frequency now give the same results. The only thing left now is to prune the cumtapcnt...


Jan-Mathijs Schoffelen - 2014-02-14 14:34:09 +0100

To verify: cfg = []; cfg.foilim = [10 20]; sel = ft_selectdata(cfg, freq); cfg = []; cfg.frequency = [10 20]; sel2 = ft_selectdata(cfg, freq); assert(isequal(rmfield(sel, 'cfg'), rmfield(sel2, 'cfg'))); % the cfg needs to be removed because they are by construction different...


Jan-Mathijs Schoffelen - 2014-02-14 14:41:25 +0100

hmmm, in your case there should actually not be a cumtapcnt to begin with, because your data seem to be an average across observations anyway, so the cumtapcnt information is not usable.


Jan-Mathijs Schoffelen - 2014-02-14 14:42:02 +0100

With which I mean that this could be a flaw in FieldTrip in ft_freqanalysis, and is not only a 'problem' in ft_selectdata.


Jan-Mathijs Schoffelen - 2014-02-14 15:37:10 +0100

svn commit -m "enhancement - correctly deal with cumtapcnt in tfr data " test/test_bug2464.m test/test_ft_selectdata.m utilities/ft_selectdata_new.m Sending test/test_bug2464.m Sending test/test_ft_selectdata.m Sending utilities/ft_selectdata_new.m Transmitting file data ... Committed revision 9202.