rendering data in python

When I graph the data from the .txt file in python from the SavedData folder, the graph is different. Is there a filter process that needs to be added to render the data from SavedData folder into a graph the way I see it in OpenBCI GUI, using python? Where is the documentation for it?

Comments

  • any help would be appreciated!
  • The process to turn text numeric data into a graph is a multistep process and it's hard to tell from your post where the problem might be.

    1. How are you converting the data in the .txt file into a vector of numbers to send to the Python graphing functions? Do you know what the format of the .txt file is for that conversion?

    2. Are you familiar with graphing time series data? Could you for example create sine wave data and plot it using the functions you are using to graph the data? If so, can you make your sine wave plot look similar to the OpenBCI GUI's graphical display?


  • edited May 2018
    Hi Billh, yes, I imported the data and graphed it in python, but the graph is different from what I see in OpenBCI GUI. So I'm assuming I'm missing some pre-processing steps, but it's difficult to find a documentation on that. For example, what would be the default function that is being applied to OpenBCI GUI's graphical display that I can apply to the python rendering? I am getting the sine wave in python graph so far. Any tips will be appreciated.
  • Do you know what the units of your imported data are?

  • The .txt file says "EEG data in microvolts." Below are some samples.

    17723.75
    17208.76
    17234.49
    17846.32
    17846.79
    17272.49
    17176.29
    17768.38
    17892.21
    17395.42
  • Okay, now get the statistics of your data sample. Number of data points, mean, maximum, minimum?  If the data seems skewed from a mean near zero, it may need to be filtered before it looks right.
    .
  • Mean of 255 data points x 3 sec is appx. 17705. What filtering process do you recommend?
  • Probably a 1 hz highpass filter of butterworth type, with something such as scipy.signal's butter and or filtfilt (check python's scipy docs). Filter the data til the graph looks right, and if it zeros completely you have done too much filtering.



  • Awesome, ty!
  • Any guesses on how to do low filters? It looks like the most voted code in the stackoverflow only has high pass filter. I created my own lowpass filter and tried it but didn't work.
  • edited May 2018
    Thanks, the bandpass filter still is not enough. For example, how do I go from sine waves to what's showing as the ECG, with the R waves?
  • edited May 2018
    Not sure why you would see this. I wonder if the bandpass settings on the EKG lead is different, for example 0.05 to 40 Hz.

    You are running the same file though the OpenBCI GUI as you are graphing yourself, right? Are you using the same EKG montage, if it is bipolar? The bipolar part has to do with graphing a net difference of two data leads instead of graphing each lead's voltage directly.

    One other problem that sometimes comes up with what you are doing is edge filtering artifact on the beginning and end of the graph of a short sample. It sometimes makes sense to trim the start and end of the filtered graph data.

    If none of this helps, you might want to post screenshots.Graphing signals can become kind of an art form sometimes.





  • I'm transforming the raw .txt from the SavedData into sine, then putting bandpass filter 0.01 to 55 Hz. Is there anything I'm missing?
  • wjcroftwjcroft Mount Shasta, CA
    Can you upload your graph to Google Drive and post a link here?

    When you say: " how do I go from sine waves to what's showing as the ECG, with the R waves?", do you mean each ECG pulse wave looks "kind of" like a sine? That would imply your filter is smearing out the high frequency components. Are you using a bandpass from say 1 hz or .5 hz to 40 hz? Your filter order may also be too low, which smears out the edges of your filter. Should be at least 3rd or 4th order.

    OpenBCI data is FbEEG, full band, including the DC offset.


    Regards,

    William



  • Here's the sample graph with bandpass .01,40 Hz. The difference from .05,40 was negligible in the graph. The order didn't make difference either, when I changed from 5 to 4. https://drive.google.com/file/d/1oStwZPGnIQrByCfNgskxUYMGifiNTga5/view?usp=sharing

    What I mean by  "how do I go from sine waves to what's showing as the ECG, with the R waves?" is just that I am trying to get the EKG pulse wave from the raw data. I don't mean to say it looks like a sine graph.
  • So you are saying that the exact same data from that same data file, run on OpenBCI GUI, is a better EKG graphic? 


Sign In or Register to comment.