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

Bradley Voytek bradley.voytek at gmail.com
Sun May 23 14:33:08 PDT 2010


Seba:

You're correct. The best way is to simply remove the (true) DC offset
before filtering. To do this you must subtract the mean channel
voltage from each channel. Make sure you convert the channel datatype
to "double" first, since BDF data are natively in "single" format.

See this correspondence:
http://sccn.ucsd.edu/pipermail/eeglablist/2008/002229.html

::brad

On Thu, May 20, 2010 at 03:33, seba <Sebastian.Korb at unige.ch> wrote:
> 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
> clc
>
> x=-10*pi:0.001:10*pi;
> 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);
> plot(y(1:end));
> subplot(2,1,2);
> plot(eeg_filt(1:end));
>
>
>
> Sebastian Korb, Ph.D. Student
> Swiss Center for Affective Sciences
> University of Geneva, Switzerland
> Tel.: +41223799812
> Email: Sebastian.Korb at unige.ch
> http://www.affective-sciences.org/user/34
>
>
>
>
>
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
>


More information about the eeglablist mailing list