EEG Triggering via stim channels#158
Open
tab-cmd wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds support for reading BCI markers from an EEG stim channel as an alternative to LSL marker streams. This enables a hardware trigger box workflow where Unity sends trigger bytes over serial, the trigger box injects them into the EEG amplifier's stim channel, and Python extracts them from the LSL EEG stream.
See the related Unity PR for more details.
PR Checklist
make lintpasses (black + flake8)make testpasses (all 164 tests)triggers.pyconstants match Unity'sSerialTriggerWriterdefaults (240–245 for status, 1–N for stimuli)process_markersexpectsLslStimMarkerSourcereturns the same([[marker]], [timestamp])format asLslMarkerSourceEegStimTriggerMarkerSourceproperly delegates allEegSourcepropertiesBciControllerworks identically with either marker sourcetrigger_stim_example.py)Files Changed
bci_essentials/triggers.pyMarkerTypes,TriggerByte,TriggerDetector, trigger map buildersbci_essentials/io/lsl_stim_marker_source.pyLslStimMarkerSource. Online use, opens own LSL inletbci_essentials/io/eeg_trigger_sources.pyEegStimTriggerMarkerSource. Wraps anyEegSource, for testing/offlinebci_essentials/io/fake_stim_source.pyFakeStimEegSource. Synthetic EEG (0 values) with programmable stim channeltests/test_triggers.pyTriggerDetector, end-to-endtests/test_eeg_trigger_sources.pyexamples/trigger_stim_example.pyexamples/p300_trigger_stim_backend.pybci_essentials/bci_controller.pyMarkerTypesfromtriggers.pybci_essentials/paradigm/paradigm.pytriggers.pybci_essentials/io/__init__.pyREADME.mdMakefileinstall,dev-install,test,lint,formattargetspyproject.tomlpyserialdependency.flake8,.gitignoreTesting
AI disclosure
The code and text in this pull request were written by a human developer, with AI tools used for drafting and editing. The AI was used as a writing and development aid, not as the source of technical content. I reviewed and edited all AI generated work to ensure accuracy and coherence with the bci-essentials-python package. All tests were done manually to confirm the working implementation of the serial feature in python.