[FieldTrip] Baseline correction when epoching after filtering

Snijders, T.M. (Tineke) tineke.snijders at donders.ru.nl
Tue Jun 28 16:07:18 CEST 2016

Dear Emil,

Yes, indeed you should have the prestimulus data available to baseline-correct for it.
But note that fieldtrip shifts the timing info in relation with the trigger onset.
So if you use
cfg.trialdef.prestim        = 0.5;
cfg.trialdef.poststim       = 1;
when you define your trials, then your timing information is relative to the trigger, so it will actually go from [-0.5 1.0], and you can use the 'correct' times (with regard to trigger onset) then. So you can just use [-0.5 0] as baselinewindow, and then you don't need to plot [0.5 1.5] when what you actually want to plot is [0 1.0].

If you have done the epoching in some other way, just alter data.time so it gives the 'correct' times.


From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Emil Østergård Johansen [emilj at drcmr.dk]
Sent: Tuesday, June 28, 2016 2:33 PM
To: fieldtrip at science.ru.nl
Subject: Re: [FieldTrip] Baseline correction when epoching after filtering

Dear Dr. Snijders,
Thank you for your swift response and suggestion. I tried your solution, but since my epochs are not completely adjacent in the data (there is a pause of 4 seconds between epochs), when following your suggestion there is no data available previous to the stimulus because the data in between has been removed when epoching using ft_redefinetrial. So when using a window of [-2 0], Fieldtrip simply reverts to subtracting the first sample value such that all signals start at 0, which is of course not desirable.
I have solved it now and will describe it briefly here if others face the same problem:
I included data prior to the stimulus onset in the epoch. As an example, say my epoch is 1 second long and I want to use [-0.5 0] as baseline. Then I define my epoch as [-0.5 1]  and use ft_redefinetrial to epoch the data. Afterwards I use a cfg.baselinewindow = [0 0.5] and baseline correct the data the way you described. When plotting the ERP’s I then plot the true epoch which is [0.5 1.5] in my “dummy” epoch.

Thank you again for your help,

fieldtrip mailing list
fieldtrip at donders.ru.nl

More information about the fieldtrip mailing list