All Projects → kaczmarj → rteeg

kaczmarj / rteeg

Licence: MIT license
[DEPRECATED: use MNE-Python] Python module to stream and analyze EEG data in real-time

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to rteeg

Electrophysiologydata
A list of openly available datasets in (mostly human) electrophysiology.
Stars: ✭ 143 (+410.71%)
Mutual labels:  eeg
Deepsleepnet
DeepSleepNet: a Model for Automatic Sleep Stage Scoring based on Raw Single-Channel EEG
Stars: ✭ 200 (+614.29%)
Mutual labels:  eeg
ganglion-ble
Web Bluetooth client for the Ganglion brain-computer interface by OpenBCI
Stars: ✭ 27 (-3.57%)
Mutual labels:  eeg
Deep Bci
An open software package to develop BCI based brain and cognitive computing technology for recognizing user's intention using deep learning
Stars: ✭ 168 (+500%)
Mutual labels:  eeg
Eeg 101
Interactive neuroscience tutorial app using Muse and React Native to teach EEG and BCI basics.
Stars: ✭ 199 (+610.71%)
Mutual labels:  eeg
Brainstorm3
Brainstorm software: MEG, EEG, fNIRS, ECoG, sEEG and electrophysiology
Stars: ✭ 213 (+660.71%)
Mutual labels:  eeg
Pyeeg
Python + EEG/MEG = PyEEG
Stars: ✭ 126 (+350%)
Mutual labels:  eeg
TSception
PyTorch implementation of TSception
Stars: ✭ 52 (+85.71%)
Mutual labels:  eeg
Eegsynth
Converting real-time EEG into sounds, music and visual effects
Stars: ✭ 196 (+600%)
Mutual labels:  eeg
eeg-explorer
Visual EEG readings from the Muse EEG Headset
Stars: ✭ 35 (+25%)
Mutual labels:  eeg
Brainflow
BrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
Stars: ✭ 170 (+507.14%)
Mutual labels:  eeg
Muse Js
Muse 2016 EEG Headset JavaScript Library (using Web Bluetooth)
Stars: ✭ 193 (+589.29%)
Mutual labels:  eeg
Moabb
Mother of All BCI Benchmarks
Stars: ✭ 214 (+664.29%)
Mutual labels:  eeg
Fooof
Parameterizing neural power spectra into periodic & aperiodic components.
Stars: ✭ 162 (+478.57%)
Mutual labels:  eeg
pybv
A lightweight I/O utility for the BrainVision data format, written in Python.
Stars: ✭ 18 (-35.71%)
Mutual labels:  eeg
Entropy
EntroPy: complexity of time-series in Python (DEPRECATED)
Stars: ✭ 142 (+407.14%)
Mutual labels:  eeg
Neurotech Course
CS198-96: Intro to Neurotechnology @ UC Berkeley
Stars: ✭ 202 (+621.43%)
Mutual labels:  eeg
mne-connectivity
Connectivity algorithms that leverage the MNE-Python API.
Stars: ✭ 41 (+46.43%)
Mutual labels:  mne-python
EEG-Motor-Imagery-Classification-CNNs-TensorFlow
EEG Motor Imagery Tasks Classification (by Channels) via Convolutional Neural Networks (CNNs) based on TensorFlow
Stars: ✭ 125 (+346.43%)
Mutual labels:  eeg
Eeglab
EEGLAB is an open source signal processing environment for electrophysiological signals running on Matlab and developed at the SCCN/UCSD
Stars: ✭ 233 (+732.14%)
Mutual labels:  eeg

Real-Time EEG

Build Status Code Coverage

rteeg provides the infrastructure to access EEG data in Python in real-time. The package uses LabStreamingLayer to stream EEG data and event markers and MNE-Python to analyze data. TCP/IP will be supported soon.

How it works

rteeg connects to a LabStreamingLayer (LSL) stream of raw EEG data or event markers and records the data being transmitted. The EEG data can then be analyzed in real-time in chunks with an analysis workflow provided by the user. The analysis workflow can be triggered whenever a buffer of a user-defined size becomes full, and visual feedback can be provided using HTML and CSS.

How to use it

To connect to a LabStreamingLayer (LSL) stream of EEG data, create an instance of the class EEGStream. The EEG system being used must be specified in the eeg_system argument. The program will search for a stream that matches the predicate default_predicates.eeg[`eeg_system`]. Predicates must be written in XML Path Language and can be added or removed to suit the user's needs.

Once connected to an EEG stream, data can be converted to mne.Raw or mne.Epochs objects with methods make_raw() and make_epochs(), respectively. A stream of event markers is required to make an mne.Epochs object. Connect to a LSL stream of event markers by creating an instance of the class MarkerStream.

Independent Component Analysis

It is also possible to use Independent Component Analysis (ICA) to remove artifacts each time data is retrieved. The ICA solution must first be computed (a.k.a. "fit") on some data, and components must be selected for removal. Use the method EEGStream.fit_ica() to fit the ICA. This returns an mne.preprocessing.ICA object, which is stored in EEGStream.ica. Plot the sources of the ICA using EEGStream.viz_ica(), and select the components that should be removed. If the ICA object has been fit and components have been selected for removal, these components will be removed from incoming data when using EEGStream.make_raw().

Looping analysis

A function can be called each time a buffer of EEG data increases by a user-defined amount.

Saving data

To save the data at the end of the recording session, use make_raw().save(fname), where fname is the filename. This saves the EEG data as a FIF file. If an instance of MarkerStream is supplied, events should be present in the EEG data.

How to use it if you don't have an EEG cap

Included in this repo is a script that transmits synthetic EEG data over a LabStreamingLayer stream. Simply run that file (python send_eeg_data.py in a terminal) in order to try rteeg. Event markers can be sent by running the file send_markers.py in the same directory.

How to save fitted models

Fitted machine learning models should be included in a dictionary that also includes important information about that model. The information included in the dictionary is very important because the number of features in the training set must be equal to the number of features in the testing set. Seemingly minor differences between the processing steps of training and testing sets could result in unequal numbers of features. The dictionary can look like this:

clf_dictionary = {
    'paradigm' : "In inattention condition, subjects looked at a crosshair. "
                 "In attention, subjects played sudoku.",
    'processing': "Data were FIR filtered (0.5 to 40 Hz), and "
                  "artifacts were removed with ICA. Power "
                  "spectral density was computed (0.5 to 7.0 Hz), and PCA "
                  "(15 components) was computed on the power. The output "
                  "of PCA served as the features for the model.",
    'n_samples_for_training' : 65,
    'n_features': 15,
    'classifier' : ExtraTreesClassifier(),  # Fitted model here.
}

The dictionary should be saved to a JSON file. Pickling the dictionary is discouraged because of the instability and security risks of pickle files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].