Skip to main content

Python backend for bci-essentials

Project description

bci-essentials-python

This repository contains python modules and scripts for the processing of EEG-based BCI. These modules are specifically designed to be equivalent whether run offline or online.

Related packages

The front end for this package can be found in bci-essentials-unity

Getting Started

Installation

BCI Essentials requires Python 3.9 or later. To install for Windows, MacOS or Linux:

pip install bci-essentials

On some systems, it may be necessary to install liblsl. Alternatively, use the Conda environment to set up dependencies that are not provided by pip:

conda env create -f ./environment.yml
conda activate bci

Offline processing

Offline processing can be done by running the corresponding offline test script (ie. mi_offline_test.py, p300_offline_test.py, etc.) Change the filename in the script to point to the data you want to process.

python examples/mi_offline_test.py

Online processing

Online processing requires an EEG stream and a marker stream. These can both be simulated using eeg_lsl_sim.py and marker_lsl_sim.py. Real EEG streams come from a headset connected over LSL. Real marker streams come from the application in the Unity frontend. Once these streams are running, simply begin the backend processing script ( ie. mi_unity_backend.py, p300_unity_bakend.py, etc.) It is recommended to save the EEG, marker, and response (created by the backend processing script) streams using Lab Recorder for later offline processing.

python examples/mi_unity_backend.py

Directory

bci_essentials

The main packge containing modules for BCI processing.

  • eeg_data.py - module for reading online/offline data, windowing, processing, and classifying EEG signals
  • classification.py - module containing relevant classifiers for eeg_data, classifiers can be extended to meet individual needs
  • signal_processing.py- module containing functions for the processing of EEG_data
  • visuals.py - module for visualizing EEG data

examples

Example scripts and data.

  • data - directory containing example data for P300, MI, and SSVEP
  • eeg_lsl_sim.py - creates a stream of mock EEG data from an xdf file
  • marker_lsl_sim.py - creates a stream of mock marker data from an xdf file
  • mi_offline_test.py - runs offline MI processing on previously collected EEG and marker streams
  • mi_unity_backend.py - runs online MI processing on live EEG and marker streams
  • p300_offline_test.py - runs offline P300 processing on previously collected EEG and marker streams
  • p300_unity_backend.py - runs online P300 processing on live EEG and marker streams
  • ssvep_offline_test.py - runs offline SSVEP processing on previously collected EEG and marker streams
  • ssvep_unity_backend_tf.py - runs online SSVEP processing on live EEG and marker streams, does not require training
  • ssvep_unity_backend.py - runs online SSVEP processing on live EEG and marker streams
  • switch_offline_test.py - runs offline switch state processing on previously collected EEG and marker streams
  • switch_unity_backend.py - runs online switch state processing on live EEG and marker streams

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bci-essentials-0.1.0.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bci_essentials-0.1.0-py3-none-any.whl (74.2 kB view details)

Uploaded Python 3

File details

Details for the file bci-essentials-0.1.0.tar.gz.

File metadata

  • Download URL: bci-essentials-0.1.0.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for bci-essentials-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b54d6ee65bdcbcfe74780deba7a890283647a2f471ce2fd071ea0c84aee73e85
MD5 12da24e08c70c50dc1572400f909a6b1
BLAKE2b-256 7b596358df799109a115371e230797f5d17bef21cc4c43fc9f6d524bc16e6199

See more details on using hashes here.

File details

Details for the file bci_essentials-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bci_essentials-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 74.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for bci_essentials-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f0ca4a4353c9877aa83e7eeaaf3110114a778515f9ed8a4ba6519bec653a31c
MD5 af6e538ce692f629307ab822f665e061
BLAKE2b-256 a9e01171646dfb630504c6b5cda67262b1e0790ead08338b62fb2c67a711f614

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page