Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

timing issue using psychopy backend


I programming a statistical learning experiment where I present apparent random shapes, with a hidden regular structure. While I tried out the experiment myself, it seemed that every once and a while a stimulus (or the blank display in between stimuli) was on screen longer than the others. This was confirmed when I logged the timings each time a new screen was shown. The snippet of code that I use for this part of the experiment is shown below:

If I take the timing difference between consecutive windows I consistently get outputs like shown below. While the majority of ISI is 200 ms (as expected) each sequence contains a significant number of outliers up to 500 ms. Is there something wrong in this code that can explain this?

Thanks in advance for the help


  • For clarity I have also inserted the code here instead of the .png files:

    test_times = []
    for idx in test_sequence:
    	test_times.append(self.time()) # this line is to check timing 
    	# show for 200 ms while continue to collect responses
    	onset_time = self.time()
    	if idx == test_idx:
    	while self.time() - onset_time < 190:
    		key, resp_time = test_keyboard.get_key() # time out is et to 1 ms
    		if key != None:
    	# show blank interval for 200 ms while continue to collect responses
    	test_times.append(self.time()) # this line is to check timing 
    	onset_time = self.time()
    	while self.time() - onset_time < 190:
    		key, test_resp_time = test_keyboard.get_key()
    		if key != None:
    print np.diff(test_times) # this line is to check timing 

    And an example output from the final line of code

    [287.70804405 200.963974   199.03802872 200.60682297 200.7791996
     342.92793274 201.75004005 199.85198975 201.05791092 199.35297966
     200.27303696 299.44896698 209.26809311 200.74701309 199.47099686
     200.96802711 199.55182076 505.87105751 197.0410347  197.54910469
     201.76577568 199.08905029 200.62208176 358.71291161 200.52599907
     200.20508766 200.46687126 200.14119148 521.20184898 195.966959
     200.67214966 200.07491112 200.8960247  222.18894958 314.0501976
     196.1979866  200.64997673 200.39892197 199.61190224 216.86315536
     322.6120472  200.27589798 199.75090027 199.72419739 200.13999939

    Also the problem persists if I comment out the line where I draw the image and only show blank displays.

  • Someone found out that this timing issue is apparently specific to the windowed mode. Not sure why this is the case though and I still have to test it on our windows lab computers, but all timings are perefct when I run the experiment full screen

Sign In or Register to comment.