Skip to content

Instantly share code, notes, and snippets.

@smathot
Created December 30, 2011 00:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smathot/1536868 to your computer and use it in GitHub Desktop.
Save smathot/1536868 to your computer and use it in GitHub Desktop.
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