Examples
The following examples can all be found on the PyBCI GitHub repository.
Note
The examples have shields describing whether they work with PyBCI’s pseudoDevice class and what additional external hardware is required. Pseudo Device description found here: What is the Pseudo Device?
If using your own LSL-capable hardware and marker stream having no need for the pseudo device set createPseudoDevice=False
.
PyBCI requires an LSL marker stream for defining when time series data should be attributed to an action/marker/epoch and an LSL data stream to create time-series data.
If the user has no available LSL hardware to hand they can set createPseudoDevice=True
when instantiating the PyBCI object to enable a pseudo LSL data stream to generate time-series data and LSL marker stream for epoching the data. More information on PyBCI’s Pseudo Device class can be found here: What is the Pseudo Device?.
The example scripts illustrate various applied ML libraries (SKLearn, Tensorflow, PyTorch) or provide examples of how to integrate LSL hardware.
The code snippet can be used below to run a simple classification task using the Pseudo Device, alternatively call pybci in the command line to get a list of CLI commands and tests:
ArduinoHandGrasp
GitHub Link: ArduinoHandGrasp/
Description: This folder contains an LSL marker creator in MarkerMaker.py, which uses PyQt5 as an on-screen text stimulus. It also includes ServoControl.ino, designed for an Arduino Uno to control 5 servo motors. A Myoware Muscle Sensor is attached to analog pin A0. The ArduinoToLSL.py script sends and receives serial data, while testArduinoHand.py classifies the data.
PupilLabsRightLeftEyeClose
GitHub Link: PupilLabsRightLeftEyeClose/
Description: This folder contains a basic Pupil Labs example with a custom extractor class. RightLeftMarkers.py uses Tkinter to generate visual stimuli. bciGazeExample.py shows how a custom feature extractor class can be used.
MultimodalPupilLabsEEG
GitHub Link: MultimodalPupilLabsEEG/
Description: An advanced example illustrating the use of two devices: Pupil Labs and Hull University ioBio EEG device. Includes a YouTube video demonstrating the multimodal example.
testEpochTimingsConfig
GitHub Link: testEpochTimingsConfig
Description: A simple example showing custom global epoch settings.
testPytorch
GitHub Link: testPytorch
Description: Provides an example of using a PyTorch Neural Net Model as the classifier.
testRaw
GitHub Link: testRaw
Description: Demonstrates how raw time series data can be used as an input by utilizing a custom feature extractor class.
testSimple
GitHub Link: testSimple
Description: Provides the simplest setup with default settings.
testSklearn
GitHub Link: testSklearn
Description: Similar to testSimple, but uses an MLP as a custom classifier.
testTensorflow
GitHub Link: testTensorflow
Description: Similar to testSimple, but allows for a custom TensorFlow model to be used.