Back to the main page.

Bug 782 - Bug in ft_connectivityanalysis

Status CLOSED WORKSFORME
Reported 2011-06-28 17:34:00 +0200
Modified 2011-07-13 14:46:39 +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-06-28 17:34:20 +0200

I tried connectivity with granger on a dataset with two channels. I get the following error: stat = ft_connectivityanalysis(cfg, freq); computing multivariate non-parametric spectral factorization on 2 channels averaging crsspctrm over rpt averaging transfer over rpt removing dimension rpt from crsspctrm removing dimension rpt from transfer ??? Error using ==> reshape To RESHAPE the number of elements must not change. Error in ==> ft_connectivity_granger at 30 zc = reshape(Z(kk,jj,jj,:) - Z(kk,ii,jj,:).^2./Z(kk,ii,ii,:),[1 1 1 1 siz(5)]); Error in ==> ft_connectivityanalysis at 596 [datout, varout, nrpt] = ft_connectivity_granger(data.transfer, data.noisecov, data.crsspctrm, fs, hasjack, powindx); K>> size(Z) ans = 1 64 2 2 Investigating I found that Z comes from data.noisecov and the leading singleton dimension is added around line 407 of ft_connectivityanalysis which might not be the right thing to do for this field.


Jan-Mathijs Schoffelen - 2011-06-28 20:03:43 +0200

It seems you have repetitions in the input data?


Jan-Mathijs Schoffelen - 2011-06-28 20:06:25 +0200

could you upload a freq-structure (with not too many frequency bins) as attachment to this bug? Thanks


Jan-Mathijs Schoffelen - 2011-06-28 20:10:28 +0200

by the way, it typically makes more sense to compute a non-parametric spectral factorization on averaged data, rather than on single trials.


Vladimir Litvak - 2011-06-29 15:28:48 +0200

Created attachment 82 example data and cfg


Jan-Mathijs Schoffelen - 2011-06-29 15:51:40 +0200

>> cd ../../Desktop/ >> load granger_bug >> freq freq = label: {2x1 cell} dimord: 'rpt_chan_freq' freq: [1x101 double] powspctrm: [64x2x101 double] labelcmb: {'S2' 'S1'} crsspctrm: [64x1x101 double] cumsumcnt: [64x1 double] cumtapcnt: [64x1 double] >> cfg cfg = method: 'granger' jackknife: 'yes' bandwidth: 2.5000 >> g=ft_connectivityanalysis(cfg, freq) computing multivariate non-parametric spectral factorization on 2 channels computing jackknife crsspctrm computing jackknife transfer g = label: {2x1 cell} dimord: 'chan_chan_freq' grangerspctrm: [2x2x101 double] grangerspctrmsem: [2x2x101 double] freq: [1x101 double] cfg: [1x1 struct] I ran the code locally, and it seems my local copy is in sync with the repository. The values in the sem look strange to me, though, but it doesn't crash


Robert Oostenveld - 2011-07-13 14:46:39 +0200

changed the status for a whole bunch of resolved bugs to CLOSED