Back to the main page.

Bug 3073 - correct computation of coh and plv fails with fourier input

Reported 2016-02-19 10:45:00 +0100
Modified 2016-05-05 20:29:41 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Daniel Hähnke - 2016-02-19 10:45:08 +0100

Hello, I downloaded the most recent version of fieldtrip for a new computer and wanted to compute PLV. Here is the code that I used: cfg.method = 'plv'; cfg.channelcmb = {'AD01' 'AD02'}; ft_connectivityanalysis(cfg, data) data is a structure with a field 'fourierspctrm'. The error I get is the following: Matrix dimensions must agree. Error in ft_connectivityanalysis (line 860) if all(size(varout) == size(nrpt)) I'm absolutely sure that this is an issue of this version, since an older version that I'm using, 20151019, does not suffer from this bug. Regards, Daniel

Jan-Mathijs Schoffelen - 2016-02-19 11:00:03 +0100

I cannot reproduce it. Please add some data so that we can look into it.

Daniel Hähnke - 2016-02-19 12:27:01 +0100

I can't upload it here, since the file is too big. Here is a link to Google Drive

Jan-Mathijs Schoffelen - 2016-02-19 13:23:46 +0100

OK, I can reproduce it. It seems to be caught in this error only with TF-data (I initially tried to reproduce on freq-only data). Also, it runs without error if you DON't specify a channelcmb in the cfg. Yet, I stumbled onto something far more serious, and this relates to how the individual trials are handled. There's a major bug at the moment that now the coh/plv is computed per trial and averaged later on. This leads to all-ones when just a single taper per trial is used.

Jan-Mathijs Schoffelen - 2016-02-19 13:34:28 +0100

Hi Daniel, my version of fieldtrip on should contain a fixed version (as well as the repository). Could you update your code and see whether it works again? Sorry for the inconvenience

Daniel Hähnke - 2016-02-19 14:39:32 +0100

That resolves it, thanks! By the way, I also tested version 20160205, which has the bug, and 20160101, which doesn't. So the bug must have appeared somewhere in between these versions. You probably have a handy version tracker software that shows you when in appeared ;)

Jan-Mathijs Schoffelen - 2016-02-20 13:00:27 +0100

(In reply to Daniel Hähnke from comment #5) Well, I kind of know when I caused it, somewhere in January. Since it's fixed now, I do not want to spend too much extra time on it.