Presenting taks using latin square

Hi,

If you need a latin square for three tasks, the following approach might be one option to do it. It uses the participant numbers (assuming these are 1, 2, 3, etc.) for a modulo division and then uses the remainder to select the task order accordingly. This will work for any number of participants, automatically repeating the order after 3 participants (of course, you could do full counterbalancing by increasing the number of input files and the number for the modulo division). Assuming just three different orders, at the very beginning of your experiment you could insert this code component:

subjCode = int(dlg.data[0])  # assuming participant is your first dialogue field
remainder = subjCode % 3

You could then use the remainder in the outermost loop like this:

In addition, you would need three input files specifying the different orders. For example, 1.xlsx might look like this:

(2.xlsx and 0.xlsx would contain the other two task orders)

I haven’t tried this out, but if I’m not mistaken it should work. (Just to be on the safe side: Using this approach, you would no longer need the “code_randomise” routine as task order will be determined by the input file.)

Jan

P.S. Sorry, I forgot that you need to convert the remainder to a string when using it for the file name: $str(remainder)+".xlsx"