How to time visual stimuli correctly
Hi there,
I am running some timing tests with Expyriment. I am using a LabJack to fire a TTL pulse and then measuring the time it takes for the stimuli to appear on screen (using a Black Box Tool Kit). Here is the minimal code - note, stimuli[0] is a blank screen, and stimuli[1] is a rectangle stimulus:
# Preload blank screen
trial.stimuli[0].preload()
expLabJack.writeRegister(6004, 0)
trial.stimuli[0].present(clear=False, update=False)
# Preload stim
trial.stimuli[1].preload()
exp.clock.wait(300)
# Fire TTL pulse
expLabJack.writeRegister(6004, 1)
# present stim
trial.stimuli[1].present(clear=False, update=False)
exp.clock.wait(200)
expLabJack.writeRegister(6004, 0)
The problem I am having: Using this method, it takes approximately 28ms for the visual stimuli to be detected onscreen (visual stimuli onset - TTL pulse onset), so onset times of the stimuli are overshooting by at least a frame. Is there a better way of controlling the presentation of stimuli?
Comments
Hi,
in your example, nothing should be shown on the screen, since you explicitely set
update=False
.What are the results of the visual presentation test in the test suite for you? Maybe we can go from there.
Thanks for the response. Apologies, that is a typo. The stimuli itself does not have an arg passed to the update parameter. Will get the test suite results now.
Here is the output of the test suite (had to cut some of the list entries due to character limit). If you would like it in a different format please let me know:
The code without typo:
Ok, turns out the TTL should be fired after the call to present the stimuli. With that, I can achieve screen latencies of 11ms. Thanks for reading.