[FieldTrip] Help needed for timelock analysis

Francisco Javier Quirant Agulló FJQUIAGU at upv.edu.es
Thu Nov 17 15:42:33 CET 2022


Hello everyone,



 My name is Javier, I am a student of Biomedical engineering and I am working currently on my final master's project. The project aims to compare various inverse algorithms with some metrics and characterize them.


Right now what I am doing is generating a step signal at source level in 68 different brain sections and obtaining simulated EEG signals with fs = 500 Hz & 2s length (1000 samples) and some noise added. The initial steps are performed using BrainStorm and EEGs are exported to matlab to apply eLORETA and sLORETA with Fieldtrip.


For this I am trying to calculate the time domain information for the signals with ft_timelockanalysis and use the results in ft_sourceanalysis. I realized that the source results were identical for the different EEGs (each one for a particular brain section), while the EEGs seem right the output of the ft_timelockanalysis is the same for all signals. Checking the function information I saw a note in line 45 that says: “% FIXME if input is one raw trial, the covariance is not computed correctly”. Tried dividing the EEG in 4 trials but no difference whatsoever. Spent some time also checking results within the function but haven’t made any progress.


I think I may be using the data with an incorrect format or a wrong cfg, any help would be much apreciated. Follows the code.

-----------------------------------

data.trial{1} = real(eeg_01.F);% No idea why but EEGs from BrainStorm convert to complex in matlab

data.time{1} = eeg_01.Time;



save('temp.mat','data');cfg = [];    % This section only when I divide in trials (obviously)

cfg.trialdef.triallength = 0.5;

cfg.datafile = 'temp.mat';

cfg.trialdef.eventtype = 'none';

cfg= ft_definetrial(cfg);

data = ft_preprocessing(cfg);

delete 'temp.mat'



cfg = [];

cfg.covariance = 'yes';

cfg.keeptrials = 'yes';       % I comment these two lines for single trial

cfg.trials = 'all'

data_cov = ft_timelockanalysis(cfg, data);



cfg.layout = 'EEG1010.lay';

ft_topoplotER(cfg,data_cov);   % This to plot the result, I get the same for all EEG files.



-----------------------------------

Here you have the mat file with all variables and 3 of the EEGs already loaded: [https://res-geo.cdn.office.net/assets/mail/file-icon/png/generic_16x16.png] files.mat<https://upvedues-my.sharepoint.com/:u:/g/personal/fjquiagu_upv_edu_es/EUPygCCic5NEiZak0leUSHsBSJAOKw9aJ_-ae7oibQIhNQ?e=TPWOkC>



I hope everything is clear enought.


Greetings,

Javier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20221117/b0a6b318/attachment-0001.htm>


More information about the fieldtrip mailing list