[FieldTrip] Compute Time-Frequency Granger Causality with ft_connectivityanalysis

laetitia.lalla at inserm.fr laetitia.lalla at inserm.fr
Wed Aug 10 16:29:09 CEST 2016


 

Hello ! 

Sure, this is the code that I use after the preprocessing : 

%-------------------------------------------------------------------------------


cfg                   = [];
cfg.method       = 'mtmconvol';
cfg.output         = 'powandcsd';
cfg.channel       = data.label;
cfg.channelcmb = {'Str' 'Ctx'};
cfg.taper           = 'dpss';
cfg.foi               = 0.5:100;
cfg.tapsmofrq    = 1.5*ones(1, length(cfg.foi));
cfg.t_ftimwin     = 2*ones(1, length(cfg.foi));
cfg.toi              = data.time{1,1};
cfg.keeptrials    = 'no';
freq                  = ft_freqanalysis(cfg, data); 

% cfg=[];
% cfg.method='coh';
% coh=ft_connectivityanalysis(cfg, freq); 

cfg=[];
cfg.method='granger';
granger=ft_connectivityanalysis(cfg, freq); 

%------------------------------------------------------------------------------


I succesfully compute the Time-Frequency Map of the coherence (this was
to check), but it won't work for the Granger causality... 

Thanks a lot for your help ! 

Best, 

Laetitia 

On 10-08-2016 11:49, Hähnke wrote: 

> Hi Laetitia, 
> 
> could you provide the code that you used for the calculation of your input structure 'freq'? 
> 
> When I had a similar looking issue it was because I used a trial-resolved structure, whereas GC calculation seems to require trial-averaged data. 
> 
> Best, Daniel
> 
> On 10.08.2016, at 11:01, laetitia.lalla at inserm.fr wrote: 
> 
> Hi Daniel, 
> Thanks a lot for your answer. I was using a version from last September. I downloaded the most recent version "fieldtrip-20160809" this morning and I still have the same issue... When I call ft_connectivity analysis, this message is displayed : "the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated ... MB" and then Matlab stays stuck... I terminate it myself and the error is still the same : 
> 
> Operation terminated by user during ft_checkdata>fixcsd (line 1072)
> In ft_checkdata (line 595)
> data = fixcsd(data, cmbrepresentation, channelcmb); 
> 
> In ft_checkdata>fixcsd (line 1170)
> data       = ft_checkdata(data, 'cmbrepresentation', 'full');
> In ft_checkdata (line 595)
> data = fixcsd(data, cmbrepresentation, channelcmb);
> In ft_connectivityanalysis (line 416)
> data = ft_checkdata(data, 'cmbrepresentation', 'full'); 
> 
> Has anyone else encountered issues when trying to plot a Time-Frequency Map of the Granger causality with ft_connectivityanalysis ? 
> 
> Thanks a lot for your help. 
> 
> Best, 
> 
> Laetitia 
> 
> On 08-08-2016 11:51, Hähnke wrote: Dear Laetitia, 
> 
> I think I had this issue before and it was caused by a bug in the fieldtrip version I was using. What version are you using? 
> 
> Best, 
> 
> Daniel
> 
> --
> Daniel Hähnke
> PhD student
> 
> Technische Universität München
> Institute of Neuroscience
> Translational NeuroCognition Laboratory
> Biedersteiner Straße 29, Bau 601
> 80802 Munich
> Germany
> 
> Email: daniel.haehnke at tum.de
> Phone: +49 89 4140 3356 
> 
> On 08.08.2016, at 11:36, laetitia.lalla at inserm.fr wrote: 
> 
> Hello fieldtrippers, 
> first of all, thanks a lot for this collaborative mailing list. It helped me a lot in the past and i hope you will be able to help me today ! 
> 
> I succesfully implemented the spectral granger causality thanks to this FieldTrip tutorial : http://www.fieldtriptoolbox.org/tutorial/connectivityextended [1]. Now I'd like to compute a Time-Frequency Map of my granger causality. Hence, I used ft_freqanalysis with cfg.method  = 'mtmconvol' and cfg.output  = 'powandcsd' and the minimal code 
>> cfg=[];
>> cfg.method='granger';
>> granger=ft_connectivityanalysis(cfg, freq); 
> to compute the granger causality. 
> However, when I run this code, Matlab bugs and stays "busy" for a while until I terminate it, with the following error message : 
> 
> Operation terminated by user during ft_checkdata>fixcsd (line 1255)
> 
> In ft_checkdata (line 797)
> data = fixcsd(data, cmbrepresentation, channelcmb);
> 
> In ft_checkdata>fixcsd (line 1351)
> data = ft_checkdata(data, 'cmbrepresentation', 'full');
> 
> In ft_checkdata (line 797)
> data = fixcsd(data, cmbrepresentation, channelcmb);
> 
> In ft_connectivityanalysis (line 392)
> data = ft_checkdata(data, 'cmbrepresentation', 'full');
> 
> I can see in the help of the function checkdata the following :  "cmbrepresentation  = sparse, full (applies to covariance and cross-spectral density)". But I don't really understand what "cmbrepresentation" do ... Maybe someone who had a similar problem in the past can help me ? I think I'm missing some optional arguments that I should add. 
> 
> Thanks a lot for your help. 
> 
> Regards, 
> 
> Laetitia Lalla 
> PhD student in INMED, Marseille, France _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip 
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

  _______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip 

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip 

  

Links:
------
[1] http://www.fieldtriptoolbox.org/tutorial/connectivityextended
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160810/f6c6a7d8/attachment-0002.html>


More information about the fieldtrip mailing list