Back to the main page.

Bug 179 - plotting problem with connectivityresults

Reported 2010-10-11 20:57:00 +0200
Modified 2010-10-12 09:28:22 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Jan-Mathijs Schoffelen - 2010-10-11 20:57:34 +0200

Created attachment 7 stat structure causing problems Hi Jan-Mathijs, Thanks for the advise, and I apologize for sending a file to your account, but I' having a hard time sending data to ftp://..../incoming/ folder. It complains that the folder cannot be modified. Attachment m-file contains "stat" that I made. Following your email, I corrected the typo, and it gives another error. It cannot find "labelcmb" in stat, which should be formatted in checkdata.m . I'm using fieldtrip-20100121 version. Thank you for your help, Akiko ----- Original Message ----- From: jan-mathijs schoffelen <jan.schoffelen@DONDERS.RU.NL> Date: Monday, October 11, 2010 3:17 am Subject: Re: [FIELDTRIP] plotting plv To: FIELDTRIP@NIC.SURFNET.NL Dear Akiko, A small comment first: there's a type in the naming of your zparam 'cohsprctm' should probably read 'cohspctrm', but I don't think that this is the show stopper. Next, I guess that given your configuration for ft_freqanalysis, the eventual output of ft_connectivityanalysis is a 3x3xNfreqxNtime - matrix containing plv-values. Is that correct? I do not understand why the visualization fails, but it seems that the correct part of the code is not reached. Could you save the variable 'stat' to a file and upload it to our ftp- server, so that we can reproduce your bug. Recently we spent quite some time in streamlining the visualisation for this type of data and I am pretty sure that in your case it just should work. Please have a look at to upload your data. Best, Jan-Mathijs On Oct 11, 2010, at 12:54 AM, Akiko Ikkai wrote: Hi, I'm trying to plot plv between channel pairs that I get from ft_connectivityanalysis. when I run cfg = []; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'cohsprctm'; % need to run stat.cohsprctm = stat.plvspctrm; % fixed in the latest version? cfg.cohrefchannel = '1'; cfg.layout = 'ordered'; cfg.showlabels = 'yes'; cfg.colorbar = 'yes'; figure; ft_multiplotTFR(cfg, stat) I get this error: ft_multiplotTFR(cfg, stat) ??? Index exceeds matrix dimensions. Error in ==> ft_multiplotTFR at 242 datavector = data.(cfg.zparam)(seldat,yidc,xidc); ... I'm guessing the error is something like wrong channel combination or refchannel selection, but not able to locate where the error is coming from (have tried different channel combination). stat.dimord is "chan_chan_freq_time", which might not be formatted appropriately for ft_multiplotTFR...? Below, I'm attaching the code used to get "stat" (plv). Any suggestions? Thanks in advance! Akiko %%%%% code for connectivityanalysis %%%%%% cfg = []; cfg.output ='fourier'; % instead of 'powandcsd'... fixed in the latest version? cfg.method = 'mtmconvol'; = {'1', '7', '120'}; % contra & unrelated channels to test cfg.channelcmb = {'1' '7'; '1' '120'; '7', '120'}; cfg.keeptrials = 'yes'; cfg.keeptapers = 'no'; cfg.toi = [-.8:.1:2] cfg.foi = [1:0.5:30]; cfg.taper = 'hanning'; cfg.t_ftimwin = zeros(1,length(cfg.foi)); cfg.t_ftimwin(:) = 5./cfg.foi; TFR = ft_freqanalysis(cfg, ft_data); cfg=[]; cfg.method = 'plv'; [stat] = ft_connectivityanalysis(cfg, TFR);

Jan-Mathijs Schoffelen - 2010-10-11 21:02:22 +0200

Try to reproduce the bug. Problems may be caused by the old FieldTrip version used

Jan-Mathijs Schoffelen - 2010-10-12 09:24:26 +0200

Dear Akiko, I tried to reproduce the bug as you got it. I was not able to do so (although I ran into a few other issues). Please first update to the most recent version of FieldTrip. This should solve your initial problem. Second, the visualization does not work, because there is only a very sparse subset of channel pairs in the stat-structure. This seems to be confusing to ft_multiplotTFR, and is something which should be fixed. Yet, for the time being, why don't you have a look at the plv-spectra 'by hand'. In the end it's only 3 unique channel pairs we are talking about. This can be done as follows: figure;imagesc(stat.time,stat.freq,squeeze(stat.plvspctrm(1,2,:)));axis xy; figure;imagesc(stat.time,stat.freq,squeeze(stat.plvspctrm(1,3,:)));axis xy; figure;imagesc(stat.time,stat.freq,squeeze(stat.plvspctrm(2,3,:)));axis xy;