PsychoPy version (e.g. 1.85.6):
What are you trying to achieve?:
I’m building a fluid intelligence task similar to the Ravens Progressive Matrices. A key difference is that stimuli are presented semi-randomly – we want to minimize the training effects from trial to trial. I have 60 unique matrices across three difficulties (easy, standard, and advanced), the filepaths for each class of matrices are stored in an excel file. At the start of the flow I want to build 10 blocks of six matrices that feature two problems of each difficulty, such that each participant will be exposed to a different, psuedo-randomized set of blocks.
What did you try to make it work?:
It seems like this is definitely doable, and relatively easy, but I’ve had little success trying to piece together the code I need and where to run it. I’m very new with python and psychopy, but happy to learn more.
Initially I tried using a nested loop, one for the trials, and one for selecting a difficulty. This ran correctly, but didn’t have the desired outcome. The entire set of 20 trials would be presented after selecting a difficulty. If I could set this loop up to select only one trial at random before repeating the loop, while recalling which stimuli have been used, that would be perfect! However, I was only able to take one step towards this goal.
///if trials.thisN == 0: # i.e. trial 0 has been completed
/// trials.finished = True # end the loop early
This is very close to what I want, but has the problem of potentially resampling stimuli multiple times. If I can work around that issue, this solution is fully sufficient.
Then I created a more brute force version. I set up 10 blocks by hand, and replaced the difficulty selection loop with block selection. This works great and achieves a very similar effect, but locks the total number of possible presentations to somewhere in the low billions. Not bad, but I was really trying for more.
What specifically went wrong when you tried that?:
Psychopy builder is working as intended. I think I could figure it out if some of the steps had a youtube video associated with them – it’s kinda hard for me to read a page of code and “get it” at this point, but the gestalt ideas are usually salient enough that I can figure them out if someone shows me an easy one, then lets me play with it.
Here are the steps I think I need, but am not sure how to implement. Please correct me if I’m wrong or using incorrect/imprecise terminology:
- At the start of the flow, create 10 excel files named block1-10.
- Load in the difficulty sheets from excel (3 files, each with 20 stimuli, answers, and corAns)
- Shuffle all rows in the difficulty sheets – I have a question here. The difficulty sheets have stimulus (a .jpg), multiple choice options for that stimulus (also a .jpg), and the correct answer stored in three consecutive columns. If I shuffle all rows, will the pairings for stimulus-answers-corAns be maintained?
- Select 0:1 from each difficulty, put them in block1, then loop this process for 2:3, 4:5, etc, until all 10 sheets are filled with 6 different items, 2 from each difficulty.
- Present all 10 blocks in sequential order, without replacement. (This one is easy if everything else is in order, but clarifies my desired endstate).
Thank you very much for your time and energy. I hope we are able to help each other out!