| Reference | Downloads | Github

Visual stimuli onset delay

OS: Win 7
PsychoPy version: 3.0.7
Standard Standalone? : Standalone
What are you trying to achieve?: synchronization between visual stimulus and EEG marker

I am testing timing accuracy for simple visual stimuli (images). For test purposes I just presenting sequentially black and white PNG images during 1s. I use photodiode to detect stimulus screen onset. It send a marker to EEG. The second marker is sent by PsychoPy. I make experiment in Builder. I added code component to trial. In “Begin Experiment” section I open serial port define function sendToPort

import serial
port = serial.Serial("COM1", baudrate=9600)

def sendToPort(data)

And in “Begin Routine” section I register function sendToPort to execute it after the flip

win.callOnFlip(sendToPort, bytes([1])

Everything works fine. However I measured noticeable delay between markers. Marker from the photodiode arrives to EEG 15-16ms later than the marker from PsychoPy. The delay is quite stable, however sometimes I observed 11ms delay. I added 15ms delay to sendToPort function

def sendToPort(data)

After that photodiode and PsychoPy markers exactly coincides for most of the stimuli. From the one hand my delay is quite stable and appropriate core.wait “fix” it. From the other hand I am a bit worry that my 15ms delay may be caused by mistake in the code or wrong settings of my PC. Hardware is the following: Intel i7-6700, 8Gb RAM, NVIDIA Quadro NVS 315, LG FLATRON L1952T

I tried to switch on and off vsync options but did not find any difference. Is it possible to reduce delay? I appreciate any hints which could help me to find the reason for the delay.

PS Actually I have two monitors connected to PC via DVI splitter cable. Can it cause the observed delay?