[FieldTrip] single-trial power correlation: why not?

Matthijs van der Meer mattmizumi at gmail.com
Wed Oct 1 05:00:26 CEST 2014


*Short version of question:*

What can I do to get ft_connectivityanalysis to compute a power
correlation for a single trial? Or is this a stupid question based on a
misunderstanding of what this function is designed to do?

Conceptually, there doesn't seem to be a problem with this, because if I
have two signals I can compute the instantaneous power of each as a
function of time for a given frequency, and correlate them.

However, when calling ft_connectivityanalysis on the output of
ft_freqanalysis with only one trial, an error is thrown.

*Long version of question:*

My data looks like this:

hdr: [1x1 struct]
label: {'X' 'Y'}
fsample: 2000
trial: {1x351 cell}
time: {1x351 cell}
sampleinfo: [351x2 double]
cfg: [1x1 struct]

Now I run a frequency analysis on one trial:

cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd';
cfg.foi = 40:1:100;
cfg.trials = 1;
cfg.taper = 'hanning';
cfg.polyremoval = 1;
cfg.channelcmb = {'X','Y'};

F = ft_freqanalysis(cfg,data_trl);

Then I would like to do

cfg = [];
cfg.method = 'powcorr';
powcorr = ft_connectivityanalysis(cfg, F);

But this gives this unhelpful error:

Error using fixdimord (line 159)
unexpected dimord "rpttapn_freq"

Nosing around in ft_connectivityanalysis() suggests that the following line

data = ft_selectdata(data, 'avgoverrpt', 'yes');

assumes that we want to average over repetitions (trials), which has
unexpected results when there is only one trial. Skipping this line
enables ft_connectivityanalysis() to run without errors, but the
resulting power correlation has only NaNs.

Any suggestions? I know I can do the whole thing manually with filtering
and Hilbert transforms and such, or perhaps workaround by creating fake
trials, but it would be useful to do this in ft neatly.



More information about the fieldtrip mailing list