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

Arnaud Delorme arno at ucsd.edu
Thu May 27 22:51:09 PDT 2010


Dear all,

yes, high pass filtering is best. Ideally, you can in addition to  
removing the mean also detrend your continuous data prior to filtering  
("EEG.data = detrend(EEG.data')';" (this will remove any linear trend  
in each of the channels).
Also, it is important to be careful with filtering. EEGLAB function  
perform by default acausal filtering that preserve the phase  
information (using the filtfilt function that filters forward in time  
and then backward in time). However, this can make very low frequency  
components leak into the baseline period for event-related data. To  
fix this problem, there is now a new option for the non-linear  
filering function iirfilt.m to use causal filtering (filtering only  
forward in time). The phase absolute information can be distorted  
though. It is a trade-off and it will depend on what you want to do  
with your data. There is no perfect solution to my knowledge.

Arno

On May 26, 2010, at 11:44 AM, Achim, André wrote:

> Note that, for this purpose, it is not necessary to calculate the  
> exact mean of each channel across all the recording. Estimating the  
> channel means over 10-20 seconds should do well enough. The high- 
> pass filter will do the rest.
>
> André Achim
>
> -----Message d'origine-----
> De : eeglablist-bounces at sccn.ucsd.edu [mailto:eeglablist-bounces at sccn.ucsd.edu 
> ] De la part de Bradley Voytek
> Envoyé : 23 mai 2010 17:33
> À : seba
> Cc : eeglablist
> Objet : Re: [Eeglablist] DC shifts in biosemi files: first do a  
> baselinecorrection and then a high pass filter
>
> 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
>>
> _______________________________________________
> 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
>
> _______________________________________________
> 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