Code Monkey home page Code Monkey logo

streaming-eeg-data's Introduction

Muse LSL

This is a collection of Python scripts to use the Muse 2016 BLE headset with LSL.

Blinks

Requirements

The code relies on pygatt for the BLE communication. pygatt works on Linux and should work on Windows and macOS provided that you have a BLED112 dongle. You have to use the development version of pygatt, that can be installed with pip using:

pip install git+https://github.com/peplin/pygatt

You will also need to find the MAC address of your Muse headset. This code is only compatible with the 2016 version of the Muse headset.

Finally, the code for streaming and recording data is compatible with Python 2.7 and Python 3.x. However, the code for stimulus presentation relies on psychopy and therefore only runs with Python 2.7.

Usage

To stream data with LSL:

python muse-lsl.py

The script will auto detect and connect to the first Muse device. In case you want a specific device or if the detection fails, find the name of the device and pass it to the script :

python muse-lsl.py --name YOUR_DEVICE_NAME

You can also directly pass the MAC address (this option is also faster at startup):

python muse-lsl.py --address YOUR_DEVICE_ADDRESS

Once the stream is up and running, you can visualize it with

python lsl-viewer.py

Available experimental paradigms

The following paradigms are available:

Paradigm Stimulus presentation Data Analysis
Visual P300 stimulus_presentation/generate_Visual_P300.py stimulus_presentation/generate_Visual_P300_stripes.py data/visual/P300/ click here
Auditory P300 stimulus_presentation/generate_Auditory_P300.py data/auditory/P300 click here
N170 stimulus_presentation/generate_N170.py data/visual/N170 click here
SSVEP stimulus_presentation/generate_SSVEP.py data/visual/SSVEP click here
SSAEP stimulus_presentation/generate_SSAEP.py data/auditory/SSAEP click here
Spatial frequency stimulus_presentation/generate_spatial_gratings.py data/visual/spatial_freq click here

The stimulus presentation scripts can be found under stimulus_presentation/. Some pre-recorded data is provided under data/, alongside analysis notebooks under notebooks.

Visual P300

The task is to count the number of cat images that you see. You can add new jpg images inside the stimulus_presentation directory: use the target- prefix for cat images, and nontarget- for dog images.

Auditory P300

The task is to count the number of high tones that you hear.

N170

The task is to mentally note whether a "face" or a "house" was just presented.

SSVEP

The task is to passively fixate the center of the screen.

SSAEP

The task is to passively fixate the center of the screen while listening to the sounds you hear.

Spatial frequency gratings

The task is to passively fixate the center of the screen.

Running an experiment

First, you have to run the muse-lsl script as described above.

In another terminal, run

python stimulus_presentation/PARADIGM.py -d 120 & python lsl-record.py -d 120

where PARADIGM.py is one of the stimulus presentation scripts described above (e.g., generate_Visual_P300.py).

This will launch the selected paradigm and record data for 2 minutes.

For data analysis, check out these notebooks.

Common issues

  1. pygatt.exceptions.BLEError: Unexpected error when scanning: Set scan parameters failed: Operation not permitted (Linux)
  • This is an issue with pygatt requiring root privileges to run a scan. Make sure you have libcap installed and run sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
  1. pygatt.exceptions.BLEError: No characteristic found matching 273e0003-4c4d-454d-96be-f03bac821358 (Linux)
  • There is a problem with the most recent version of pygatt. Work around this by downgrading to 3.1.1: pip install pygatt==3.1.1

streaming-eeg-data's People

Contributors

alexandrebarachant avatar jdpigeon avatar pdpino avatar urish avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

duyenle1312

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.