# Randomizing position of stim

Hey there,

I am presenting 6 images simultaneously. I somehow successfully randomized the order of images but it gues a bit controlled way; certain combinations are appearing in a randomized way but they are never randomized with the rest of the stims.

First, I defined all combinations in my condition file:

Then, set every combination of X and Y (X1-Y1, X1-Y2, X2-Y1 … etc.) as position conditions in image properties for all 6 images

Finally wrote the following code:

Problem is: This allows only certain types of combinations that I pre-determined in the .xlsx file, image properties, and the custom code. Could you please help me fullly randomize the positions?

Thank you in advance,
Bests

Have a look at my independent randomisation demo.

Hi,

When I tried the procedure below, some of the items overlapped

Begin Exp:

``````sidesX = [-.43, 0, .43, -.43, 0, .43] #I repeated the numbers because when I include 3 of them, all items were overlapping.
sidesY=[-.3,.3,-.3,.3, -.3,.3]
``````

Begin Routine:

``````shuffle(sidesX)
shuffle(sidesY)
``````

Image properties for each image, set every repeat:
(sidesX[0], sidesY[0])
(sidesX[1], sidesY[1]) etc.

I want to see 3 images appear upper or lower portion of the screen side by side.
1 2 3
4 5 6
But this code gives me this:

You are shuffling the x and y coordinates separately.

How about

``````# Begin Experiment
sides = [[-.43,-.3],[-.43, .3],[0, ,-.3],[0, .3],[.43, -.3],[.43, -.3]]

# Begin Routine
shuffle(sides)

# Image properties, set every repeat
(sides[0][0], sides[0][1])
(sides[1][0], sides[1][1]) etc.
``````
1 Like

(sides[0][0], sides[0][1])
(sides[1][0], sides[1][1])

(sides[0][0], sides[1][0])
(sides[0][1], sides[1][1])
(sides[1][1], sides[1][0])
(sides[0][1], sides[0][0])

sorry, I could not understand the logic.

The coordinates of the ith position is:

(sides[i][0], sides[i][1])

So all of your horizontal coordinates should be sides[item number][0]

Hi,

I am trying to replicate this solution for my task, I have 6 images and in my case I only want to change the X position (horizontal change, Y fixed to 0).

At the begin Exp:

``````sides = [-.5,-.3,-.1,.1,.3,.5]
``````

Begin Routine

``````shuffle(sides)
``````

Each image has image 1 position (sides[0],0), image 2 position (sides[1],0) … image 6 position (sides[6], 0).

All of them with “set every repeat”.

I get this error:

girl_6.setPos((sides[6], 0))
IndexError: list index out of range

Could you please help me to fix this @wakecarter ?

You only have 6 positions numbered 0 to 5

1 Like

Totally right, very stupid, thanks a lot @wakecarter!

1 Like