strange sensor signals in the baseline

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Tue May 13 12:30:41 CEST 2008

On 9 May 2008, at 16:55, Michael Wibral wrote:

> Dear Fieldtrippers,
> I have some data from a 275ch CTF system, that were (in each single
> subject) preprocessed in Fieldtrip with baseline correction and
> detrending. If I now look at the grandaverage ERP some sensors have
> a nonzero signal that is entirely on one side (either completely
> above or completely below) of the baseline, while most sensors
> oscillate around zero as I would expect. Is this an effect of
> detrending, i.e. is detrending performed AFTER baseline correction
> AND on the whole datapiece, instead of just the specified baseline
> interval?

Hi Michael,

detrending is done prior to baselinecorrection. See fieldtrip/private/
preproc.m around line 346. Note that for detrending always the whole
segment is used (minus the optional filterpadding), whereas for
baseline correction you can specify the baseline window. The default
for baseline correction is to use the whole segment (also minus the
filter padding). If you use filter padding, then it is technically
possible to specify a baseline window that extends into (or even is
completely in) the padding. Did you use padding, and what did you
specify as cfg.blcwindow?

However, regardless of the order of detrending and baselinecorrection
and assuming that you did not use filter padding, your ERFs should
all have an average of zero over the time axis. An easy check is to
   baseline = mean(timelock.avg, 2);
   baseline = mean(raw.trial{i}, 2);
for each of your trials.

This returns a nchansX1 vector that should be zero (or very close to
zero) for each channel.


The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list