To run a block of trials that is set up in the GUI, first set up you experiment using the GUI and then add this line of code when SightLab is called (where "2" is the number of repetitions or "blocks" you want to run):
Find this example in ExampleScripts\- Randomize \- SightLab\_VR\_Randomize\_Blocks.py. In the included Example there are 3 trials that are set to randomize between 3 different environments (by checking "Randomize" in the GUI when configuring the .stlb file).
importsightlab_utils.sightlabasslfromsightlab_utils.settingsimport*#Setup SightLab Optionssightlab=sl.SightLab(configpath="sightlab_configs/Randomize Blocks.stlb",repetitions=2)defsightLabExperiment():yieldviztask.waitEvent(EXPERIMENT_START)fortrialinrange(sightlab.getTrialCount()):ifsightlab.getTrialNumber()==1andsightlab.getCurrentRepetition()==1:yieldsightlab.startTrial(condition=[NO_CONDITION,""],startExperimentText="Press trigger When Ready")elifsightlab.getTrialNumber()>1:yieldviztask.waitEvent(TRIAL_START)yieldviztask.waitEvent(TRIAL_END)viztask.schedule(sightlab.runExperiment)viztask.schedule(sightLabExperiment)viz.callback(viz.getEventID('ResetPosition'),sightlab.resetViewPoint)