GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mvidaldp/pylsl-keyboard-trigger: Python script that sends LSL markers (aka triggers) over the local network by pressing or releasing any of the two target keyboard keys.

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eeg_plus_triggers.xdf
eeg_plus_triggers.xdf
 
 
howto_read_XDF_recordings.ipynb
howto_read_XDF_recordings.ipynb
 
 
keyboard-trigger.py
keyboard-trigger.py
 
 
keyboard-trigger_demo.gif
keyboard-trigger_demo.gif
 
 
labrecorder.png
labrecorder.png
 
 
recording_visualization.png
recording_visualization.png
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

pylsl-keyboard-trigger

keyboard-trigger

Python script that sends LSL markers (aka triggers) over the local network by pressing or releasing any of the two target keyboard keys.

In this specific script, meant for EEG eyes open/closed experimental tasks, one target key press/release indicates when the eyes are opened and the other for when they're closed. By default (no parameters specified), the selected event is press, the keys are up (eyes open) and down (eyes closed), and the LSL stream name is KeyboardTriggers.

The keyboard event to capture (press or release), the target keys, and the stream name can be customized by passing arguments on the script call:

usage: python keyboard-trigger.py [-h] [-e {press,release}] [-o OPENED] [-c CLOSED] [-n NAME]

optional arguments:
  -h, --help            show this help message and exit
  -e {press,release}, --event {press,release}
                        key event to send triggers: press (default) or release
  -o OPENED, --opened OPENED
                        trigger key for eyes opened, e.g. up (default), down, space...
  -c CLOSED, --closed CLOSED
                        trigger key for eyes opened, e.g. up, down (default), space...
  -n NAME, --name NAME  LSL outlet stream name: KeyboardTriggers (default)

This repo also includes a 30-seconds stream recording example where UNIX epochs with eyes-closed/opened(0/1) samples were stored, simultaneously with EEG data streamed from an Android app. Moreover, a basic notebook for how to read the recording is included.

Contents

  • keyboard-trigger.py: keyboard-trigger events via target key press/release event (non-target keys also captured).
  • howto_read_XDF_recordings.ipynb: recording example with simultaneous streams from a mobile EEG Android App and a Python script sending keyboard triggers.
  • eeg_plus_triggers.xdf: Jupyter notebook demonstrating how to read LSL streams from XDF recordings.

How to run it

LabRecorder

  1. Install the LSL library: liblsl

  2. Install the Python dependencies: pip install -r requirements.txt

  3. Download, install and run the LSL LabRecorder

  4. Run the keyboard-trigger.py script by: python keyboard-trigger.py (run stty -echo before calling the script to avoid the keyboard input shown between the script output)

  5. Make sure the stream KeyboardTrigger appears on the LabRecorder (otherwise click Update), selected it (check it), and click Start.

  6. Press any of the target keys to send a trigger. Press the ESC key to stop streaming and also to stop the script.

  7. Click Stop on the LabRecorder.

How to read XDF recordings (example)

  • Offline: howto_read_XDF_recordings.ipynb
  • Online: Open howto_read_XDF_recordings.ipynb with your Jupyter notebook client to visualize or run the cells.

Recorded data visualization (EEG data + triggers) data-visualization

About

Python script that sends LSL markers (aka triggers) over the local network by pressing or releasing any of the two target keyboard keys.

Topics

exampleshow-tohowtokey-presskeyboardkeyboard-eventslabrecorderlabstreaminglayerlsllsl-scriptspylslpynputpyxdfrecordingtrigger-eventstriggerstutorialxdf

Resources

Readme
MIT license
Activity

Stars

5 stars

Watchers

1 watching

Forks

5 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.