Created
October 5, 2012 16:40
-
-
Save smathot/3840902 to your computer and use it in GitHub Desktop.
Expyriment presentation time test
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 expyriment import stimuli, control, design | |
import time | |
from random import randint | |
control.defaults.initialize_delay = 0 | |
control.defaults.open_gl = True | |
exp = design.Experiment() | |
control.initialize(exp) | |
l = [] | |
t1 = time.time() | |
for x in range(-300, 300, 10): | |
for y in range(-300, 300, 10): | |
col = randint(0,255), randint(0,255), randint(0,255) | |
s = stimuli.Rectangle((10,10), position=(x,y), colour=col) | |
l.append(s) | |
t2 = time.time() | |
for s in l: | |
s.preload() | |
t3 = time.time() | |
for s in l[:-1]: | |
s.present(update=False, clear=False) | |
l[-1].present(update=True, clear=False) | |
t4 = time.time() | |
print 'CREATED: %.2f' % (1000.*(t2-t1)) | |
print 'PRELOADED: %.2f' % (1000.*(t3-t2)) | |
print 'PRESENTED: %.2f' % (1000.*(t4-t3)) | |
time.sleep(1) | |
control.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment