I’m a beginner to PsychoPy and Python and trying to create an experiment, but have gotten stuck at this point and can’t get further. I’m creating a sequencing task, where 16 targets are presented in a circle and 4 of these will randomly be chosen to be part of the sequence, where they will then change colour (black, red, green) sequentially for the participant to move their mouse to.
So far, I have my 16 targets in a circle, however these all change colour when presented and clicking through trials, whereas I only want 4 of them too and for this to change each trial. I’m trying to use an excel conditions file to do this, I have also previously tried using code I had adapted from here. I was hoping someone would know how to fix this!
I hope this makes sense, if not do let me know.
Ok so there are several ways we can think about approaching this (there is not one “right” answer so I will suggest just one!) here is a little demo but with only 5 polygons (you would just adapt it to be 16). sequence_demo.psyexp (31.0 KB)
In this demo we use nested loops. One loop corresponds to each trial. The second, inner, loop corresponds to the sequence. There are 2 code components. Before we start the sequence (in the “trial_prep”) routine we make a list of possible locations where the target could appear. Then in the sequence we shuffle the list, sample a position and remove it from the lest (so that two targets wouldn’t appear in the same location). On each iteration of the sequence loop we update the color of the target to be the required color for that sequence position.
Hope this helps!
That’s brilliant thank you - worked amazingly when I adjusted it as well.
Thank you again!
Never mind I managed to figure out my issue after ages of trying - please ignore - sorry! Was just a matter of changing some variable names