acquisition Level 0Level 2 pf-trigger-offsets

Uncorrected stimulus–trigger latency

Symptom. Components shifted by a constant; latencies differ between labs.

3 claims on this page are unverified. TODO(confirm) marks a specific statement the author has not yet checked against a primary source. Everything else on this page has been reviewed. Treat a marked claim as provisional and go to the cited source rather than quoting the sentence.

Symptom

Every event-related waveform in a dataset is shifted by the same amount: peaks fall later (occasionally earlier) than the literature reports, onset latencies disagree between two labs running the same paradigm, and a latency difference between conditions survives while a difference between sites does not. In a single lab the shift is invisible, because it is the same for every trial and every subject; it appears only when latencies are compared across setups, or when a fast component is measured against a known physiological timing.

Cause

The trigger records when the stimulus computer sent the stimulus, not when it reached the subject. Between the two sit the monitor’s refresh cycle and its response time (a stimulus sent just after a refresh waits for the next one), graphics buffering, audio-driver and amplifier latency for sounds, and the time the acquisition system takes to register a software marker. Each contributes a delay that is roughly constant for a given setup but differs between setups, and none of it is recorded in the file. Visual delays on the order of one to a few screen refreshes and audio delays of tens of milliseconds are common (TODO(confirm) the figures the author wants quoted). Software-timestamped markers add jitter as well as offset.

Detect

  • Record a photodiode taped to the screen (or a microphone at the speaker) as an extra channel in a pilot session, and measure the delay from each trigger to the onset of the sensor signal: the mean is the offset, the spread is the jitter.
  • Check the acquisition metadata and the lab’s documentation for a stated offset; if none is stated, assume the offset is unknown, not zero.
  • Compare an early sensory component (a visual P1 or an auditory N1) with its expected latency; a systematic shift of all early components together points to an uncorrected offset.
  • Look for a constant offset between labs in a multi-site dataset before interpreting site differences in latency.

Fix

  • Measure the offset with a photodiode or microphone for each setup, and store it with the dataset (EEG-BIDS has a place for it: the StimulusOnsetDelay style of metadata in the events sidecar, or a documented correction in the dataset description; TODO(confirm) the exact BIDS field the author wants named).
  • Shift the event onsets by the measured offset when loading (mne.Annotations or the events array), and record the correction in the QC log.
  • Where jitter is large (software markers over a network), record a hardware sensor channel for the whole experiment and derive events from it instead of from the software markers.
  • Report the offset and the correction in the methods; when comparing latencies across studies, ask whether each was corrected.

Example

Left: a trigger channel with three short pulses and a photodiode trace with three plateaus that each begin slightly after the pulse. Right: zoom on the second event with a double arrow marking the 23-millisecond gap between the trigger edge and the photodiode rise.

A synthetic recording (no dataset: 1000 Hz, 3 s, three 10-ms TTL triggers, a photodiode trace that rises 23 ms after each trigger, seeded noise) with a planted 23 ms stimulus–trigger offset: the trigger marks when the computer sent the stimulus, the photodiode when the screen changed. The offset value is arbitrary; measure yours. Generated by data/scripts/make_figures.py (synthetic: true in its sidecar; shipped under the site’s CC BY 4.0 terms). The L0.3 exercise measures the offset planted in the notebook’s own synthetic recording, which need not be this one; no spine or directory dataset documents a photodiode channel (TODO(confirm), §6 L0.3).