Instructions multiple block orders

---------------------------------------------------------------

This template works with two loops: trials and blocks. The blocks loop surrounds the Trials loop and is responsible for providing the blocks in the correct order as the conditions file for the trials loop. This is done by using the participant number and a conditions file that consists of all possible permutations of the numbers 1 to 5 (because there are 5 blocks in this template). That file can be found in the Folder Permutations_1_to_10.

The permutations file Looks like this:

ID  FirstBlock  SecondBlock  ThirdBlock FourthBlock  FifthBlock

1      1           2            3           4           5
2      1           2            3           5           4
etc...

Each row in the permutations file represents a different block order and the block order that is supposed to be used in an experiment is selected by selecting the corresponding row in the permutations file. This is done through the participant number that is given in the beginning of the experiment. For example, if the participant number is 1, row 1 in the permutations file will be selected and the block order represented in that row will be used.

For the experiment, it is not a problem if you enter a participant number that is higher than the number of rows in the permutations files. If the participan number is higher, PsychoPy will simply start recounting at the beginning of the conditions file until the row for the participant number is found. For example, there are 120 block orders if there are 5 blocks. If you enter 121 as the partiipant number, PsychoPy will use row 1. That way, you can use the same block order multiple times, but still distinguish the participants by their respective participant numbers.

To run each block, you have to set the number of repetitions of the blocks loop to the number of blocks in your experiment. Since there are five blocks in the template, the blocks loop is repeated five times. During each run of the blocks loop, one of the columns of the permutations file is used. In the first run, the row FirstBlock is used, in the second run SecondBlock is used etc. If the value of FirstBlock is 1, then block 1 is presented in the trials loop. This is done by reconstructing the name and file path of the conditions file for that block. This means that you either have to name your files "Block_1.xlsx", "Block_2.xlsx", etc. and keep them in the "Block_files" folder for the experiment to find the files or you have to change the values of the variables that save the name of the file path and the conditions file. You can do that in the code component in the routine "current_block_selection". 

If you use another amount of blocks, you do not have to change these values, but you have to use another permutations file. This is because if you use, e.g. four blocks instead of five like in this template, you do not have a fifth block and if PsychoPy tries to call "Block_5.xlsx", it will run into an error. Similarly, if you use six blocks instead of five, not every block will be called if you use the Permutations file for five blocks because that file does not consider a sixth block or file. In the folder Permutations_1_to_8, you find files containing the permutations for all amounts of blocks from 2 to 8 so that you do not have to create them yourself. Make sure to change the file in the blocks loop to the according permutations file and the number of repetitions of the blocks file to the number of blocks you have. In the code component of the routine "block_order_selection", you also have to change the number behind the percent sign. That number has to be the same as the highest ID in your permutations file.
Right now, that number is 120:

rowIndex = [(int(expInfo['participant']) - 1) % 120]
                                                 ^
                                                 |

If you have four blocks, the highest ID in your permutations file is 24, therefore the code would have to look like this:

rowIndex = [(int(expInfo['participant']) - 1) % 24]
                                                 ^
                                                 |


This is all you have to know to use and adjust this template. If you have any questions, do not hesitate to contact the person listed as responsible for PsychoPy support on the INF website: https://crc1646.pages.ub.uni-bielefeld.de/inf/website/#members



