[FieldTrip] ft_freqanalysis() on entire continuous data followed by ft_redefinetrial() error - incorrect data format?

Drew Fegen dfegen at gmail.com
Wed Dec 11 19:13:40 CET 2013


Trying to do time-frequency analysis on some intracranial EEG data and I
would like to apply the time-frequency analysis to the entire continuous
data to avoid any boundary effects and padding issues.  However, after I
run the time-frequency analysis on the entire continuous data and then try
to define trials I get errors due to the input data being in the incorrect

The data are .edf files that were being imported incorrectly and being
parsed into short segments, thus I have been using "cfg.continuous='yes' "
in ft_preprocessing() and then using ft_redefinetrial() to subsequently
define trials.

So I read the data in like this:

cfg.dataset = 'data.edf';
cfg.headerfile = 'data.edf';
cfg.dataformat = 'edf';
cfg.headerformat = 'edf';
cfg.continuous = 'yes';
data = ft_preprocessing(cfg);

and the data looks like:

>> data

data =

           hdr: [1x1 struct]
           label: {101x1 cell}
           time: {[1x535040 double]}
           trial: {[101x535040 double]}
           fsample: 512
           sampleinfo: [1 535040]
           cfg: [1x1 struct]

Then my time-frequency analysis looks like this:

cfg = [];
cfg.method     = 'wavelet';
cfg.width      = 7;
cfg.output     = 'pow';
cfg.foi        = 1:2:30;
cfg.toi        = -0.5:0.05:1.5;
cfg.channel      = 'all';
TFRwave = ft_freqanalysis(cfg, data);

and the output looks like this:

>> TFRwave

TFRwave =

        label: {101x1 cell}
        dimord: 'chan_freq_time'
         freq: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29]
         time: [1x41 double]
         powspctrm: [101x15x41 double]
         cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
         cfg: [1x1 struct]

then I define trials like this (which works fine in other processing
streams I have):

[TFRwave_byTrial] = ft_redefinetrial(cfg, TFRwave)

gives this error:

the input is freq data with 101 channels, 15 frequencybins and 41 timebins
??? Error using ==> ft_checkdata>freq2raw at 1669
this only works for dimord='rpt_chan_freq_time'

Error in ==> ft_checkdata at 317
        data = freq2raw(data);

Error in ==> ft_redefinetrial at 104
data = ft_checkdata(data, 'datatype', 'raw', 'feedback', cfg.feedback);

So it seems like ft_redefinetrial() does not like the data in the format
"chan_freq_time" and instead wants the format "rpt_chan_freq_time".  I
tried changing the output format of the time-frequency analysis by changing
the "cfg.output" option to 'powandcsc' and 'fourier', and I also tried
converting the time-frequency data using
and "freqnew=ft_checkdata(data,'cmbrepresentation','sparsewithpow');" but
could not get the data in a format that could be used by ft_redefinetrial().

Maybe I missed something in the documentation or mailing list?  Does anyone
have any thoughts or ideas?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20131211/60afeccb/attachment-0001.html>

More information about the fieldtrip mailing list