Difference between filtered output and OpenBCI GUI time series

bciwikibciwiki USA
edited July 2022 in Software

I’m making a web interface for graphing live EEG data. Currently streaming from a Cyton board using this LSL tool
I've also modified this script to apply filtering and limit the size of the output file.
Here's how I'm attempting to implement the notch and bandpass filters:

from scipy import signal

b_notch, a_notch = signal.iirnotch(60.0, 20, 250)

nyq = 0.5 * 250
low = 1/nyq
high = 50/nyq
b_butter, a_butter = signal.butter(2, [low, high], 'bandpass', analog=False)

y = signal.filtfilt(b_notch, a_notch, tsessiondata[1])
y = signal.filtfilt(b_butter, a_butter, y, axis=0)
tsessiondata = np.append(tsessiondata, np.array([y]), axis=0)

There’s a big difference between plots in the OpenBCI GUI application and the graph I’ve been able to generate. Am I applying the bandpass filter incorrectly or is there some standard way to remove noise from the ends of the filtered output?

OpenBCI GUI time series with notch and bandpass filter:

Plots of unfiltered then filtered EEG signal from the 1st channel:


Comments

  • wjcroftwjcroft Mount Shasta, CA

    Hi Landon,

    My perception is that you have incorrectly specified the sample rate of the Ganglion. It is 200 Hz, not 250 Hz. Cyton is 250.

    Your output graphs show abundant mains noise, which is not being notched out, because of the wrong sample rate.

    Regards, William

  • Hi William,
    Thank you for the reply. I am actually using the Cyton. The GUI recording is 4 channels with the synthetic data option.

    This center part of the filtered graph seems correct. Is the OpenBCI GUI showing a center frame like this? If that's the case how could I know the right size for that window to be?

  • wjcroftwjcroft Mount Shasta, CA

    Apologies on my confusion over the 4 channel GUI image.

    All EEG amplifiers have some 'transient' noise at startup time. But this is usually gone after a second or so. Your graphs above have no time scale. In any case, there should not be noise portions at the end of the recording. That this graph shows a 'mirror' image appearance is very odd and should be investigated.

Sign In or Register to comment.