[Eeglablist] DC shifts in biosemi files: first do a baseline correction and then a high pass filter

seba Sebastian.Korb at unige.ch
Thu May 20 03:33:21 PDT 2010

Dear all,

as many of you know and have discussed on this list before (see for example post by Brad, september 12th, 2008),
Biosemi .bdf files look very weird when you open them for the first time in Matlab (with or without Eeglab).
In fact the amplitudes are completely shifted and out of range ("because BioSemi uses some of its bit depth to record the DC offsets", as Brad says).
And the solution for this problem was said to be simple: just apply a high-pass filter (e.g. at 0.1 Hz) and everything gets back into the normal range again.

However, as I found out, if you do so for example with a butterworth filter, you get a huge artifact which forces you to throw away parts of your data in the beginning.
Actually, when the amplitude shift is huge, and even more so if I use a filter with a high order, it looks like the ENTIRE EEG (!!?) is polluted by this artificially introduced artifact.

Thus, I would like to remind all people working with Biosemi files to FIRST do a baseline correction, and only then, apply their filters.
Doing so does not (at least on my data) result in this filter artifact.

Just so that you see it yourself, you can try this little script in Matlab, 
in which I just construct and then shift an artificial signal, and where the signal becomes really ugly after filtering:

clear all

y=sin(x)+1000000; %introduce an amplitude shift

%%filter with a 5th order butter. In this case I the sampling frequency is
%%defined as 1024
[z,p,k] = butter(10, .1/(1024/2), 'high'); 
[sos, g] = zp2sos(z,p,k);
h1 = dfilt.df2sos(sos,g);
hfvt = fvtool(h1, 'FrequencyScale', 'log'); %plot
eeg_filt = filter(h1, y(:,:)); %apply the filter

%plot the 
figure; subplot(2,1,1);

Sebastian Korb, Ph.D. Student
Swiss Center for Affective Sciences
University of Geneva, Switzerland
Tel.: +41223799812
Email: Sebastian.Korb at unige.ch

More information about the eeglablist mailing list