Reading a csv file into FieldTrip, calculating power and coherence between channels...
jan-mathijs schoffelen
jan.schoffelen at DONDERS.RU.NL
Thu May 27 09:05:01 CEST 2010
Dear W. Saad,
It seems you call ft_freqanalysis with only one quite long data trial
in the input.
This leads to a frequency tranform which has a very high spectral
resolution.
The number of tapers used in multitapering (for a given requested half-
bandwidth cfg.tapsmofrq)
is a function of the spectral resolution. In other words, the higher
the spectral resolution, the more
tapers are needed. In your case you have approx. 500 seconds of data,
yielding a spectral
resolution of 1/500 Hz. To achieve a spectral smoothing of 5 Hz you
need approximately 1000
tapers. Besides the fact that this is rather meaningless, it will
totally exceed your memory limits
when the tapers are constructed. The remedy here is to cut your data
into shorter segments. The
length of these segments will be determined by your experimental
question.
Best,
Jan-Mathijs
On May 26, 2010, at 9:51 PM, Saad AB wrote:
> Hi,
>
> Thanks for your response. That definitely helped!
>
> However, I am still getting an error that does not make a lot of
> sense to me.
>
> I don't think it has to do with my files size being big since the
> tutorial
> in the following link works with files 4 times bigger than mine
> (208MB):
> http://fieldtrip.fcdonders.nl/tutorial/coherence
>
> Here is the code again for anyone willing to help:
> %-----------------------------------------------
> fieldtripdefs;
> filename='recall.dat';
> filelength=129908;
> rdata=csvread(filename);
> rdata=rdata';
>
> % cell-array containing strings, Nchan X 1
> data.label = {'E2' 'E3' 'E4' 'E5' 'E6' 'E7' 'E8' 'E9' 'E10' 'E11'
> 'E12'
> 'E13' 'E14' 'E15' 'E16' 'E17' 'E18' 'E19' 'E20' 'E21' 'E22' 'E23'
> 'E24'
> 'E25' 'E26'};
>
> % sampling frequency in Hz, single number
> data.fsample = 256;
>
> % cell-array containing a data matrix for each trial (1 X Ntrial),
> each data
> matrix is Nchan X Nsamples
> data.trial = {rdata};
>
> % cell-array containing a time axis for each trial (1 X Ntrial),
> each time
> axis is a 1 X Nsamples vector
> data.time{1} = [1:filelength]./data.fsample;
>
> cfg = [];
> cfg.output = 'powandcsd';
> cfg.method = 'mtmfft';
> cfg.foilim = [0.5 50];
> cfg.tapsmofrq = 5;
> cfg.keeptrials = 'yes';
> cfg.channel = {'all' };
> cfg.channelcmb = {'all' 'all'};
> freq = ft_freqanalysis(cfg, data);
>
> cfg = [];
> cfg.method = 'coh';
> cfg.channelcmb = {'all' 'all'};
> fd = ft_connectivityanalysis(cfg, freq);
>
>
> %-----------------------------------------------
>
> and the error:
>
> the input is raw data with 25 channels and 1 trials
> ??? Maximum variable size allowed by the program is exceeded.
>
> Error in ==> dpss>dpsscalc at 127
> E = zeros(N,k(2)-k(1)+1);
>
> Error in ==> dpss at 54
> [E,V] = dpsscalc(N,NW,k);
>
> Error in ==> ft_freqanalysis_mtmfft>double_dpss at 423
> tap = dpss(double(a), double(b), varargin{:});
>
> Error in ==> ft_freqanalysis_mtmfft at 249
> tap = double_dpss(numdatbns,numdatbns*(cfg.tapsmofrq./
> data.fsample))';
>
> Error in ==> ft_freqanalysis at 75
> [freq] = feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)),
> cfg, data);
>
> Error in ==> saad_fieldtrip at 30
> freq = ft_freqanalysis(cfg, data);
>
> %-------------------------------------------
>
> Thanks in advance for your input.
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users
> of the FieldTrip toolbox, to share experiences and to discuss new
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html
> and http://www.ru.nl/neuroimaging/fieldtrip.
>
Dr. J.M. (Jan-Mathijs) Schoffelen
Donders Institute for Brain, Cognition and Behaviour,
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands
J.Schoffelen at donders.ru.nl
Telephone: 0031-24-3668063
----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
More information about the fieldtrip
mailing list