Skip to content

Instantly share code, notes, and snippets.

@smathot
Created Dec 30, 2011
Embed
What would you like to do?
A simple timing checker for OpenSesame (paste in inline_script)
from openexp.canvas import canvas
c1 = canvas(self.experiment)
c2 = canvas(self.experiment)
c3 = canvas(self.experiment)
soa = 0 # The desired SOA. 0 = fastest possible
N = 10 # Nr of repetitions
w = self.get('width')
h = self.get('height')
# Create a gray canvas for visual purposes
c1.rect(0, 0, w, h, fill=True, color='gray')
for i in range(N):
# Show canvas 1 and 2 and remember the timestamps
t1 = c1.show()
self.sleep(soa)
t2 = c2.show()
# Print the SOA and the observed duration
# and show it briefly
c3.clear()
c3.text('%s / %s ms' % (soa, t2-t1))
c3.show()
self.sleep(200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment