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

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


What I meant is: do you get an error, or what? The code itself looks great, and is a pleasure to read, but so is a Shakespeare sonnet, or a musical score of a random JS Bach piece. Please refer to http://www.fieldtriptoolbox.org/faq/how_to_ask_good_questions_to_the_community and http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1002202 in  crafting your questions to this list.

Best wishes,
Jan-Mathijs

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

Hello,

Thanks for the reply. Specifically I am trying to start with code that can at least produce a time frequency plot using Fieldtrip from a '.set' file that is already preprocessed in EEGLAB. I am not exactly sure where my code is wrong although my guess would be I am either defining the trials incorrectly or using ft_preprocessing wrong. From the code snippet that I provided, I would appreciate any feedback in case anything looks glaringly wrong or any suggestions.

Thank you,
Daniela
________________________________
From: fieldtrip [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of Schoffelen, J.M. (Jan Mathijs) [jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>]
Sent: Thursday, August 09, 2018 2:37 AM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] converting eeglab to fieldtrip for time-frequency analysis

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<https://urldefense.proofpoint.com/v2/url?u=https-3A__uofi.box.com_s_cxbuqqhp065wenpzw1bxasr5vpcdvlms&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=cbhIljOK4jGLoHzHkyHFkEJXu1HeSn7VYDsptmYnnRE&e=>
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<https://urldefense.proofpoint.com/v2/url?u=http-3A__kutaslab.ucsd.edu_matlabmk-5Ffn-5Fdocs_matlabmk_find-5Ftpt.html&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=q3HHwwwnDDnW60Oho80i1LvYHp2OycuZ5IijvIWfSZ4&e=>

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://urldefense.proofpoint.com/v2/url?u=https-3A__mailman.science.ru.nl_mailman_listinfo_fieldtrip&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=y5p1kW6yhzwZvki7HOHmC4urHidxaacGRSGNYnST9XE&e=>
https://doi.org/10.1371/journal.pcbi.1002202<https://urldefense.proofpoint.com/v2/url?u=https-3A__doi.org_10.1371_journal.pcbi.1002202&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=R_xrRpWFaansmT5V1MnSD641Dj2Iwm5oNf2q2kqRQbQ&e=>

_______________________________________________
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/cad52f6d/attachment-0002.html>


More information about the fieldtrip mailing list