Python wrapper for BrainFlow API + Cyton SDK for collecting realtime or offline (SDCard) EEG, EMG, EKG data.
Project description
BrainflowCytonEEGWrapper
This is particularly aimed at the OpenBCI Cyton/Cyton + Daisy biosensing board.
It allows for low-level board commands such as configuring channels and setting sample rate, making it easier to configure the way you retrieve data from the board.
Status
Full functional, working with Cyton and Cyton + Daisy.
Todo:
- [] Include script to process SDCard data (exists but in a different repo)
- [] Make the interface more consistent
- [] Bake in multithreading support for easier parallel data collection + processing
- [] ???
Details
Default channels coming in with cyton and daisy with the ultracortex mk4 are:
- 0: "pkg"
- 1: "Fp1"
- 2: "Fp2"
- 3: "C3"
- 4: "C4"
- 5: "P7"
- 6: "P8"
- 7: "O1"
- 8: "O2"
- 9: "F7"
- 10: "F8"
- 11: "F3"
- 12: "F4"
- 13: "T7"
- 14: "T8"
- 15: "P3"
- 16: "P4"
- 17: "AX" (accelerometer x)
- 18: "AY" (accelerometer y)
- 19: "AZ" (accelerometer z)
- 31: "marker" (this can be used to put event markers in the EEG data, which is extremely useful, BUT the accelerometer will be disabled)
Usage examples
Read data from a dummy board in real time
from BrainflowCyton.eeg import EEG
from time import sleep
eeg_source = EEG(dummyBoard = True)
eeg_source.start_stream(sdcard = False)
while True:
try:
sleep(0.5)
data = eeg_source.poll()
except KeyboardInterrupt:
eeg_source.stop()
Read data from a real board in real time
from BrainflowCyton.eeg import EEG
from time import sleep
eeg_source = EEG()
eeg_source.start_stream(sdcard = False)
while True:
try:
sleep(0.5)
data = eeg_source.poll()
except KeyboardInterrupt:
eeg_source.stop()
Set a custom sample rate
Note: to use sample rates above 250, an SDCard is required, streaming is limited to 250 Hz.
from BrainflowCyton.eeg import EEG, CytonSampleRate
from time import sleep
eeg_source = EEG()
eeg_source.start_stream(sdcard = True, sr = CytonSampleRate.SR_1000)
while True:
try:
sleep(0.5)
data = eeg_source.poll()
except KeyboardInterrupt:
eeg_source.stop()
Bandpass the data
from BrainflowCyton.eeg import EEG, Filtering
from time import sleep
eeg_source = EEG(dummyBoard = True)
# set the indexes of channels you want to filter
ch_idx = [1, 2, 3, 4, 5, 6, 7]
eeg_filter = Filtering(exg_channels = ch_idx, sampling_rate=250)
while True:
try:
sleep(0.5)
eeg_source.start_stream(sdcard = False)
data = eeg_source.poll()
filtered_data = eeg_filter.bandpass(data, 8, 32)
except KeyboardInterrupt:
eeg_source.stop()
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
File details
Details for the file BrainflowCyton-0.1.1.tar.gz
.
File metadata
- Download URL: BrainflowCyton-0.1.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4070b8b69dc7e4a85d9b95e6c074f8a197ea03976c1d22bbd4bf28fee4d9c85 |
|
MD5 | b4a2a2ee0733f39531619ced5d8f4bdd |
|
BLAKE2b-256 | 79de5540079ac26fb41bd905adf9e06431ac0d32936add395f211c76a39773b3 |
File details
Details for the file BrainflowCyton-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: BrainflowCyton-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8de1ce31aee07b8381e2412696641a71408de716076dc4fda9a55618b8dcfcf8 |
|
MD5 | ef2967248cf63fc16ebee5c91e03dc3e |
|
BLAKE2b-256 | 98b59573cf0de5dbf339dcdb0b0a96be1bc9cf728fa241000fd87963763cc7c4 |