Randomizing the polygons


I use PsychoPy2.2. I want to randomize the polygons I have created in Builder. How can I do this by inserting a loop in Builder?

What about a polygon stimulus do you want to randomize: the position, the color, the presentation time, …? You’ll have to provide more information.

I want to randomize the position and the color. For example red circle will always come up at (0,3.5), blue circle will come up at (3.5,0) and the orange circle will come up at (-3.5,0). Totally I have 8 colorful circles.

The builder allows you to enter parameters in component fields.

With these parameters, you can access variables defined in a conditions file.
You mention position. You could have a .csv file with one column of x values and one column of y values. Similarly, you could have a .csv file with rgb values or strings for your colors.

For the loops you can then select a method of constants, which determines how the values from your conditions file are randomized.
You could for example enter $(x, y) as position.

Have a look at some of the demos, which you can unpack from Demos > Unpack Demos…
Going over the Stroop demo may help you to learn how randomization works in Psychopy. In your case you might want random or fullRandom.

1 Like