Python Examples

Python Installation

See the getting started repo for full scripts. For python, we use 3.8.5, but any later 3+ version will probably work. Create a virtualenv from that repo:

pip install venv
python3 -m venv eeg_venv
# activate the venv according to your OS
# Windows example:
. ./eeg_venv/scripts/Activate
pip install -r requirements.txt

Script Examples

This script receives an LSL EEG stream and prints it to the console.

python lsl_receive.py -n SimulatedEEGStream
python lsl_receive.py -n PetalStream_gyroscope
python lsl_receive.py -n PetalStream_ppg
python lsl_receive.py -n PetalStream_telemetry
python lsl_receive.py -n PetalStream_eeg
python lsl_receive.py -n PetalStream_acceleration
python lsl_receive.py -n PetalStream_connection_status

This script streams 4 channels of EEG data at a selected sample rate. It can stream randomly generated data, or from a CSV file with any header where the first 4 columns represent channels 1-4.

  • Random EEG data at 256Hz:

python lsl_stream.py -s 256
  • From a CSV file at 256Hz:

python lsl_stream.py -s 256 -f ../example_data.csv

Last updated