Skip to content

shurru/pyemotiv

 
 

Repository files navigation

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)

About

A Python library for data acquisition from the Emotiv Epoc EEG headset, using the research SDK.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • MATLAB 0.1%