# How to filter noise in EEG data

I am a computer science student and I'm doing something for a psychology professor.

We have EEG data from an experiment where a person was shown 140 images for 2 seconds each. We placed 64 electrodes on the scalp so we have 64 channels of continuous data.

We want to correlate each node with every other node so that we can graph it using a chord diagram.

Since my professor is abroad, I am having trouble with the directions he gave me to manipulate the data to get the correlations.

"Once you are able to read the matrix of channels I suggest subtracting the mean signal from each, filtering to remove noise above 30 Hz."

My question is how to remove the noise above 30 Hz? For example, data for 1 electrode for 10 milliseconds looks like this (measured in uV):

[ 31172.50, 31173.53, 31174.80, 31177.34, 31173.73,
31172.85, 31172.75, 31172.70, 31174.95, 31178.95]


The python script I am using also gives this data:

sampling rate: 1000.0 Hz
time: 0.0 s to 1883.15 s


Can anyone point me in the right direction what steps to take to remove noise above 30 Hz? And also, is that a good way to compute the correlations between the electrodes?

Removal of noise can be done in various ways:

Conventional filters: You could create a digital low-pass filter, such as a Chebyshev or Butterworth filter with a cut-off frequency at 30 Hz (filt or filtfilt function in Matlab).

FFT-based filtering: FIR filters remove frequencies in the frequency domain. So first a Fourier transform is done and then the frequencies >30 Hz can be removed from the signal simply by assigning '0' to the FFT coefficients at >30 Hz. A reverse FFT then brings your signal back (fftfilt in Matlab).

Wavelet transforms: Being a relatively complex and processing-power-hungry method, it may not be the method you are after. However, it may be more efficient in removing certain types of noise or to extract certain features from a signal (cwt or dwt functions in matlab).

I'm not familiar with Python. Finding the corresponding filters in Python should be fairly straightforward. There are more filtering procedures but the above should get you going.

Correlation analysis can be done by various methods, including Pearson product moment correlation, Spearman rank order correlation, Kendall rank order correlation and mutual information. See Bonita et al., 2014, DOI: 10.1007/s11571-013-9267-8.

Subtracting the mean signal from a particular channel basically reduces signal offset (the DC signal), comparable to a high-pass filter with a very low cut-off frequency.

• For calculating correlations, I don't understand why I have to "subtract the mean signal from each", can't I just correlate the data after filtering the noise? – achabacha322 Dec 9 '14 at 6:05
• I do not know what the "mean signal" means: the mean of different post-stimulus EEGs? Or the mean over different channels? There's not enough info in your question to answer this. – AliceD Dec 9 '14 at 9:55
• Yeah that's all the professor gave me, once I get in touch with him and he explains that part, I'll be back to post it here. Probably next week. Thanks – achabacha322 Dec 9 '14 at 12:03
• It's not uncommon to find the mean of a channel over the entire recording and then subtract it out. – Josh de Leeuw Dec 9 '14 at 13:54
• I was able to finally talk with the professor, he said in my case: Since we have 64 electrodes, we need to get 64 mean signals. Then for example, I will subtract the mean signal for electrode 1 from the signal at every time stamp in electrode 1. And do it for each. I will post the final results of our chord diagram here when I'm done. – achabacha322 Dec 9 '14 at 16:43

The common steps are: - Raw Signal (after pre-amplifier and amplification) - Band pass filter - Band rejection/Notch filter (cutoff depends on where you're at) - Anti Aliasing Filter - Sample/Hold - MUX(if you have multiple channels) - ADC - Digital Signal

like AliceD mentioned you can use FFT based filters and WT as a filter. For WT you basically apply it to the signal(after selecting a mother wavelet) and you will get a number of coeeficients representing different frequency components which can then be subtracted from the raw signal to remove the noises.

Apart from these filters you could also use spatial filters, a very common one is CSP(common spatial patterns) or others like MEC, CCA, AC, CAR, ICA etc.