psychopy.org | Reference | Downloads | Github

Adding conditional branching to my experiment

Hi all,

So, I am currently replicating an experiment using Psychopy but am running into some trouble. This is my first time using the software and I don’t know a thing about Python script! I have my experiment working minus one aspect.

In my experiment, participants are shown 20 ambiguous images. When the participant is confident that they can see what the image is, they click “left” to indicate that they “Got it”. After 10 seconds, an option to “Give up?” appears on the screen, and the participant will click “right” to give up. Here is the catch. When participants choose “Got it?”, they are directed to a screen where they rate the vividness of the image on a scale of 0-5. Currently, ALL participants (those who selected “got it” and those who selected “give up”) are being directed to the vividness scale. I need my experiment to work so that only those who click “got it” move on to the vividness, and those who clicked “give up” immediately move on to the next image, as I do not want those participants rating the vividness of the image.

Thanks so much for the help!

Screen Shot 2021-10-05 at 8.53.21 PM

You can place another loop inside Phase1 around only the “Phase1Vividness” routine, and set the number of repetitions to a variable (e.g. $mySkip). Create another routine before Phase1Vividness but outside the loop and place a code component there. In the begin routine tab of the code component write something like this:

if GotIt.rt:
    mySkip = 1
else:
     mySkip = 0