Back to the main page.

Bug 2502 - ft_freqstatistics requires XXXparameter ormat for parameter names, which is not clear from the documentation

Reported 2014-03-17 19:33:00 +0100
Modified 2014-06-18 12:31:59 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on: 2470
See also:

Craig Richter - 2014-03-17 19:33:24 +0100

When a 'custom' field is assessed using ft_freqstatistics (in my case it was a field MI, since I'm testing a modulation index), this field must have XXXspctrm as a format which is revealed by tracking down the error messages: [stat] = ft_freqstatistics(cfg, GA_EMP, GA_NULL); Trying to load sensor neighbours from a template Successfully loaded neighbour structure from neuromag306mag_neighb.mat there are on average 7.1 neighbours per channel the call to "ft_prepare_neighbours" took 0 seconds and required the additional allocation of an estimated 0 MB computing statistic over the frequency range [0.250 15.000] the call to "ft_appendfreq" took 0 seconds and required the additional allocation of an estimated 0 MB Attempted to access n(1); index out of bounds because numel(n)=0. Error in dimlength (line 124) if ~all(n==n(1)) Error in dimlength (line 46) n{k}(i) = dimlength(data, dimtok{i}, fn{k}); Error in seloverdim (line 39) [reduceddim, fntmp] = dimlength(data); Error in ft_selectdata_old (line 600) if selectchan, data = seloverdim(data, 'chan', selchan, fb); end Error in ft_selectdata (line 45) [varargout{1:nargout}] = ft_selectdata_old(varargin{:}); Error in ft_freqstatistics (line 245) data = ft_selectdata(data, 'param', cfg.parameter, 'avgoverrpt', false, ... Which leads to line 109 of dimlength (I think this occurs in multiple places): % generic solution for XXXspctrm fnames = fieldnames(data); tmp = find(~cellfun('isempty', strfind(fnames, 'spctrm'))); Thus all parameter names must contain 'spctrm'. This isn't at all obvious from the documentation, so perhaps this should be well documented, or changed to allow arbitrary parameter names for custom applications.

Jan-Mathijs Schoffelen - 2014-03-17 21:27:31 +0100

This seems a duplicate problem of bug 2470 *** This bug has been marked as a duplicate of bug 2470 ***

Jan-Mathijs Schoffelen - 2014-03-18 10:45:17 +0100

Thanks Craig, We have noticed some issues with custom parameters for ft_freqstatistics indeed. Your debugging efforts are received with appreciation. I hope to get to this soon. JM

Jan-Mathijs Schoffelen - 2014-03-18 20:35:51 +0100

bash-4.1$ svn commit -m "enhancement - allow for arbitrary fieldnames to serve as parameter: changed call to ft_selectdata_old into ft_selectdata_new" ft_freqstatistics.m test/test_bug2502.m Sending ft_freqstatistics.m Adding test/test_bug2502.m Transmitting file data .. Committed revision 9298. I changed the code in ft_freqstatistics to use ft_selectdata with a cfg; this means that it now uses ft_selectdata_new, which does not have a call to seloverdim/dimlength. Problem seems solved. Can you confirm?