Alternating between two conditions files while randomly selecting from each, without repetition

Hi all,

I’m trying to code an experiment for my research project but I’ve had a little trouble randomising something in the trials so would really appreciate some help.

The part of the study I’m stuck on involves two different types of trial, one where circles are used and one where crosses are used. I have used the conditions file below to assign the positions of the circles, with circle1 having its position set to “position1” and circle2 having its position set to “position2”. The file for crosses is the same, but replacing “circle” with “cross”, and the positions columns are identical.

Screenshot 2023-09-14 at 11.59.51

What I want is for the programme to randomly select one of the rows from the “circlepositions.xlsx” file, show this, then present the stimuli which participants respond to (I don’t think explaining this part is necessary and may be tricky to understand, but let me know if it would help to know this part).

I then want the programme to randomly select one of the rows from the “crossppositions.xlsx” file, show this, then similarly present the stimuli which participants respond to, cycling through the 6 different stimuli twice.

I would then like it to go back to selecting a row from the circle file, then from the cross file and so on, without repeating the same row from the individual file (e.g., for trial 1 it uses “circlepositions.xlsx” row 4 and “crossppositions.xlsx” row 7, then for trial 2 it uses “circlepositions.xlsx” row 9 and “crossppositions.xlsx” row 4). So I want it to cycle through every row in each condition file, but only once.

I created a simplified version of this to demonstrate what the sequence looks like:

I understand that I can’t put a loop around each type of trial, because that will loop through all the rows of “circlepositions.xlsx”, then start looping through all the rows of “crossppositions.xlsx”, rather than alternating between them. I’m therefore not sure how to make it so that each type of trial uses a different conditions file.

Is there a way to do this, or could I combine the two condition files into one somehow, using selected rows for each type of trial? Any help would be really appreciated, thanks!

Sofie

Have a look at my independent randomisation demo for one way to do this – which involves preloading one of your two spreadsheets into a list.

Hi, thanks for your response. Unfortunately, I’m quite new to PsychoPy and I’m using the builder function so have had a look and can’t really work out what parts of this demo are relevant to me, or what the coding means.

Do you have any more advice of where to look?

Thanks,
Sofie