50Hz notch filter coefficients
Dear all,
I tried to change notch filter coefficient for 50Hz noise. I got coefficient from Matlab [b a] = butter(2, [49 51]./(250/2), 'stop');
It's seem that same method as developer who developed openBCIGUI.
But, I still see very high magnitude of 50Hz . This make signal always be railed in visualizer.
Any suggestion please ....


Comments
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
# assumed sample rate of OpenBCI
fs_Hz = 250.0
# create the 60 Hz filter
bp_stop_Hz = np.array([59.0, 61.0])
b, a = signal.butter(2,bp_stop_Hz/(fs_Hz / 2.0), 'bandstop')
# create the 50 Hz filter
bp2_stop_Hz = np.array([49, 51.0])
b2, a2 = signal.butter(2,bp2_stop_Hz/(fs_Hz / 2.0), 'bandstop')
# compute the frequency response
w, h = signal.freqz(b,a,1000)
w, h2 = signal.freqz(b2,a2,1000)
f = w * fs_Hz / (2*np.pi) # convert from rad/sample to Hz
And I got the following coefficients, which is exactly what you got:
# 60 Hz Notch for fs = 250 Hz
b = np.array([ 0.96508099, -0.24246832, 1.94539149, -0.24246832, 0.96508099])
b2 = np.array([0.96508099, -1.19328255, 2.29902305, -1.19328255, 0.96508099])
@chipaudette, I was looking for filter settings and configuration, which brought me here. As you are responsible for the filters I got a question for you: Is there a way to use the GUI to record filtered data rather than just the raw EMG? Also is it possible to record a new data set from playing back a [raw] recording that reflects the filters being applied in the GUI when you're looking at the waveforms you see in the time series (for example)?
Thanks in advance.
@BCIStudent, hi.
No, currently the GUI only records the raw data. This is so it can replay that recording using other filter settings. Each time EEG data is filtered (again), the fidelity of the signal is reduced. So having the GUI record filtered data is not a good idea. If you wish to filter EEG data, there are several libraries available, such as Brainflow, EEGLAB, Matlab, OpenViBE, etc.
William