| Reference | Downloads | Github

Block order randomization

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?: I want to randomize 2 blocks of trials

What did you try to make it work?:

Followed the procedure [here] and some of the discussions in the forum e.g.(Blocks of trials and counterbalancing — PsychoPy v2021.2)

1. Created 2 Excel files: one to call .xlsx condition files belongs to two blocks (chooseImLan)
chooseImLan.xlsx (8.3 KB)

the other for number of repetitions (nReps_Tasks):
nReps_Tasks.xlsx (8.2 KB)

2. Created loops around each block: and wrote the column names as nReps

3. Created an outer loop covering both blocks: and put the .xlsx file that I created for conditions in the outer loop.

What specifically went wrong when you tried that?: Blocks are not randomized.
I could not use the “one to call .xlsx condition files belongs to two blocks (chooseImLan)” file. I do not know where to include it.

Here is how the setup looks like:

controlTaskIMLAN should be set to random not sequential

this worked thanks. But when I applied this for randomizing the order of 2 routines, the data repeats each trial 5 times.




the file: image

Data: The other routine moves to the 3rd row.

Is there a way to fix this?

Untick “is trials” for the outer loops. This doesn’t work online.

I untick all loops that are created for randomizing the order of routines and blocks.

Should I also do it for the loop for randomizing the trial order? I mean the loop that is reading the main conditions file?

You need to keep is trials ticked for the loops connected to your conditions files. Try it and you’ll see why.

1 Like

although I unchecked all ‘is trials’ in randomization loops, pavlovia creates 3 rows for each columns.
I also unchecked ‘is trials’ for condition loops and sync with Pavlovia, I am experiencing the same problem.

I am sorry for rising this question up again, but this is a quite urgent issue. Your help is much appreciated

Please could you upload an example data file with the issue? Is your flow still as per the earlier image in this thread?

There are two blocks in my study and one is randomly coming. Either of them results in a problematic .csv file. Except for the ones with conditions file, is trials is unticked.

PARTICIPANT_WMI_visualverbal_2022-01-01_16h32.47.096.csv (22.9 KB)

All settings for the other block is the same as this one:


Try just having istrials ticked for ret1_rand and ret2_rand (assuming that nReptsImlist and nRepsWlist can only be 0 or 1)

Yes, only 1 and 0.

PARTICIPANT_WMI_visualverbal_2022-01-03_14h36.00.267.csv (42.6 KB)

Are you running this offline?

Was that data file created with only istrials ticked for ret1_rand and ret2_rand ?

No, online.

also, the ones that include main conditions file also is trials ticked

As previously mentioned, the istrials flag doesn’t do anything online.

You can reduce the number of rows online by using different techniques, such as:

if nReptsImlist == 0:
     continueRoutine = False

in Begin Routine of imret2_loop instead of having a loop around it with nReps of nReptsImlist