Back to the main page.

Bug 1425 - coherence calculation with rpttap dimension size 1

Reported 2012-04-13 22:15:00 +0200
Modified 2012-07-07 20:24:16 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Clara Scholl - 2012-04-13 22:15:48 +0200

Created attachment 257 contains variables tmp and freqm0 described in text above for duplicating error I erroneously thought I could calculate the coherence between two single time courses w/o repetitions, on data with size 1 for the dimension rpttap. If rpttap has size 1, a general error is returned as described below. A mat file containing the variables described in the post is attached. The following correspondence summarizes the bug. --->CUT: from my listserve posting<----- Why do I get an error when my fourierspctrm with dimord rpttap_chan_freq has dimensions of 1 x 128 x 10 (the key being, just 1 rpttap value for each channel x frequency combination)? At each channel & frequency, fourierspctrum contains a complex value so the data structure contains the phase and amplitude information at each channel and frequency, which I think -- perhaps incorrectly -- should be sufficient to calculate the coherence. I'll paste below an example of the error I'm getting, beginning with the initial data structure through the ft_connectivityanalysis error. IF the initial data structure (called tmp in this example) has rpt size > 1, then I don't get the error. Thanks, Clara tmp = label: {128x1 cell} time: [0.3380 0.3400 0.3420 0.3440 0.3460 0.3480 0.3500 0.3520 0.3540 0.3560 0.3580 0.3600 0.3620 0.3640 0.3660 0.3680 0.3700 0.3720] cfg: [1x1 struct] trial: [1x128x18 double] sampleinfo: [1 18] dimord: 'rpt_chan_time' cfg=[]; cfg.output='fourier'; cfg.method='mtmfft'; cfg.tapsmofrq=28;{'all'}; freqm0=ft_freqanalysis(cfg, tmp) the input is timelock data with 128 channels and 18 timebins processing trials Warning: using only one taper for specified smoothing In specest/private/warning_once at 75 In ft_specest_mtmfft at 96 In ft_freqanalysis at 519 processing trial 1/1 nfft: 18 samples, datalength: 18 samples, 1 tapers the call to "ft_freqanalysis" took 0 seconds and an estimated 0 MB freqm0 = label: {128x1 cell} dimord: 'rpttap_chan_freq' freq: [0 27.7778 55.5556 83.3333 111.1111 138.8889 166.6667 194.4444 222.2222 250.0000] fourierspctrm: [1x128x10 double] cumsumcnt: 18 cumtapcnt: 1 cfg: [1x1 struct] cfg=[]; cfg.method='coh'; cfg.channelcmb={'E34', 'E98'}; fdm0=ft_connectivityanalysis(cfg, freqm0) selection fourierspctrm along dimension 2 ??? Index exceeds matrix dimensions. Error in ==> ft_connectivity_corr at 131 p1 = reshape(input(j,powindx(:,1),:,:,:), siz(2:end)); Error in ==> ft_connectivityanalysis at 471 [datout, varout, nrpt] = ft_connectivity_corr(data.(inparam), optarg{:}); ---->>>>CUT: Part of Jan-Mathijs's reply<<<<---- Apparently, the code did not take into account the possibility of anybody supplying the data you just described, so somehow it crashes. I think that the unspecific errors should be dealt with. Could you create yourself an account on our bugzilla-website ( and file a 'bug' for this issue? It would be really helpful if you paste the information below and upload a small datafile containing the variables (i.e. freq structure) enabling us to locally reproduce the issue. We will then try and address this issue as soon as possible.

marcel van gerven - 2012-04-22 20:39:49 +0200

Bug not part of multivariate...

Jan-Mathijs Schoffelen - 2012-07-04 14:21:07 +0200

fixed in revision 6222