Are you using the
viztask module to run your trials? Either way, here is some code that shows how you can detect every third trial:
Code:
import viz
import viztask
viz.go()
NUM_TRIALS = 10
def runTrial():
yield viztask.waitTime(1.0)
def runExperiment():
for i in range(NUM_TRIALS):
if i % 3 == 2:
print 'Special event for every third trial'
yield runTrial()
print 'Finished trial',i+1
viztask.schedule( runExperiment() )