Conditions randomization


I’m new on Psychopy and I have a problem with my conditions randomization.

I have two excel file with 106 rows and I want that for one participant they select rows 0:52 in nutri1.xlsx and rows 53:102 in organo1.xlsx and for another rows 53:102 in nutri1.xlsx and rows 0:52 in organo1.xlsx.

Here the excel file
nutri1.xlsx (12.6 KB)
organo1.xlsx (10.7 KB)

My first loop

I think I need to insert another loop but I don’t know what I’m suppose to put in this loop to do what I want …

If someone has an idea that would be great ! Thanks :slight_smile:

(I’m French sorry for my English syntax)

Hello Milena,

the numbers go in Selected rows. You need to distinguish the rows for the two groups. So do something along the following lines:

if int(expInfo['participant'])%2 == 0:
    startNutri = '0'
    endNutri = '52'
    startOrga = '53'
    endOrga = '102'
    startNutri = '53'
    endNutri = '102'
    startOrga = '0'
    endOrga = '52'

rowsNutri = startNutri + ":" + endNutri
rowsOrga = startOrga + ":" + endOrga

This code uses the participant number (odd, even) to generate two groups of participants. Use whatever is best for your case. Refer with $rowNutri and $rowsOrga in Selected rows of the two loops to access the relevant rows.

Best wishes Jens

1 Like

Hello Jens,

It works perfectly !

Thank you very much for your help :slight_smile:

Best wishes Milena