psychopy.org | Reference | Downloads | Github

Creating a time differing stimulus

Im using Win10 and PsychoPy version 1.9

****What are you trying to achieve?**:MRI paradigm where each stimulus is presented for a different length of times to the one before and after in a loop.

I know how to make a block design paradigm with loops presenting stimulus given in a file. But I do not know how to vary length of each stimulus in a semi random fashion. to me it appears that duration of the stimulus in a loop is constant.

Would appreciate your help very much,
Shirin

import random

at the beginning of your experiment. Then at the beginning of your routine you can put:

randDuration = random.randint(500, 1500)/1000

in a code component.

In this example, it picks a random integer between 500 and 1,500 (ms) and divides it by 1,000 to get the time in seconds.

In the stimulus duration field you can then put $randDuration.

Thank you.