Back to the main page.
Bug 2971 - ft_sourcestatistics throws away test data, even if specified in cfg.parameter
Status | CLOSED WORKSFORME |
Reported | 2015-09-28 09:35:00 +0200 |
Modified | 2019-08-10 12:31:09 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P5 blocker |
Assigned to: | |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Stephen Whitmarsh - 2015-09-28 09:35:07 +0200
In line 119, ft_sourcestatistics now only keeps (avg) freq or avg timelock data. However, I want to use sourcestatistics on second level .stat data (as specified by cfg.parameter). It used to keep this, but now throws it out. Simple solution is to add cfg.parameter to the ft_selectdata call in line 119. I suspect it used to do that before already. Cheers, Stephen
Robert Oostenveld - 2015-09-28 09:39:15 +0200
The code is (starting at line 117) % ensure that the data in all inputs has the same channels, time-axis, etc. tmpcfg = keepfields(cfg, {'frequency', 'avgoverfreq', 'latency', 'avgovertime', 'parameter'}); [varargin{:}] = ft_selectdata(tmpcfg, varargin{:}); % restore the provenance information [cfg, varargin{:}] = rollback_provenance(cfg, varargin{:}); where the call to keep fields the parameter should be copied over to tmpcfg.
Stephen Whitmarsh - 2015-09-28 16:55:02 +0200
True Robert, just adding cfg.parameter won't do it. For now I make the following workaround. It is very memory inefficient though. ft_sourceanalysis, starting at 117: % ensure that the data in all inputs has the same channels, time-axis, etc. tmpcfg = keepfields(cfg, {'frequency', 'avgoverfreq', 'latency', 'avgovertime', 'parameter'}); varargin_temp = varargin; [varargin_temp{:}] = ft_selectdata(tmpcfg, varargin{:}); for i = 1 : size(varargin_temp,2) varargin_temp{i}.(cfg.parameter) = varargin{i}.(cfg.parameter); end varargin = varargin_temp; clear varargin_temp
Robert Oostenveld - 2015-09-29 15:43:52 +0200
made test script mac011> svn commit test_bug2971.m Adding test_bug2971.m Transmitting file data . Committed revision 10728.
Robert Oostenveld - 2015-09-29 15:45:16 +0200
mac011> svn commit ft_sourcestatistics.m Sending ft_sourcestatistics.m Transmitting file data . Committed revision 10729. Don't pass cfg.parameter to ft_selectdata.
Robert Oostenveld - 2015-09-29 15:45:49 +0200
The exact problem cannot be reproduced and there seems to be an easy workaround.