Created
December 30, 2011 00:18
-
-
Save smathot/1536868 to your computer and use it in GitHub Desktop.
A simple timing checker for OpenSesame (paste in inline_script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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