lundi 24 février 2020

Is there a way to randomize the order of sub loops in a main loop?

I have 6 different blocks (for-loops) that are part of a main for-loop. Each block, consisting of 6 randomly picked stimuli, is supposed to be presented twelve times. The presentation of the blocks should happen in a random order.

So far, I created a main loop around the six blocks that repeats twelve times and I planned to randomize the order of the blocks with PsychoPy's TrialHandler. However, this does not work the way it should and I have to figure out another way. I was thinking:

  1. I could make a list (of numbers or strings) and shuffle this list and then create if-conditions for the sub loops i.e. "if "Block1" is list[0], then the for-loop Block1 is initialized. Does something like that work? If it does, how do I implement it because, ideally, I want to generate the order of the sub loops with the list.

  2. The other idea concerns the TrialHandler and is thus specific to PsychoPy. I was wondering if it is possible to create an excel file containing the different blocks and add it to the conditions parameter of the main loop. If every block would be a row, PsychoPy would be able to randomize these. However, I am unsure if this works and how the blocks could be added to an excel file.

Does any of these solutions seem reasonable or is there another way to achieve a randomization?




Aucun commentaire:

Enregistrer un commentaire