**OS: macOS Catalina 10.15.6
**PsychoPy version: 2020.1.2
**Standard Standalone: YES
What are you trying to achieve?:
Pseudo-randomize trials in a loop using custom code in the builder.
What did you try to make it work?:
Checking the psychoPy source code and trying to understand a bit how things work. I copied pasted some parts to the “Beginning of the Routine” tab of the 1st routine within my loop and adjusted them to set a custom order of trials regardless of the order they appear in my excel file. I used the following code:
#This is only an example, the number of trials and their order can vary as pleased customOrder = np.array([, , , ]) myLoop.sequenceIndices = customOrder
The code runs the first trial based on the original order and later runs the rest of the trials in the custom order. Furthermore, the experiment seems to crash when the trial shown as the first one is about to be ran in the next loop according to the custom order. For example, if the the originally random order of the trails is 0, 1, 2, 3, (i.e. the 1st row in the stimuli list is to be run first, then the 2nd row, and so on), the code above (showing a custom order of 2, 3, 0, 1) correctly runs the first two trials (with the third and the fourth row in the stimuli list) but crashes when attempting to run the third loop with the first row. I receive the following error message:
“WARNING need a bigger array for: ran”
I think the problem is related to an old post that I found by googling: https://groups.google.com/g/psychopy-dev/c/-LOALuQoENs?pli=1
Any ideas of how to make this approach work? Ideally I would have to assign the order of assign the otrder of the stimuli with
myLoop.sequenceIndices = customOrder when the loop element is created before starting the first routine of the loop.