[FieldTrip] ft_connectivityanalysis for one long trial
Julien Catanese
catanese.julien at gmail.com
Wed Jan 22 19:22:43 CET 2014
Hi dear FieldTrip community,
I'm trying to get the coherence spectrum between 2 LFP signals (based on
the tutorial: "Analysis of sensor- and source-level connectivity").
This is sleep data, so I have only one long "trial" generated with
ft_redefinetrial().
I can run ft_freqanalysis() without problems, but both for 'mtmconvol' and
'mtmfft' the next step, ft_connectivityanalysis(), fails:
1/ using 'mtmconvol': the cohspctrum consists of all '1' (the same happens
when using 'fourier' instead of 'powandcsd')
2/ using 'mtmfft': "Error using ft_connectivityplot (line 99) the data
should have a dimord of chan_chan_freq or chancmb_freq"
How can I get a coherence spectrum for this data? Do I have to artificially
chop it up into say, 2-second "fake trials"?
notice that MATLAB's mscohere() works fine on the same data (so data are
ok).
More details below:
1/ using mtmconvol :
%% starting point: loaded data
data =
hdr: [1x1 struct]
label: {'LFP1' 'LFP2'}
time: {[1x200000 double]}
trial: {[2x200000 double]}
fsample: 2000
cfg: [1x1 struct]
sampleinfo: [1 200000]
%% make one long trial
cfg = [];
cfg.trl = [1 200000 0];
data_faketrl = ft_redefinetrial(cfg,data);
%% do frequqency anlaysis
cfg = [];
cfg.output = 'powandcsd';
cfg.method = 'mtmconvol';
cfg.taper = 'hanning';
cfg.foi = 1:1:150;
cfg.t_ftimwin = ones(size(cfg.foi)).*2; % 2-second window
cfg.toi = 0:1:10;
cfg.keeptrials = 'yes';
cfg.channel = {'LFP1', 'LFP2'};
cfg.channelcmb = {'LFP1', 'LFP2'};
>> freq = ft_freqanalysis(cfg, data_faketrl)
freq =
label: {'LFP1' 'LFP2'}
dimord: 'rpt_chan_freq_time'
freq: [1x150 double]
time: [0 1 2 3 4 5 6 7 8 9 10]
powspctrm: [4-D double]
labelcmb: {'LFP1' 'LFP2'}
crsspctrm: [4-D double]
cumtapcnt: [1x150 double]
cfg: [1x1 struct]
%% coherence spectrum has all ones
cfg = [];
cfg.method = 'coh';
coh = ft_connectivityanalysis(cfg, freq);
coh =
labelcmb: {'LFP1' 'LFP2'}
dimord: 'chan_freq_time'
cohspctrm: [1x150x11 double]
freq: [1x150 double]
time: [0 1 2 3 4 5 6 7 8 9 10]
dof: 150
cfg: [1x1 struct]
% coh.cohspctrm(:,:,2:end) is all ones --> fail
2/ using mtmfft:
%%
cfg = [];
cfg.output = 'powandcsd'
cfg.method = 'mtmfft';
cfg.taper = 'hanning';
cfg.foi = 1:1:150;
cfg.channel = {'LFP1', 'LFP2'};
cfg.channelcmb = {'LFP1', 'LFP2'};
>> freq = ft_freqanalysis(cfg, data_faketrl)
freq =
label: {'LFP1' 'LFP2'}
dimord: 'rpt_chan_freq'
freq: [1x150 double]
powspctrm: [1x2x150 double]
labelcmb: {'LFP1' 'LFP2'}
crsspctrm: [1x1x150 double]
cumsumcnt: 200000
cumtapcnt: 1
cfg: [1x1 struct]
%% coherence spectrum fails:
cfg = [];
cfg.parameter = 'cohspctrm';
cfg.channelcmb = {'LFP1', 'LFP2'};
>> ft_connectivityplot(cfg, coh);
Error using ft_connectivityplot (line 99)
the data should have a dimord of chan_chan_freq or chancmb_freq
coh =
labelcmb: {'LFP1' 'LFP2'}
dimord: 'chan_freq'
cohspctrm: [1x150 double]
freq: [1x150 double]
dof: 1
cfg: [1x1 struct]
>> unique([coh.cohspctrm(:)])
ans =
1.000000000000000
1.000000000000000
1.000000000000000
1.000000000000000
1.000000000000000
Thanks for your help,
Julien C
--
*Dr. Julien Catanese*
*VanderMeerLab post-doc. University of Waterloo, Ontario, Canada. *
*cell : +1 (519) 781 7575*
*tel lab : +1 (519) 888 4567 ext 31354*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140122/7febf41d/attachment-0001.html>
More information about the fieldtrip
mailing list