[FieldTrip] Fwd: ft_freqdescriptives and cfg.trial
jan-mathijs schoffelen
jan.schoffelen at donders.ru.nl
Thu Aug 23 12:55:02 CEST 2012
Hi Jasper,
I think this is indeed a bug in fieldtrip. The reason being that the cumtapcnt field for timefrequency data is not well-defined/well-designed/well-handled (the latter by ft_selectdata, which is doing the trial selection).
Probably you can work around this by updating the cumtapcnt field prior to calling ft_freqdescriptives.
I suspect that it will work if you define it to be a vector (nx1) where n is the number of trials, and each entry has the value of the number of tapers applied (per trial).
Would it be possible for you to create a bug on our bugzilla site (bugzilla.fcdonders.nl) with a description of the problem, a little test script and some (small) data for reproduction? The team will then take it from there.
Best,
Jan-Mathijs
On Aug 23, 2012, at 12:34 PM, Jasper Poort wrote:
> Dear Fieldtrip users,
>
>
>
> I have a problem with using a trial selection to do freqdescriptives on a subset of trials:
>
>
>
> I first do ft_freqanalysis with these setttings, which results in freq:
>
>
>
> cfg.output = 'fourier';
>
> cfg.method = 'mtmconvol';
>
> cfg.keeptrials = 'yes';
>
>
> freq =
>
>
> label: {1x64 cell}
>
> dimord: 'rpttap_chan_freq_time'
>
> freq: [30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]
>
> time: [1x36 double]
>
> fourierspctrm: [4-D double]
>
> cumtapcnt: [857x15 double]
>
> cfg: [1x1 struct]
>
>
> size(freq.fourierspctrm)
>
> ans =
>
> 2571 64 15 36
>
>
> then i try running ft_freqdescriptives with these settings
>
> tmpcfg = [];
>
> tmpcfg.jackknife = 'no';
>
> tmpcfg.keeptrials = 'no';
>
> tmpcfg.channel = freq.label([chnix1,chnix2])
>
> tmpcfg.trials = [1:10:100];
>
> tmp = ft_freqdescriptives(tmpcfg,freq);
>
>
> Error using +
>
> Array dimensions must match for binary array op.
>
>
> Error in ft_checkdata>fixcsd (line 740)
>
> powspctrm = powspctrm + abs(data.fourierspctrm(p:ntap:end,:,:,:,:)).^2;
>
>
> Error in ft_checkdata (line 646)
>
> data = fixcsd(data, cmbrepresentation, channelcmb);
>
>
> Error in ft_freqdescriptives (line 131)
>
> freq = ft_checkdata(freq, 'cmbrepresentation', 'sparsewithpow', 'channelcmb', {});
>
>
>
> the error seems to happen because the cumtapcnt seems to be updated after calling ft_selectdata in ft_freqdescriptives such that it no longer contains a row for every trial which causes nrpt = size(data.cumtapcnt,1); in ft_checkdata to return 1 instead of the number of trials.
>
>
> label: {2x1 cell}
> dimord: 'rpttap_chan_freq_time'
> freq: [30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]
> time: [1x36 double]
> fourierspctrm: [4-D double]
> cumtapcnt: [3 3 3 3 3 3 3 3 3 3]
> cfg: [1x1 struct]
>
>
>
> I was wondering if this is a bug or am I somehow specifying the input incorrectly?
>
>
>
> Thanks! best, Jasper
>
>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
Jan-Mathijs Schoffelen, MD PhD
Donders Institute for Brain, Cognition and Behaviour,
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands
Max Planck Institute for Psycholinguistics,
Nijmegen, The Netherlands
J.Schoffelen at donders.ru.nl
Telephone: +31-24-3614793
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120823/611845aa/attachment-0002.html>
More information about the fieldtrip
mailing list