Tuesday, August 23, 2011

Interactive PyEPL session

Sometimes, I am interested in exploring some PyEPL feature without writing a whole experiment with setting up subject and all that. I rather like to have an interactive python shell and hack away. Here is the code on how to do that:

from pyepl.locals import *
import os
import shutil

# create an experiment object:
# parse command-line arguments
# & initialize pyepl subsystems
tdir = "/tmp/iPyEPL"
subj = "isubj"
subjdir = os.path.join(tdir,subj)

if not os.path.exists(tdir):
os.makedirs(tdir)


if os.path.exists(subjdir):
shutil.rmtree(subjdir)


exp = Experiment(archive=tdir,subject=subj,fullscreen=False)
exp.setBreak()

# load some tracks
vt = VideoTrack("video")
kt = KeyTrack("key")
#at = AudioTrack("audio")

# reset the display to black
vt.clear("black")
vt.updateScreen()

# create a PresentationClock object
# for timing
clk = PresentationClock()




Just copy and paste into your python session and you are ready to explore. Thanks to Per for that!

No comments: