Back to the main page.

Bug 2874 - ft_sourcegrandaverage of a field that is not 'pow'

Status CLOSED WORKSFORME
Reported 2015-03-31 10:12:00 +0200
Modified 2016-06-14 16:18:23 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

- 2015-03-31 10:12:03 +0200

More of a question than a bug, this one. I did some all-to-all connectivity using ft_connectivityanalysis, but I'm only really interested in connectivity from X-to-all, and from Y-to-all. So rather than keep the whole matrix (which was quite big) I created two structures; now my data look like this; pos: [19344x3 double] dim: [24 31 26] unit: 'cm' inside: [19344x1 logical] params: [1x1 struct] initial: [4x4 double] cfg: [1x1 struct] seed_l: [19344x1 double] seed_r: [19344x1 double] when I try to create a grandaverage of these data, thus; cfg=[]; cfg.parameter='seed_l'; grandaverage=ft_sourcegrandaverage(cfg,data{:}); I get the following response; ??? Reference to non-existent field 'pow'. Error in ==> ft_sourcegrandaverage at 141 if iscell(varargin{1}.(cfg.parameter)) So my question is; should ft_sourcegrandaverage work with nonstandard parameters such as mine? Or should it only work with the standard 'pow', 'cohspctrm', etc etc? If the answer is, 'it should work with any parameter you specify' (which I think would be a sensible answer!) then right now it doesn't. Weirdly, if I do this: for i=1:nsubs data{i}.pow=data{i}.seed_l; %just create a field 'pow' end then I call sourcegrandaverage cfg=[]; cfg.parameter='seed_l'; %notice I did *not* ask to average 'pow' grandaverage=ft_sourcegrandaverage(cfg,data{:}); then the command completes, but I have 'pow', and not 'seed_l' in my grand average! Ie, my request to average the parameter 'seed_l' got ignored. Seems like somewhere my requested parameter is being overriden (and I guess 'pow' is the default to average if no parameter is specified).


Robert Oostenveld - 2015-03-31 12:35:33 +0200

Hi Tom, Looks like a bug to me, ignoring the cfg.paramneter field. I see some code that pertains to dealing with a selection of avg.xxx, which might be the cause. I'll try to reproduce and fix.


Robert Oostenveld - 2015-03-31 13:00:15 +0200

Hi Tom, The following works fine for me ------------------------------------ pos = randn(19344, 3); nsubj = 3; clear source for i=1:nsubj source{i}.pos = pos; % needs to be the same over subjects source{i}.dim = [24 31 26]; source{i}.unit = 'cm'; source{i}.inside = ones(19344, 1); source{i}.params = 'something'; % don't know what this is source{i}.initial = randn(4,4); % don't know what this is source{i}.cfg = []; source{i}.seed_l = randn(19344, 1); source{i}.avg.seed_r = randn(19344, 1); end %% cfg = []; cfg.parameter = 'seed_l'; grandavg = ft_sourcegrandaverage(cfg, source{:}); %% cfg = []; cfg.parameter = 'avg.seed_r'; grandavg = ft_sourcegrandaverage(cfg, source{:}); ------------------------------------ That means that the problem you encounter has been fixed already. Note that I am assuming here that you are using a fixed (and hence not the latest) version of FT. I did just make some cleanups to the code, but those do not affect the behaviour. mac011> svn commit Sending ft_sourcegrandaverage.m Sending ft_sourcestatistics.m Adding test/test_bug2874.m Transmitting file data ... Committed revision 10313.


Robert Oostenveld - 2016-06-14 16:18:23 +0200

Hereby I am closing several bugs that have been resolved for some time (WONTFIX, WORKSFORME, etc.). If you disagree, please reopen and explain.