Giter Site home page Giter Site logo

pyemotiv's Introduction

pyemotiv

A Python library to aquire data from the Emotiv Epoc EEG neuroheadset, using the files provided with the Emotiv research SDK.

Requirements:

  • Python 2.7+
  • Numpy 1.5.0+
  • Research SDK library files. These files are available from Emotiv by purchasing the research SDK. These must be build for the same architecture as your python installation (either i386 or x86_64), otherwise ctypes.CDLL will raise an error.

Setup:

  • Build and install the library: python setup.py build install
  • Dynamic link library files for the research SDK should be placed in a location known to your system's PATH:
    • Windows: edk.dll and edk_utils.dll in windows/system32
    • OSX: libedk.dylib and libedk_ultils_mac.dylib in usr/local/lib
  • Import class Epoc from emotiv.py into your Python application.

Usage:

This demonstrates using a call to get all data from the Epoc at once:

from pyemotiv import Epoc

epoc = Epoc()
while True:
    epoc.get() #Aquire latest data from hardware buffer. Iterates over all channels
    data = epoc.raw #14-by-n numpy array containing raw data for AF3 through AF4
    gyros = epoc.gyros #2-by-n-row array containing data for GYROX and GYROY
    times = epoc.times #1d array containing timestamp values (interpolated)
    everything = epoc.all_data # 25-by-n array containing all data returned by emotiv

The next two examples demonstrate using reduced calls that just get certain channels of data (only the raw EEG, or only the gyros). This is more efficient if you know what you want.

from pyemotiv import Epoc

epoc = Epoc()
while True:
    data = epoc.get_raw() #14-by-n numpy array containing raw data for AF3 through AF4
    #this is equivelant to:
    data = epoc.aquire([3,4,5,6,7,8,9,10,11,12,13,14,15,16]) #AF3 through AF4
    times = epoc.times #array of interpolated timestamps, just as before
from pyemotiv import Epoc

epoc = Epoc()
while True:
    gyros = epoc.get_gyros() #2-by-n-row array containing data for GYROX and GYROY
    #this is equivelant to:
    data = epoc.aquire([17,18]) #GYROX, GYROY
    times = epoc.times #array of interpolated timestamps, just as before

You can mix and match these two kinds of calls with the get() method shown in the first example, if you prefer. However the times array will not be accurate if you do this. Best practice is to decide beforehand which arrays you would like to access, and keep your calls consistent with that.

Todo:

  • Add support for Linux (I do not have access to the Linux SDK files, though)
  • Restructure the wrapper using Cython rather than ctypes. This will do the channel looping in C rather than Python. It might not be a huge boost in absolute terms, but for a 128mhz device it could lead to real-time in-the-loop applications having quicker response times to evoked stimuli.

pyemotiv's People

Contributors

thearn avatar

Stargazers

 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

pyemotiv's Issues

Emotiv electrodes numbering

Dear Thearn and users of pyemotiv,

I am newbie to using emotiv headset for EEG data collection. I wanted to know
data = epoc.aquire([3,4,5,6,7,8,9,10,11,12,13,14,15,16]) #AF3 through AF4
which electrodes do each of the numbers indicate.

Thanks in advance
Tharun

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.