<div dir="ltr">Hello,<div><br></div><div>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 format.</div>
<div><br></div><div>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.</div>
<div><br></div><div>So I read the data in like this:</div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg=[];</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
cfg.reref='yes';</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.dataset = 'data.edf';<br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.headerfile = 'data.edf';</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.dataformat = 'edf';</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.headerformat = 'edf';</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.continuous = 'yes';</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.demean='yes';</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
data = ft_preprocessing(cfg);</div></div><div><br></div><div><br></div><div>and the data looks like:</div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">>> data</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
<br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">data = </div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
hdr: [1x1 struct]</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> label: {101x1 cell}</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> time: {[1x535040 double]}</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> trial: {[101x535040 double]}</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> fsample: 512</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
sampleinfo: [1 535040]</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> cfg: [1x1 struct]</div></div><div><br></div><div><br></div><div>Then my time-frequency analysis looks like this:</div>
<div><br></div><div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg = [];<br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.method = 'wavelet'; </div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.width = 7; </div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.output = 'pow'; </div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
cfg.foi = 1:2:30; </div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">cfg.toi = -0.5:0.05:1.5; </div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
cfg.channel = 'all';</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">TFRwave = ft_freqanalysis(cfg, data);</div></div><div><br></div><div><br></div><div>and the output looks like this:</div>
<div><br></div><div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">>> TFRwave</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
TFRwave = </div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> label: {101x1 cell}</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
dimord: 'chan_freq_time'</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> freq: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29]</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
time: [1x41 double]</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> powspctrm: [101x15x41 double]</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
cumtapcnt: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"> cfg: [1x1 struct]</div></div><div><br></div><div><br></div><div>then I define trials like this (which works fine in other processing streams I have):</div>
<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">[TFRwave_byTrial</span><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">] = ft_redefinetrial(cfg, TFRwave)</span><br>
</div><div><br></div><div><br></div><div>gives this error:</div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">the input is freq data with 101 channels, 15 frequencybins and 41 timebins</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px">??? Error using ==> ft_checkdata>freq2raw at 1669</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">this only works for dimord='rpt_chan_freq_time'</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">Error in ==> ft_checkdata at 317</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
data = freq2raw(data);</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">Error in ==> ft_redefinetrial at 104</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px">data = ft_checkdata(data, 'datatype', 'raw', 'feedback', cfg.feedback);</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
</div></div><div><br></div><div><br></div><div>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 "<span style="font-size:13.333333969116211px;font-family:arial,sans-serif">freqnew=ft_checkdata(data,'</span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">cmbrepresentation','full');" and "</span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">freqnew=ft_checkdata(data,'</span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">cmbrepresentation','</span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">sparsewithpow');" but could not get the data in a format that could be used by ft_redefinetrial().</span></div>
<div><span style="font-size:13.333333969116211px;font-family:arial,sans-serif"><br></span></div><div><font face="arial, sans-serif">Maybe I missed something in the documentation or mailing list? Does anyone have any thoughts or ideas?</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Thanks!</font></div><div><font face="arial, sans-serif">David</font></div><div><br></div><div><br></div><div><br></div><div><br></div>
<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>