Code Monkey home page Code Monkey logo

eegrunt's Introduction

EEGrunt: A Collection Python EEG (+ECG) Analysis Utilities

Working with EEG (electroencephalography) data is hard, and this little library aims to make it easier. EEGrunt consists of a collection of functions for reading EEG data from CSV files, converting and filtering it in various ways, and finally generating pretty and informative visualizations.

Update: We’ve added functions to plot heart rate and heart rate variability from recorded OpenBCI ECG (electrocardiography) data. You can test these out with the analyze_ecg_channel.py and analyze_ecg_data.py demo scripts. We’ve posted a new tutorial on our blog to get you started: EEGrunt update: Analyze heart rate and HRV with Python

Features

  1. EEGrunt is compatible with data from OpenBCI and Muse.

  2. EEGrunt has bandpass, notch, and highpass filters for cleaning up powerline interference, OpenBCI's DC offset, and zeroing in on the frequency band you want to analyze.

  3. EEGrunt makes it easy to generate signal plots, amplitude trend graphs, spectrograms, and FFT (fast-fouier transform) graphs, etc.

Getting Started

  1. Download or clone the repo: git clone https://github.com/curiositry/EEGrunt
  2. Run sudo bash install_linux_dependencies.sh (tell me if this doesn’t work)
  3. Take a look in analyze_data.py and edit at will, or create your own script using EEGrunt.py. Make sure to set the required variables — device, path, and filename.
  4. Run it: python analyze_data.py
  5. Read the announcement post for the official tutorial!
  6. [Optional] Interested in analyzing ECG data with EEGrunt? Take a look at the new tutorial.

eegrunt's People

Contributors

curiositry avatar jnaulty avatar orthographic-pedant avatar photosynthesis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eegrunt's Issues

Can't run on mac

EEGrunt git:(master) ✗ sudo bash install_linux_dependencies.sh
Password:
sudo: apt-get: command not found
WARNING: The directory '/Users/mohankumarv/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.4.1)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.18.5)

Installation on Mac OS X 10.11 (El Capitan)

I just got this to run on mac os x 10.11 doing the following (you need homebrew installed):

brew install python
pip install numpy
pip install scipy
pip install matplotlib

It appeared to hang after generating the spectrogram.

Joels-iMac:EEGrunt joel$ python analyze_data.py 
Loading EEG data: data/eegrunt-obci-ovibe-test-data.csv
Loading channel: 1
Processing channel 1
Highpass filtering at: 1.0 Hz
Notch filter removing: 57.0-63.0 Hz
Generating signal plot...
Calculating spectrum data...
Generating spectrogram...
^CTraceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 1889, in button_press_event
    def button_press_event(self, x, y, button, dblclick=False, guiEvent=None):
KeyboardInterrupt
^C^C^C^C^C^C
^D

screen shot 2015-11-24 at 3 56 19 pm

Muse - museMonitor format

Hi,
it might be too much to ask, but I try anyway!

I have a muse 2016 and unfortunately I am having problems running muse-lsl for bluetooth issues on my machine :(

So I am using an app called MuseMonitor and I can record in .muse format or .csv.
When I try to run the analyze_data I get "IndexError: too many indices for array"

I realize that the problem is the format for sure different..
I am beginner with python, so I will try to check if I can fix the problem myself, but if you have any suggestion it will for sure help!

the column names I get from the .csv and a first line:

TimeStamp,Delta_TP9,Delta_AF7,Delta_AF8,Delta_TP10,Theta_TP9,Theta_AF7,Theta_AF8,Theta_TP10,Alpha_TP9,Alpha_AF7,Alpha_AF8,Alpha_TP10,Beta_TP9,Beta_AF7,Beta_AF8,Beta_TP10,Gamma_TP9,Gamma_AF7,Gamma_AF8,Gamma_TP10,RAW_TP9,RAW_AF7,RAW_AF8,RAW_TP10,AUX_RIGHT,Accelerometer_X,Accelerometer_Y,Accelerometer_Z,Gyro_X,Gyro_Y,Gyro_Z,HeadBandOn,HSI_TP9,HSI_AF7,HSI_AF8,HSI_TP10,Battery,Elements 2017-11-20 22:41:01.738,0.9025755,0.6792804,0.0,1.0303508,0.6843497,0.3073409,0.0,0.7147551,1.1894307,0.41819534,0.0,0.9815956,0.7329064,0.1080209,0.0,0.5908704,0.3168565,-0.15387148,0.0,0.16846296,856.2271,946.4835,747.4359,864.68866,954.5421,0.429931640625,0.12445068359375,0.90252685546875,-1.51031494140625,6.287994384765625,2.51220703125,1,1.0,1.0,2.0,1.0,97.94
If you need I could send you a recording!
(if I solve it in the meanwhile I will let you know!)

Thank you!

EEG.data = EEG.bandpass(start,stop)

There is no mention of this line from analyze_data.py in the Getting Started section, but it appears that the start/stop variables must be set in order to run the program. Am I missing something? Otherwise, what should those be set to? Thanks for your assistance.

EEG modules for Orange3?

Researchers often use machine learning algorithms on EEG data, e.g. when training a BCI to issue a command based on a participant's mental The Orange3 platform is a visual programming tool for machine learning, making it easy for many people to do machine learning.

Please consider publishing one or more Orange3 widgets, so researchers might use EEGrunt via a visual programming environment.

Is the OpenBCI ganglion board supported?

Hi there, great program!

I have some raw OpenBCI recordings that I’m not able to analyze. The OpenBCI board in question is the Ganglion, the recording (txt) is conducted using the OpenBCI gui. I’m able to analyze the raw sample (eegrunt-obci-raw-test-data.txt) that comes with EEGrunt, but my recording won’t run. The source is set to 'openbci' in analyze_data.py.

digitalgutenberg@soap ~/git/EEGrunt $ python analyze_data.py
Loading EEG data: data/OpenBCI-RAW-2017-03-12_22-40-25.txt
Traceback (most recent call last):
File "analyze_data.py", line 29, in
EEG.load_data()
File "/home/digitalgutenberg/git/EEGrunt/EEGrunt.py", line 78, in load_data
usecols=(0,1,2,3,4,5,6,7,8)
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 923, in loadtxt
vals = [vals[i] for i in usecols]
IndexError: list index out of range

So, is this simply because EEGrunt doesn’t support the Ganglion, or is there some kind of user error on my end? I've used the default settings.

EEG recording:
https://github.com/digitalgutenberg/EEG-recordings/blob/master/OpenBCI-RAW-2017-03-12_22-40-25.txt

Thanks in advance!

Indices

Hello!

I've been trying to get this program to run on my computer, but have been encountering issues when I run analyze_data.py.

I'm pretty new to linux and python, so it's possible I installed something incorrectly/am doing something horribly wrong.

Dunno if its helpful, but I'm running Ubuntu and trying to get the program to run through ipython.

The first error I get is: IndexError: too many indices for array

Referring to:
/home/user/Downloads/EEGrunt-master/EEGrunt.pyc in load_channel(self, channel)
110 def load_channel(self,channel):
111 print("Loading channel: "+str(channel))
--> 112 channel_data = self.raw_data[:,(channel+self.col_offset)]
113 self.channel = channel
114 self.data = channel_data

I googled a little bit and tried to fix the error by adding ndmin = 2 to raw_data, which changes the error to: IndexError: index 0 is out of bounds for axis 1 with size 0

Referring to:
/home/user/Downloads/EEGrunt-master/EEGrunt.pyc in load_channel(self, channel)
110 def load_channel(self,channel):
111 print("Loading channel: "+str(channel))
--> 112 channel_data = self.raw_data[:,(channel+self.col_offset)]
113 self.channel = channel
114 self.data = channel_data

I'm pretty sure I'm just missing something, because I don't see any other references to this error.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.