Equal distribution of trials among conditions

Hello, I still couldnt figure this out. If we cannot equally distribute, can we restrict the amount of trials for allincong condition that has 120 possible combinations? If we randomly select 30 of them, the problem ewill be solvers hopefully

We can equally distribute across the five conditions if you delete thisImage_color, thisWord_color and thisImagery_color from your spreadsheet and all of the duplicate rows so you only have 5 rows.

In Begin Experiment define

colors = ['red','blue','green','yellow','orange']

or whatever.

Then in Begin Routine

shuffle(colors)
if condType == 'allincong':
     thisImage_color = colors[0]
     thisWod_color = colors[1]
     thisImagery_color = colors[2]
elif condType == 'allcong'
     thisImage_color = colors[0]
     thisWod_color = colors[0]
     thisImagery_color = colors[0]
# You will need to add the rest yourself

If it ā€œdoesnā€™t workā€ please show what you tried and exactly how it failed.

Delete code rows 76-80 from your final code component above

above you can see the code without these lines as well. It again gives empty rows

Reattach the spreadsheet ensuring it doesnā€™t have those as column titles. Iā€™m wondering whether you just deleted the contents of the columns, not the columns themselves from your conditions file.

there are no columns in the xlsx file with such titles only images words and positions. even if i update the data file is still empty

Isnā€™t there a column called condType?

Sorry i missed that part. Would you mind telling me what should be under this column should it be emptyb

allincong
allcong
imagewordcong
imageimagerycong
wordimagerycong

Just a handy shortcut: Itā€™s possible to multiply a list in order to repeat its elements:

>>> list(range(1, 3+1)) * 5 #note: the upper end of range is exclusive, so add 1
[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]

This is especially helpful if you have many elements within and/or repetitions of the list and may be a reason to deviate from @Becca 's solution.

I try to avoid solutions that will fail online. However, I could have used:

conditionsChoice1 = []
conditionsChoice2 = []
conditionsChoice3 = []
for Jdx in range(3):
     Idx in range(1,6):
          conditionChoice1.append(Idx)
          conditionChoice2.append(Idx)
          conditionChoice3.append(Idx)
2 Likes

Dear all,

After struggling for weeks, I am sharing the solution in case someone else needs.

Begin Exp:

trial_order = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5] #based on number of trials
shuffle(trial_order)

Begin Routine

objectChoice = [1,2,3,4,5,6]
wordChoice = [1,2,3,4,5,6]
imageryChoice = [1,2,3,4,5,6]

if cond_n == 1: #allincongruent
    shuffle(objectChoice)
    thisExp.addData('imageN',objectChoice[0])
    if objectChoice [0] == 1:
        thisImage = image1
        thisImage_color = 'Kırmızı'
        thisExp.addData('Image',1)
        wordChoice.remove(1) #so that word will not be equal to the image
        imageryChoice.remove(1) #so that imagery will not be equal to the image
    elif objectChoice [0] == 2:
        thisImage = image2
        thisImage_color = 'Mor'
        thisExp.addData('Image',2)
        wordChoice.remove(2) 
        imageryChoice.remove(2)
    elif objectChoice [0] == 3:
        thisImage = image3
        thisImage_color = 'Pembe'
        wordChoice.remove(3)
        imageryChoice.remove(3)
        thisExp.addData('Image',3)
    elif objectChoice [0] == 4:
        thisImage = image4
        thisImage_color = 'Turuncu'
        wordChoice.remove(4)
        imageryChoice.remove(4)
        thisExp.addData('Image',4)
    elif objectChoice [0] == 5:
        thisImage = image5
        thisImage_color = 'Yeşil'
        wordChoice.remove(5)
        imageryChoice.remove(5)
        thisExp.addData('Image',5)
    elif objectChoice [0] == 6:
        thisImage = image6
        thisImage_color = 'Mavi'
        wordChoice.remove(6)
        imageryChoice.remove(6)
        thisExp.addData('Image',6)

    shuffle(wordChoice)
    thisExp.addData('wordN',wordChoice[0])
    if wordChoice [0] == 1:
        thisWord = word1
        thisWord_color = 'Kırmızı'
        imageryChoice.remove(1) #so that word will not be equal to the imagery
    elif wordChoice [0] == 2:
        thisWord = word2
        thisWord_color = 'Mor'
        imageryChoice.remove(2)
    elif wordChoice [0] == 3:
        thisWord = word3
        thisWord_color = 'Pembe'
        imageryChoice.remove(3)
    elif wordChoice [0] == 4:
        thisWord = word4
        thisWord_color = 'Turuncu'
        imageryChoice.remove(4)
    elif wordChoice [0] == 5:
        thisWord = word5
        thisWord_color = 'Yeşil'
        imageryChoice.remove(5)
    elif wordChoice [0] == 6:
        thisWord = word6
        thisWord_color = 'Mavi'
        imageryChoice.remove(6)

    shuffle(imageryChoice)
    thisExp.addData('imageryN',imageryChoice[0])
    if imageryChoice [0] == 1:
        thisImagery = imagery1
        thisImagery_color = 'Kırmızı'
        thisExp.addData('Imagery',1)
    elif imageryChoice [0] == 2:
        thisImagery = imagery2
        thisImagery_color = 'Mor'
        thisExp.addData('Imagery',2)
    elif imageryChoice [0] == 3:
        thisImagery = imagery3
        thisImagery_color = 'Pembe'
        thisExp.addData('Imagery',3)
    elif imageryChoice [0] == 4:
        thisImagery = imagery4
        thisImagery_color = 'Turuncu'
        thisExp.addData('Imagery',4)
    elif imageryChoice [0] == 5:
        thisImagery = imagery5
        thisImagery_color = 'Yeşil'
        thisExp.addData('Imagery',5)
    elif imageryChoice [0] == 6:
        thisImagery = imagery6
        thisImagery_color = 'Mavi'
        thisExp.addData('Imagery',6)
# save
thisExp.addData('imageColor', thisImage_color)
thisExp.addData('wordColor', thisWord_color)
thisExp.addData('imageryColor', thisImagery_color)

you can repeat this logic for other conditions

2 Likes