EEGLab Streaming Time Series

eegstud24eegstud24 Williamsburg, VA
edited July 2020 in OpenBCI_GUI

Problem:

I cannot seem to visualize live time series data on EEGLab. The plot shows high contamination and artifacts, possibly due to lack of filtering.

Methodology:

I'm recording the time series stream using LabRecorder, which simply records LSL streams and saves them into an XDF file. I then simply load this XDF file into EEGLab for visualization. I made sure to turn on filters in the OpenBCI GUI (default filters were applied). To replicate this issue, anyone with EEGLab can follow the steps above.

Notes:

  • GUI Version 5.0
  • OpenBCI GUI time series plot show live data perfectly fine.
  • Visualizing simulated EEG GUI data on EEGLab works perfectly fine
  • Applying a bandpass filter and a notch filter in EEGLab should theoretically solve the problem if this was a filtering issue, but in reality the problem remains.
  • A simple direct Matplotlib plot of the GUI-filtered LSL time series data also looks as strange as the EEGLab plots.
  • I can actually visualize live time series fine using OpenVibe after applying the appropriate filters, but there I streamed data through the OpenBCI driver.

Pictures (bottom is simulated data, top is live):


Comments

  • wjcroftwjcroft Mount Shasta, CA

    Winson, hi.

    Could the issue be with the XDF data format? Surely EEGLab can read BDF? OpenBCI can output BDF files.

    I would suggest examining the XDF file with another program, but it does not look like EDFBrowser supports XDF.

    https://www.teuniz.net/edfbrowser/

    Regards, William

  • wjcroftwjcroft Mount Shasta, CA

    Also I don't quite understand how you can call this 'live', with all the intermediate steps.

  • wjcroftwjcroft Mount Shasta, CA
  • eegstud24eegstud24 Williamsburg, VA
    edited July 2020

    Hi William,
    I did some experimenting, and it looks like BDF files work fine in EEGLab. However, I wanted to use XDF files because LabRecorder can automatically synchronize an EEG stream with a marker stream and put all of the resulting data into 1 XDF file. I do not want to use any hardware approaches to marking events since I just want to get a quick motor imagery experiment up and running. I don't have much hardware experience either.

    MatlabViewer doesn't work for me. I could stream time series directly from LSL and into Python, but the data looks strange there too. (As in, it looks unfiltered even though the GUI is sending filtered data.) Here's the code I used:

    ## Code
    from pylsl import StreamInlet, resolve_stream
    import matplotlib.pyplot as plt
    streams = resolve_stream('type', 'EEG')
    inlet = StreamInlet(streams[0], max_buflen=1)
    samples = 500
    channels = 8
    data = [[] for i in range(8)]
    for sample in range(samples):
        for channel in range(channels):
            rec, timestamp = inlet.pull_sample()
            data[channel].append(rec[channel])
    plt.plot(data[0])
    plt.show()
    
  • wjcroftwjcroft Mount Shasta, CA

    What is the source of the "marker stream"? How is it synchronized with your EEG data stream? How do you know that this synchronization is truly accurate? Generally there will be some time offset with such an approach.

  • eegstud24eegstud24 Williamsburg, VA

    The marker stream is just another LSL stream sent from the stimulus presentation software I wrote using PsychoPy. Right, there very well may be some jitter/drift. It's probably required to use hardware approaches if I was doing an ERP study. But in motor imagery experiments I just want to know in general when the imagination began. I did some simple experiments with LabRecorder and found the markers to be accurate enough (within ms).

  • wjcroftwjcroft Mount Shasta, CA

    Winson, thanks.

    Would it not be easier to run this entire BCI, using OpenViBE. (Live, real-time.) Which I believe you say is working. Why involve the XDF step recording and EEGLAB? Does EEGLAB actually allow real-time live streaming input? I thought that was the domain of BCILAB...

    http://blog.jfrey.info/2015/03/03/openbci-motor-imagery/
    https://www.google.com/search?q=eeglab+vs+bcilab

    Regards, William

  • eegstud24eegstud24 Williamsburg, VA
    edited July 2020

    Hi William!

    Thanks for the links and for helping me brainstorm. Also, let me clarify: my advisor wants to analyze the data offline in EEGLab since he's most experienced with that software. We want to analyze the brain signals present to look for mu rhythms, etc. first.

    Enjoy the rest of your day,
    Winson

Sign In or Register to comment.