| Reference | Downloads | Github

Permutations for a visual search task

Hello Psychopy Community,

I am new to builder and I’m in the process of programming a visual search experiment that has one target and 5 different distractors (6 unique stimuli). Each of these stimuli can appear in one of 6 locations, meaning that there are 720 possible stimuli-location combinations. So I was wondering whether it was possible to code something like this in the builder without including every possible permutation? Also note, this is an online experiment, and thus, I cannot use the coder.

Thank you!

Easiest way would be to just have an excel sheet that has each stimuli at each position and then set the loop to not replace positions

stim, position
stim1, 0,0
stim1, 0,0.5

stim6, 1,1

Using fill down and copying and pasting shouldn’t take long - you would also be confident that it would translate to Pavlovia

You can also do this using the Variable and Code components - these will auto-translate to JS so should still work on Pavlovia (let me know if they don’t as that’s something to fix!).

The process is pretty similar to what I described here:

Essentially, rather than having 6 cells, you have one cell with values separated by a delimiter (e.g. a comma), then you split by that delimiter and use numpy.random.choice to choose a value each trial. This lets you simplify complex designs to more simple csv files, but comes at the cost of requiring more programming. As @Oli said, 720 combinations is very doable in excel using the auto-completion tool!

Thank you for your feedback. I ended up using the code component in JS to randomize the positions for each of my stimuli.

Do you mind sharing that solution?

I’m also interested in the solution, if you don’t mind sharing :slight_smile: