Trigger synchronization for a transnasal deep-brain BCI · ForAll Lab, CMU
A behavioral task and a brain-recording system kept separate clocks. I aligned them to the millisecond so each neural signal maps to the right event.
Overview
At CMU's ForAll Lab, on a transnasal deep-brain BCI targeting epilepsy and ADHD. Event-related analysis slices the recording around each event and averages, so a few milliseconds of error cancels the signal instead of finding it. The task PC and the neural recorder never shared a clock, and the gap grew over the session.
Python parsers merge task event logs and neural trigger codes into one timestamped table.
Collapse trigger bursts from noise and switch bounce to one true onset.
Fit a line through the per-event offsets; the slope is the drift, and it remaps every sample into a shared time.
Automated checks flag dropped triggers and out-of-tolerance residuals; failing sessions get quarantined.