[FieldTrip] converting eeglab to fieldtrip for time-frequency analysis

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Aug 9 09:37:04 CEST 2018


Hi Daniela,

I am afraid that it’s not clear to the readers of this list whether and what is going wrong, because you don’t write about it.

Best wishes,
Jan-Mathijs

On 9 Aug 2018, at 01:24, Mejia, Daniela <mejia6 at illinois.edu<mailto:mejia6 at illinois.edu>> wrote:

Hello,
My name is Daniela Mejía and I am a student in the Cognitive Neuroimaging Lab at the University of Illinois. I have previously worked on time-frequency analysis of EEG data in EEGLAB and am currently trying to convert over to Fieldtrip for more advanced statistical testing.

I am aware of eeglab2fieldtrip and tried my best to write code based on previous mailinglist answers but I'm still not sure if I'm defining ft_preprocessing and/or ft_definetrials correctly.

My code and a sample dataset can be found here: https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms
also here's the gist of it:

%define trial
 cfg = [];
 cfg.dataset            = '/Users/Daniela/Desktop/aim_set/TF/aim345_ep_ad3rej.set';
 cfg.trialdef.eventtype = 'trigger';
 cfg.trialdef.eventvalue = {'B1(1)','B2(2)','B3(3)','B4(4)'};
 cfg = ft_definetrial(cfg);

% preprocess the data
data = eeglab2fieldtrip(EEG,'preprocessing','none');

cfg_pre=[];
cfg_pre.channel={'all','-A2'};
cfg_pre.demean='yes';
cfg_pre.baselinewindow ='all'; % or [begin end]
cfg_pre.trials = 'all';

tpt0_id=find_tpt(EEG.times,0);

%add a trial configuration to make sure fieldtrip
%doesn't think the data are really continuous
for a=1:n_trials,
    data.cfg.trl(a,:)=[1 n_tpts tpt0_id a]; %"a" just tells you what EEG.epoch the trial corresponds to. It isn't used for anything now.
    %get rid of possible time numerical error; milliseconds is the
    %lowest resolution we should ever need
    data.time{a}=round(data.time{a}*1000)/1000;
end

ft_data=ft_preprocessing(cfg_pre,data);

The find_tpt function is based on this: http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html

Any suggestions on what I am doing wrong would be greatly appreciated! Thank you.

Best,
Daniela Mejía
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180809/32d7740a/attachment-0002.html>


More information about the fieldtrip mailing list