Skip to main content

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_backend.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 package containing modules for BCI processing.

  • bci_controller.py - module for reading online/offline data, windowing, processing, and classifying EEG signals
  • classification.py - module containing relevant classifiers for bci_controller, classifiers can be extended to meet individual needs
  • signal_processing.py- module containing functions for the processing of bci_controller
  • 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

Release files for bci-essentials 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bci-essentials 0.3.2
File Size Uploaded
bci_essentials-0.3.2.tar.gz 65.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bci-essentials 0.3.2
File Interpreter ABI Platform
bci_essentials-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 156.8 kB

Release files / bci_essentials-0.3.2.tar.gz

Download URL bci_essentials-0.3.2.tar.gz
Size 65.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3d7cf3a3538c94e16d25d27e82a3a2443fecacd14161cb0f6a3a3bd81458b82f
BLAKE2b-256 checksum
How to use checksums
6e8d9a6aea5c9f06935741a9462dcab55307969280e72599b427bf999c504d3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release files / bci_essentials-0.3.2-py3-none-any.whl

Download URL bci_essentials-0.3.2-py3-none-any.whl
Size 91.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b926f997427bd68c27ecbd2b3f4a5622ad0c6a49ccc1e46d503c87f276dd70d
BLAKE2b-256 checksum
How to use checksums
16f1a60a77614c39362481a429ba91aa6d96b7a1891a583bb178d7413ab1b694
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page