Selecting stimuli randomly from columns

Hi,

I’d need to present two pictures - side by side - consisting of two faces.

One face must be a male, the other a female. Males and females should be selected randomly from a given number of identities (e.g., 10 per gender) and presented only one time each (a figure i attached, hoping it helps somehow)!

I’m trying to implement my experiment through the builder (I have just a little experience with coding), for then running it online (Pavlovia).

Can anybody provide me with any suggestions? Many thanks in advance!

Fig1|690x388

Best,
M

You have three things. The side MF or FM, the choice of male faces and the choice of female faces.

With only 10 of each I would recommend creating an list of male faces, e.g. male=[‘m1.png’,’m2.png’,etc] and the same for female. Then shuffle(male) and shuffle(female)
Also set loopIdx=-1

Then in your loop point to an Excel spreadsheet with a column called side with five 1s and five -1s

Then have a code component above the images with

loopIdx+=1

The male face image should be $male[loopIdx] with the x coordinate of the position multiplied by side

Do the same for the female face

1 Like

Hi,

many thanks, I’ve just implemented your suggestions successfully!

May I ask you a final question?

In the beginning, my code shuffles 4 different letters called conditions (A,B,C,D):

conditions = [‘A’, ‘B’, ‘C’, ‘D’]
shuffle(conditions)

that are then used to refer present participants with different stimuli, such as:
Amales
Afemales

Bmales
Bfemales

Cmales
Cfemales

Dmales
Dfemales

Each participant is only exposed to one of these different 4 conditions.

Following your suggestions, I’ve manually created the 8 lists of stimuli, and then I’ve shuffled them.

Now, I’d need something that, according to the letter selected at the beginning (A,B,C,D), can present the participant with only the correct condition of stimuli (e.g., only Amales and Afemales).

In my face stimulus object, I’ve tried to concatenate condition (e.g., A) with the gender (e.g., ‘males’) and with the index, in order to refer to the corresponding list:

for males faces:
$conditions[0] + ‘males’ [loopIdx]

but it doesn’t work.

Any suggestion?
Thanks,
M.

Hi,
just solved by simply inserting an if statement at the beginning of my code.
Many thanks again for the great help!
Best,
M.

1 Like