Skip to content

Instantly share code, notes, and snippets.

@smathot
Created October 5, 2012 16:40
Show Gist options
  • Save smathot/3840902 to your computer and use it in GitHub Desktop.
Save smathot/3840902 to your computer and use it in GitHub Desktop.
Expyriment presentation time test
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