Time difference between trigger and image display

Hello everyone!

I’m conducting an EEG experiment with Psychopy (v1 83.04) and I’m using images as visual stimuli. I tested the image display with a photodiode and it turns out that the trigger is sent before an actual image display. I’m not sure why and whether this a problem with a code as I synchronized the trigger with a screen refresh. The biggest issue is that the delay is not constant and it’s not a multiple of 17ms (the monitor refresh is 60Hz). Additionally, I get a warning about dropped frames.
Would anyone be willing to help?

 # *p_port* updates
	if t >= 1 and p_port.status == NOT_STARTED:
	    # keep track of start time/frame for later
	    p_port.tStart = t  # underestimates by a little under one frame
	    p_port.frameNStart = frameN  # exact frame index
	    p_port.status = STARTED
	    p_port.setData(int(1))
 if p_port.status == STARTED and t >= (1 + (0.5-win.monitorFramePeriod*0.75)): #most of one frame period left
	    p_port.status = STOPPED
	    p_port.setData(int(0))
  1. Do whatever you can to avoid dropped frames. Quit all other software, disconnect from the net, etc. Make sure you have a computer with a good graphics card.

  2. You should probably shift your setData() calls to occur immediately after the call to win.flip() so they are synced more closely to the actual change on the display.

One thing i’ve noticed from testing in the lab is that the display cable used to connect PC and screen is really important. DP ports seem to be able to run display at higher frequencies and for some reason seem more reliable than VGA cables. If you can, retest after changing to a DisplayPort or DVI cable (if you aren’t already) and see if that helps.

aside from that, cleaning code will make a difference, especially if you have loads of nested loops unevenly in task conditions within your code.

are you preloading your images? Are your images too high a quality to be quickly rendered, especially for your graphics card?