what are the filters needed when using python to process Cyton RAW data

Hi,
  Does someone know what are the filters used in OpenBCI GUI?
  Now I can use python to stream data, But I got some strange noises.
  imgs are blow, they are sample points in channel 1 and channel 2, raw data without filters. I have a cyton board and I tried using 2 ear clips as references and also using only channel1 and channel2 without referance 

I check the openbci_lsl code, and I found a Filters class (see below).Are the '' high pass cutoff = 15Hz, low pass cutoff = 5Hz'' the parameters used in openBCI GUI? 
I also searched in the forum, there should be a notch filter, But I did see notch in any code files. Someone know what that will be.

Currently, I use OpenBCI  to detect a certain eeg pattern so that it can be a game input, But I dont have dsp background, I saw people are using different band-pass filters and I dont know 5hz and 15hz are the right choice. When I saw the signals in the OpenBCI GUI, those signals seems to be pretty ideal for my project, so I am wondering what is the filtering process behind the GUI.

Thank you, guys!
 



class Filters:
def __init__(self,window_size, low, high):
fs_Hz = 250;
fn = fs_Hz/2
self.filtered_data = []

#######################################
# Filter Creation
# -------------------------------------
#
# Create a filter using the scipy module,
# based on specifications suggested by
# Pan-Tompkins (bandpass from 5-15Hz)
#
#
# 1) Establish constants:
#       a) filter_order = 2
#       b) high pass cutoff = 15Hz
#       c) low pass cutoff = 5Hz
# 2) Calculate the coefficients, store in variables

filter_order = 2
f_high = high
f_low = low
self.high_pass_coefficients = signal.butter(filter_order,float(f_low)/fn, 'high')
self.low_pass_coefficients = signal.butter(filter_order,float(f_high)/fn, 'low')


#######################################
# Bandpass filter
# -------------------------------------
# Filter the data, using a bandpass of 
# 5-15Hz.
# 
# Input: 
#           the data buffer from Data_Buffer class
# Output:
#           filtered data as a numpy array

def bandpass(self,data_buffer):
high_passed = self.high_pass(data_buffer)
low_passed = self.low_pass(high_passed)
filtered_data = np.array(low_passed)
return filtered_data

def high_pass(self,data_buffer):
[b1, a1] = [self.high_pass_coefficients[0],self.high_pass_coefficients[1]]
high_passed = signal.filtfilt(b1,a1,data_buffer)
return high_passed

def low_pass(self,data_buffer):
[b, a] = [self.low_pass_coefficients[0],self.low_pass_coefficients[1]]
low_passed = signal.filtfilt(b,a,data_buffer)
return low_passed

Comments

  • wjcroftwjcroft Mount Shasta, CA
    Edmund, hi.

    Generally most EEG is in the band between .5 Hz and say 45 Hz. So it is easiest to just set a bandpass filter between those two limits. If you want to add a notch you can do that also, at your mains frequency, 50 or 60 Hz. If your band edges are sharp enough, you may not need the notch.

    William
  • JM123JM123 Slovakia
    edited November 2018
    Hi,
    Bandpass is combination of lowpass and highpass. I'm successfully filtering eeg data with bandpass and notch, you can find filters here:   

Sign In or Register to comment.