Code Monkey home page Code Monkey logo

neuropy's Introduction

NeuroPy

NeuroPy library written in python to connect, interact and get data from NeuroSky's MindWave EEG headset.

This library is based on the mindwave mindset communication protocol published by Neurosky and is tested with Neurosky Mindwave EEG headset.

Installation

  1. Download the source distribution (zip file) from dist directory or from PyPi
  2. Unzip and navigate to the folder containing setup.py and other files
  3. Run the following command: python setup.py install

Usage

  1. Importing the module: from NeuroPy import NeuroPy
  2. Initializing: neuropy = NeuroPy()
  3. After initializing, if required the callbacks can be set
  4. Then call neuropy.start() method, it will start fetching data from mindwave.
  5. To stop call neuropy.stop()

Obtaining Data from Device

  • Obtaining value: attention = neuropy.attention #to get value of attention_

    Other Variable attention, meditation, rawValue, delta, theta, lowAlpha, highAlpha, lowBeta, highBeta, lowGamma, midGamma, poorSignal and blinkStrength

  • Setting callback: A call back can be associated with all the above variables so that a function is called when the variable is updated. Syntax:

    setCallBack("[variable]",callback_function)
    

    for eg. to set a callback for attention data the syntax will be

    setCallBack("attention",callback_function)
    

    Other Variables: attention, meditation, rawValue, delta, theta, lowAlpha, highAlpha, lowBeta, highBeta, lowGamma, midGamma, poorSignal and blinkStrength

Sample Program 1 (Access via callback)

from NeuroPy import NeuroPy
from time import sleep

neuropy = NeuroPy() 

def attention_callback(attention_value):
    """this function will be called everytime NeuroPy has a new value for attention"""
    print ("Value of attention is: ", attention_value)
    return None

neuropy.setCallBack("attention", attention_callback)
neuropy.start()

try:
    while True:
        sleep(0.2)
finally:
    neuropy.stop()

Sample Program 2 (Access via object)

from NeuroPy import NeuroPy
from time import sleep

neuropy = NeuroPy() 
neuropy.start()

while True:
    if neuropy.meditation > 70: # Access data through object
        neuropy.stop() 
    sleep(0.2) # Don't eat the CPU cycles

Python Compatibility

Note

I only have MindWave mobile, and therefore this library is supposed to work on it. I do not promise if it will work on other models. Another library which was suggested to me after I wrote this library can be found HERE. I have not tested that library, and cannot give any guarantees. More about the difference between the models of MindWave can be found HERE.

More Information

lihashgnis.blogspot.in - A blog post

neuropy's People

Contributors

lihas avatar nekromant avatar soachishti avatar christophebossens avatar

Watchers

James Cloos avatar

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.