Fixation cross with randomly selected binary time intervals

If this template helps then use it. If not then just delete and start from scratch.

OS (MacOS Monterey 12.1):
PsychoPy version (v2022.2.5):

What are you trying to achieve?: I am creating a simple fMRI experiment where participants will rate their emotional response following the presentation of an image stimulus. The flow of the loop: fixation cross–>stimulus–>rating (then it repeats).

I currently made a fixation routine from “stimuli–>polygon–>cross,” but can only program a fixed time interval

The fixation cross needs to be presented for either 1 or 3 seconds (a randomly selected binary choice). I am unsure how to have PsychoPy make this randomized choice.

Thanks so much for any guidance anyone can provide!

Hello,
Take a look at the example I created for you:
Randomized Fixation Cross.psyexp (10.9 KB)

We create a list containing your possibilities:

# Begin Experiment
fixationOptions = [1, 3]

Then, at the start of each routine, we choose a random item from the list:

# Begin Experiment
import random

# Begin Routine:
fixationTime = random.choice(fixationOptions)

And set the duration of the fixation cross to fixationTime:

Thank you so much! This was perfect; incredibly helpful!

1 Like

Happy I could help :slight_smile: