psychopy.org | Reference | Downloads | Github

Mixing trial types and stimulus presentations

If this template helps then use it. If not then just delete and start from scratch.

OS MacOS High Sierra 10.13.6 iMac
PsychoPy version v3.0.5
Standard Standalone? (y/n) Yes
What are you trying to achieve?:
First variable is Task. Trials can be either a search task or a probe trial. These need to be a 70/30 split. Search tasks (70% of all trials) need to have have one the four shapes presented in red on 50% of the trials. The shapes are images of diamond, square, circle, hexagon. There are four different images for each shape. Red with a dot on the left. Red with a dot on the right. Green with a dot on the left. Green with a dot on the right. These are presented in positions in a cross shape. There can only be 0 or 1 red shape per trial. Participants respond using a key press (Left or Right) to indicate what side of the diamond the dot is on. The second trial type is a probe trial. This uses the same images and locations as the other search task, but instead of responding based on dot location a letter is flashed inside each shape on the screen briefly and the participants shown another screen where they report what letters they can remember. These trials are the remaining overall 30% but need to be divided between all four green, three green and one red, three green and a blank space.

My major issue right now is that I cannot for the life of me get this to choose between trial types (search task and probe trials) on a trial by trial basis. Let alone get it to do the appropriate proportions of each type of trial. I tried making a loop for each sub condition (search task red, search task green, probe red, probe green, probe 3 items) and then nesting those loops.
What did you try to make it work?:
I have tried every permutation of nesting loops and using several different conditions files but when it works it just does one from each loop type sequentially. I tried making a loop for each sub condition (search task red, search task green, probe red, probe green, probe 3 items) and then nesting those loops.
What specifically went wrong when you tried that?:
Most typical issue is that the outermost loops seemed to be ignored and it would either do 1 trial from each of the 5 conditions (when I had routines for each one) or it will just do search task then capture probe. Dropped Singleton Combined.psyexp (142.1 KB)
Dropped Singleton Combined.py (71.0 KB)

You only need one conditions file, which is attached to the outer loop. The inner loops do not have a conditions file attached.

The conditions file contains 70% rows for one task and 30% for the other. Make two variables called, say search_task and probe_task. Each column contains a 1 if the row is for that task, or a 0 if it is for the other task.

Now in the inner loops surrounding the routines for each task, simply put those variables in the nReps field for their respective loops. That means that on a search trial, the search routines will run once, while the probe routines will run 0 times (ie will be skipped).

I’ve thought about that and it seemed the way to go, but then I’d have recode how the shape configs. Currently my csv file has every possible combination of the shapes and colors because I can’t have more than one red appear at a time and shapes can’t be repeated. So I would need to code a way for that to happen and record responses that match the shapes, the shape locations, correct response, which stimuli were presented, and make sure they were shown in the correct proportions. Currently with my csv each combination of shapes is a row and it picks from there and displays accordingly.