Concatenate in nReps

(Win10; PsychoPy v2021.2.3)

Hello everyone,

I have four subtasks, I would like to present them in a random order without to have to choose an .xlsx file as done here: Blocks of trials and counterbalancing — PsychoPy v2022.1.2
Based on this example, I created one .xlsx file with 12 different orders. I called the columns with A1, B1, C1, D1, A2, B2, C2, […], C4, D4 to run subtasks with different orders.

I found a code to read this file line by line in the beginning of the experiment.
But now I would like to read the file column by column (first, letter+1; then, letter+2, etc.). To do that I tried to make concatenation in nReps of loop properties, but it seems impossible to concatenate in nReps. So, I added a code in the beginning of my loop with a new variable with concatenation.

The coding:
xRep = str(task_order.thisRepN+1)
conca = “A”+xRep

But it doesn’t work.
Error message: in __init__self.nReps = int(nReps)
ValueError: invalid literal for int() with base 10: ‘A1’

Do you have any idea to concatenate in nReps or to have random order of four subtasks in a simpler way?

I am not sure to be clear. Don’t hesitate if you need further information.

Thank you a lot if you take the time to help :pray:

Hi @lmeunierdup,

My honest answer here would be to create four .xlsx files for each subtask and then choose randomly from them using a chooseBlock.xlsx file in the way that is described in the link you posted. This will be easier for many reasons, but the main reason I find it to be the most efficient is that it allows you to increase the number of repetitions of the four subtasks in a much easier way than would be possible using the method you’re describing here.

Thanks,

Kim

1 Like