Back to the main page.

Bug 799 - Bug with specifying channel combinations for Granger causality

Status CLOSED FIXED
Reported 2011-07-06 21:24:00 +0200
Modified 2011-07-13 20:36:54 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Vladimir Litvak - 2011-07-06 21:24:53 +0200

I discovered a slightly annoying bug/feature after the FT version in SPM was updated from 3701 to 3780. I configure ft_connectivityanalysis as follows: cfg = []; cfg.sfmethod = 'bivariate'; cfg.channelcmb = channelcmb; cfg.method = 'granger'; stat = ft_connectivityanalysis(cfg, freq); In channelcmb I have just the 6 pairs I'm interested in. There are 7 channels. Previously I got in the output 12 directed pairs which makes sense. Now I get 42 pairs so my specification of channelcmb is ignored.


Jan-Mathijs Schoffelen - 2011-07-11 10:09:10 +0200

Hi Vladimir, I think I fixed it. At least it should be possible to specify cfg.channelcmb in combination with fourier-input, to get a subset of the channel pairs. Could you check whether it works, and close the bug? PS: I saw that you added spm's hilbert to specest/private. Would it be an idea to also add this to preproc/private?


Vladimir Litvak - 2011-07-11 13:01:11 +0200

No, that doesn't work. One issue is that if I just specify channelcmb as a list of pairs, that is ignored as before.But also when I specify it as two cell arrays that doesn't make a difference. I looked at the bits of code that you added and they seem to be executed and channelcmb is correct at the end so it must be ignored some time later. Also when you specify channel pairs the 'coh' option doesn't work with the error: ??? Error using ==> labelcmb2indx at 64 the required autocombination is not found in the input Error in ==> univariate2bivariate at 103 powindx = labelcmb2indx(data.labelcmb); Error in ==> ft_connectivityanalysis at 311 [data, powindx, hasrpt] = univariate2bivariate(data, 'fourierspctrm', 'crsspctrm', dtype, 'cmb', cfg.channelcmb, 'keeprpt', normrpt); It seems like the auto-spectra required for normalization are not computed. You can add hilbert wherever else you thing it's necessary. It's under GPL after all ;-) Vladimir


Jan-Mathijs Schoffelen - 2011-07-11 16:50:54 +0200

strange, if I run fieldtrip/test/test_ft_connectivityanalysis it works. Lines 87-90 pertain to your situation, at least that's what I assume. Could it be that you have an old copy of ft_channelcombination somewhere? The (optional) 3d input argument should result in the output channelcmb-list to contain the auto-combinations.


Vladimir Litvak - 2011-07-11 17:27:34 +0200

Try: cfgc = []; cfgc.method = 'coh'; cfgc.sfmethod = 'bivariate'; cfgc.channelcmb = {{'signal001'}, {'signal002', 'signal003'}}; c11 = ft_connectivityanalysis(cfgc, freq);


Vladimir Litvak - 2011-07-11 17:31:41 +0200

Also if you now change the method to 'granger' in the same cfg you'll get 6 row in the output when there should be 4.


Jan-Mathijs Schoffelen - 2011-07-11 20:07:54 +0200

Hmmm, Why don't people use the exact same type of input and configurations as I am used to using ;-). I updated ft_connectivityanalysis, ft_channelcombination, csd2transfer, and test_ft_connectivityanalysis. Could you give it a try? Thanks, JM


Vladimir Litvak - 2011-07-13 20:36:54 +0200

Seems to work now. Thanks.