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
Project details
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
Built Distribution
Hashes for openbci_stream-1.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b120d0c8145748f138c8400071fbb41f1347fecedf4ba5f87160328f23d8060 |
|
MD5 | 123e0439f4d9eb4ac9f294b9ad1fafb0 |
|
BLAKE2b-256 | 0adb19b8a39abe39ff6b56452adec1f3d4395cab3bf2978830df489692801196 |