Vaquero
08-25-2016, 06:47 PM
Hey!
I've scripted an experiment based on the experiment framework (http://docs.worldviz.com/vizard/#examples/experimentDesign.htm) in the examples. I have set up my sensor and targets and added them to the manager. Now I want to save the onEnter and onExit events to a file only when the experiment is in the testphase , but I'm lost on how to do that.
def EnterSensor(e):
print 'Enter',e.sensor.name, contactManager.getActiveTargets(sensor=e.sensor) #DEBUG
def ExitSensor(e):
print 'Exit',e.sensor.name, contactManager.getActiveTargets(sensor=e.sensor) #DEBUG
manager.onEnter(sensor, EnterSensor)
manager.onExit(sensor, ExitSensor)
Can I just move this code inside the experiment definition ( def experiment(): ) just before yielding the testphase? And instead of printing to console saving to a file that I opened in the experiment function before? I can only test it when I'm back in the lab and on a tight schedule.
I've scripted an experiment based on the experiment framework (http://docs.worldviz.com/vizard/#examples/experimentDesign.htm) in the examples. I have set up my sensor and targets and added them to the manager. Now I want to save the onEnter and onExit events to a file only when the experiment is in the testphase , but I'm lost on how to do that.
def EnterSensor(e):
print 'Enter',e.sensor.name, contactManager.getActiveTargets(sensor=e.sensor) #DEBUG
def ExitSensor(e):
print 'Exit',e.sensor.name, contactManager.getActiveTargets(sensor=e.sensor) #DEBUG
manager.onEnter(sensor, EnterSensor)
manager.onExit(sensor, ExitSensor)
Can I just move this code inside the experiment definition ( def experiment(): ) just before yielding the testphase? And instead of printing to console saving to a file that I opened in the experiment function before? I can only test it when I'm back in the lab and on a tight schedule.