I am using Macbook pro OS X and psychopy 1.84.2 stand alone version.
I have three different tasks in one flow (flanker, n-back, abacad), and I want the task order to change according to latin square for every participant.
I am wondering whether it is possible make psychopy show different tasks (each with its own loop) in a predetermined order which changes everytime the experiment is used by a different participant
for example, for my tasks something like this:
I may be wrong but I think what you are asking is called conditional branching and this link will probably help (?)
However, note that you will not have control as to how tasks’ presentation will be ordered between participants i.e. you may have 2-3 consecutive participants who have been given the same order of task presentation but I don’t think this is something that it is of great concern. This is beyond my level of knowledge on PsychoPy and Python and other experienced users may be able to help you on that.
Thank you
I saw that one but the problem is my block-level loops have condition files associated with them so I can’t follow the exact instructions. Another problem is all my block-loops have more than one routine.
I cannot make out which task is which so I created 5 loops assuming that there are 5 tasks (I know I am wrong but adjust accordingly) and an outer loop that encloses everything and hopefully will randomise your tasks.
I haven’t tested it myself but perhaps you can give it a try to see if it works.
The ITIs and the breaks may be a bit tricky so you may need to consider including them inside some loops.
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"
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 3.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.)
psychopy aborts the experiments before I see that message box. I will try to upload my experiment, but I have a very bad connection right now, so it might not be possible but I’ll try.
I think you uploaded the wrong file. The only difference between this one and original one is that in this, key response in the main instruction starts with the text.
I made the changes you said you did. It is working now, but the only problem is for the first participant it starts with the first task, for the second with the third task instead of second and for the third participant again with the third task.
I don’t know whether it is a hard problem to fix, and if it is so please let me know. I took too much of your time already, I don’t want to cause anymore trouble.