Branched Experiments in PsychoPy
Make an experiment that can take one of several routes depending on how your participants respond.
Overview
- Make a consent routine, a trials routine and an end routine.
- In the consent routine add a keyboard component that allows either the Y or N key to be pressed.
- Add a code component to your consent routine.
- In the code component use this in the End Routine tab:
if key_resp.keys == 'Y':
trialLoopReps = 1
elif key_resp.keys == 'N':
trialLoopReps = 0
- Add a loop around the trials routine (and trials loop) and set nReps to
trialLoopReps
. if the participant does not consent, this part of the experiment will be skipped!
For more tutorials please see the PsychoPy Youtube Channel