Skip to main content

High level Python module for handle OpenBCI EEG acquisition boards

Project description

OpenBCI-Stream

High level Python module for EEG acquisition and streaming for OpenBCI Cyton board.

About this project

What is it?

A Python module for high-performance interfaces development with OpenBCI boards. Currently, we have support for Cyton+Daisy and their WiFi module, additionally, we provide a real-time data streaming feature using Kafka.

What we want?

We want a stable, high level, easy to use and extensible Python module focalizes on the hardware provided by OpenBCI, a library that can be used for students, hobbyist and researchers, we are developing a set of tools for preprocessing, real-time data handling and streaming of EEG signals.

About us?

We are a research group focused on digital processing of signals and machine learning from the National University of Colombia at Manizales (GCPDS).

Main features

  • Asynchronous acquisition: After the board initialization, the data acquisition can be executed asynchronously, this feature ables to realize background operations without interrupt and affect the data sampling read more...
  • Streaming data: The EEG data is streamed with Apache Kafka, this means that the data can be consumed from any other interface or language read more...
  • Remote host: Is possible to get OpenBCI running in one computing system and manage it from other read more...
  • Command line interface: A simple interface is available for handle the start, stop and access to data stream directly from the command line read more...
  • Markers/Events handler: read more...
  • **Distributed platforms: **

Examples

Read 5 seconds EEG from serial:

from openbci_stream.acquisition import CytonRFDuino
import time

openbci = CytonRFDuino(capture_stream=True, daisy=False)
openbci.start_stream()
time.sleep(5)
openbci.stop_stream()

print(openbci.eeg_time_series.shape)

Stream markers through Kafka

import time
from datetime import datetime
import pickle
from kafka import KafkaProducer

producer_eeg = KafkaProducer(bootstrap_servers=['localhost:9092'],
                             value_serializer=lambda x: pickle.dumps(x))

def stream_marker(marker):
    producer_eeg.send('marker', {'timestamp': datetime.now().timestamp(), 
                                 'marker': marker})

stream_marker('RIGHT')
time.sleep(1) 
stream_marker('LEFT')
time.sleep(1) 
stream_marker('RIGHT')
time.sleep(1) 
stream_marker('LEFT')    

Starting streaming from command line and store as 'CSV'

$ python openbci_cli.py serial  --start  --output 'eeg_out.csv'
Writing data in 
Ctrl+C for stop it.

[EEG] 2020-03-04 22:57:57.117478        0.0146s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:57:58.138276        0.0153s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:57:59.158153        0.0161s ago     302 samples, 8 channels
[EEG] 2020-03-04 22:58:00.179612        0.0155s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:58:01.199204        0.0164s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:58:02.219734        0.0154s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:58:03.239956        0.0159s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:58:04.259876        0.0134s ago     254 samples, 8 channels
[EEG] 2020-03-04 22:58:05.281410        0.0170s ago     256 samples, 8 channels
[EEG] 2020-03-04 22:58:06.301453        0.0199s ago     256 samples, 8 channels
[EEG] 2020-03-04 22:58:07.322150        0.0141s ago     254 samples, 8 channels

Release history Release notifications | RSS feed

Download files

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

Source Distribution

openbci-stream-1.0a2.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

openbci_stream-1.0a2-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file openbci-stream-1.0a2.tar.gz.

File metadata

  • Download URL: openbci-stream-1.0a2.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for openbci-stream-1.0a2.tar.gz
Algorithm Hash digest
SHA256 353bd82c221f7bded1383fd0778d1ea2a8a9f4d5d307c4d635dfec5517bfb06f
MD5 bbc53756787b3ac62afaec6475f1fa4c
BLAKE2b-256 17901aca191275a1448cba1098afc32e8f367b38abdcb56c04911cdad6f911a6

See more details on using hashes here.

File details

Details for the file openbci_stream-1.0a2-py3-none-any.whl.

File metadata

  • Download URL: openbci_stream-1.0a2-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for openbci_stream-1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 2b120d0c8145748f138c8400071fbb41f1347fecedf4ba5f87160328f23d8060
MD5 123e0439f4d9eb4ac9f294b9ad1fafb0
BLAKE2b-256 0adb19b8a39abe39ff6b56452adec1f3d4395cab3bf2978830df489692801196

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