[FieldTrip] Baseline removal errors in trials preprocessing

Marion Vincent marion.vincent at univ-lille.fr
Thu Jan 17 13:59:59 CET 2019

An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190117/1df81e55/attachment-0002.html>
-------------- next part --------------
Dear Stephen,
Here is my script:
seg_window=[0.1 1]; % in seconds %preStim/postStim
cfg= [];
cfg.dataset = filename_Data;
%% *********** TRIAL DEFINITION PART *********** (that works)
cfg = ft_definetrial(cfg);
% ***********  Re-References *********** (that also works)
cfg.reref = 'yes';
cfg.refchannel = {'EXG3', 'EXG4'};% electrode 131/132 // cell-array with new EEG reference channel(s), this can be 'all' for a common average reference
cfg.refmethod     = 'avg'; % 'avg', 'median', or 'bipolar' for bipolar derivation of sequential channels (default = 'avg')
data_Raw = ft_preprocessing(cfg);
%% *********** Baseline ***********
cfg.demean = 'yes';
cfg1.baselinewindow = [-seg_window(1) 0 ];
cfg2.baselinewindow = [0 0.1];
cfg3.baselinewindow = 'all';
data1 = ft_preprocessing(cfg1);
data2 = ft_preprocessing(cfg2);
data3 = ft_preprocessing(cfg3);
I’ve attached the figure with the results.
PS: In fact I made a mistake in my previous email: the result wasn’t the same when the Baseline window was ‘all’.
Let me know if you need more informations.
Thanks for your help.
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76
Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq Cedex
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
De: Stephen Whitmarsh
Envoyé le:jeudi 17 janvier 2019 11:51
À: 'FieldTrip discussion list'
Objet:Re: [FieldTrip] Baseline removal errors in trials preprocessing

Dear Marion,


It sounds it might indeed be something as simple as a typo. Could you paste the part of your script – from baseline removal to plotting (where you don’t see a difference) - so we can take a look?





From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Marion Vincent
Sent: Thursday, January 17, 2019 10:37 AM
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Baseline removal errors in trials preprocessing


Dear FIeldtrip users, 


I’m new in using Fieldtrip for EEG processing and I’ve encountred some issues while removing the Baseline of my trials. 


I’m working on EEG signals recorded with the BioSemi system.  My pre-processing method is : 

(1)    Re-referecing the channels (necessary with BioSemi)

(2)    Trial definition

(3)    Baseline removal


I’ve read on the documentation that ft_preprocessing xcan have several cfg parameter for the Baseline removal :


% cfg.demean  = 'yes';%'no' or 'yes', whether to apply baseline correction (default = 'no')

% cfg.baselinewindow = 'all';%[begin end] ;%in seconds, the default is the complete trial (default = 'all')

% cfg.detrend       = 'no'; %'no' or 'yes', remove linear trend from the data (done per trial) (default = 'no')


I wanted to remove a Baseline defined as the average of a given window preceeding my stimulus onset. 


I tried to use : cfg.baselinewindow = [-0.5 0 ]; cfg.baselinewindow = [0 0.1] or the default window .

But the problem is that I always have the same result, no matter the window I use : the first point of my trial is put to zero and substracted to all my trial. 


I’m sure I’m doing something wrong (and that the answer is very simple), but I can’t manage to understand what is the issue.


Do you have any advice ?


Thanks ! 



Eng., PhD , CNRS Research Engineer


fieldtrip mailing list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BaselineRemoved_Trial1.JPG
Type: image/jpeg
Size: 115224 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190117/1df81e55/attachment-0002.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BaselineRemoved_Trial1.fig
Type: application/octet-stream
Size: 129935 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190117/1df81e55/attachment-0002.obj>

More information about the fieldtrip mailing list