Photodiode: measuring trigger to display lag

Purpose

A trigger sent from the stimulus computer marks when a frame starts to scan out, not when the participant sees it. This experiment uses two photodiodes to measure that gap on the KIT system: the delay between the MEG trigger and the actual light on (a) the stimulus-computer monitor and (b) the PROPixx projector in the MSR. The projector is the ground truth for stimulus visibility, so its lag is the constant that should be subtracted from MEG trigger times before epoching when millisecond precision matters.

Authors: Gayathri Satheesh <gs2750@nyu.edu>, Hadi Zaatiti <hadi.zaatiti@nyu.edu>

How the experiment works

The PsychToolbox script alternates a 250x250 px patch between white and black at the top of the screen, 1 s each, for 1000 trials. Two markers are written into the same frame:

  • a 1x1 top-left trigger pixel, read by the VPixx DataPixx in pixel mode and converted to the MEG trigger on channel 224;

  • the photodiode patch at the top of the screen, watched by a photodiode.

The trigger pixel is held to its “on” colour for the whole 1 s white phase, so the rising edge of channel 224 marks white onset. Because the patch is at the top of the screen (scanned first) it is temporally co-located with the trigger pixel, and both are drawn in the same Screen('flip') (no off-by-one-frame error).

The signal chain

The DataPixx is the hub. The stimulus computer’s video goes into it; from there (a) pixel mode emits the trigger to the MEG DAQ, and (b) the video is forwarded to the PROPixx projector in the MSR. A console monitor shows the same frame. The trigger is therefore born at the very start of frame scan-out, and every photon the photodiodes see happens downstream of that moment.

The photodiode box and the two recordings

The photodiode box has a LOW-sensitivity channel (CH1, knob ADJ1) wired to MEG 233 and a HIGH-sensitivity channel (CH2, knob ADJ2) wired to MEG 232. The activation threshold sat around 10 at the 0 outer setting; both knobs were set a little beyond that for margin. Two recordings were taken with the photodiode heads swapped between the screens:

  • sub-photodiode_01: LOW/233 = projector, HIGH/232 = stimulus computer.

  • sub-photodiode_02: LOW/233 = stimulus computer, HIGH/232 = projector. Here the high-sensitivity channel on the projector indexed the frame flip (a train of peaks within the white window) rather than a boxcar.

Both used 1000 trials. Swapping lets the clean low-sensitivity channel measure both screens; see Display and trigger timing for the full method and why the low-sensitivity channel is the one to trust.

Photodiode box, recording 1

Photodiode box: CH1 LOW sensitivity (ADJ1) and CH2 HIGH sensitivity (ADJ2).

Results

Two recordings were taken with the photodiode box’s LOW- and HIGH-sensitivity channels swapped between the two screens, so the clean LOW-sensitivity channel measures both screens (rising-edge lags, 1000 trials each):

Lag (rising edge)

Value

SD

n

trigger 224 → stimulus monitor

+2.05 ms

0.21

1000

trigger 224 → projector

+8.36 ms

0.48

1000

stimulus monitor → projector

+6.31 ms

1000

The onsets are stable across the session and essentially jitter-free (sub-ms SDs are 1 kHz quantisation), so a constant +8.36 ms correction locks MEG events to stimulus visibility. This supersedes the earlier rough estimate of ~8.5 ms.

Why the lag exists

The lag is hardware, not code. The ~6 ms projector-minus-monitor gap is the PROPixx DLP pipeline latency (frame buffering plus micromirror sequencing); the ~2 ms trigger-to-monitor gap is the console monitor’s pixel response and input lag. The trigger is already emitted at the earliest deterministic point and the patch is optimally placed at the top of the screen, so no change to the PsychToolbox script reduces the true photon-arrival lag; the correct response is to measure it and correct for it.

Note

+8.36 ms is the correction for a stimulus at the top of the screen, where the photodiode patch sits. A stimulus lower on the screen is seen later by the raster scan time to that row (up to ~8 ms at the bottom). Place the photodiode patch at the height of the stimulus you care about, or record a projector photodiode live for per-trial correction.

Analysis pipelines

The system-level reference for these numbers is Display and trigger timing. The full, plotted analysis is provided in two independent implementations that agree to the last digit:

Experiment code