| Reference | Downloads | Github

Choosing a particular column from the conditions file on the basis of the stimuli clicked

I’m trying to build an experiment where a participant would be shown 36 grids, of 3 different colours, and they’d need to click on the grids in order to get a reward.

So far, I’ve built two routines:
Routine 1 has all the grids (stimuli) that the participant would need to click + a mouse component.
Routine 2 displays the reward one can get.
Both the routines have been looped over and the conditions file basically has three different columns.

So, based on the particular type of grid that is clicked (depending on the colour), I want PsychoPy to choose a particular column from the conditions file and display a random value (as text) from all the values given in that specific column. This chosen column would vary depending on the colour of the grid that is clicked in the routine1 (thus, 3 columns for three colours).

I’m pretty new to PsychoPy, so if someone could give me directions with respect to this, it’ll be much appreciated!

Hi @namgyal,

I’m not entirely sure I understand what exactly you’re trying to achieve. Could you perhaps explain in a bit more detail what a trial involves? For example, how many grids are shown per trial? Is it three (one of each colour)? How often is an individual grid shown? What does your input file look like?
It might also help to upload your experiment (incl. the input file) and/or to show us screenshots of the relevant parts.


Hey @jderrfuss, yes sure.

Screenshot (211)

This is what the participant would see throughout the trial; this is the first routine.
There are 36 grids, and they have been divided on the basis of 3 different colours. Each colour is indicative of the range of rewards a participant would expect to get, on clicking. Eg: if you click on any of the pink grids, you’ll get a random value within the range of 1-10$. Similarly, you’ll get a random value as reward within the range of 7-16$ if you click on the yellow grids and so on.
This would be a timed trial of 3 minutes, so till the time ends, the participant would need to keep clicking and figure out which colour of grids returns the highest rewards to try maximise their total rewards earned, as they would not be informed at the start of the experiment as to which colour of grid would return what reward value.

So, for the reward values for each colour, I made one conditions file with three columns. Each column would have certain number of values from different reward ranges.

Col1: 1,3,5…
Col2: 7,9,15…
Col3: 15,24,28…

What I want is that if a participant clicks on say any of the yellow grids, a random value from Col1 is generated. Similarly, if a participant clicks on the pink grids, a random value from Col2 would be generated and so on.

I could use three different textboxes and use $Col1, $Col2, etc. for each box, but I only want the relevant reward value to be displayed. By this, I mean that if I click on a yellow grid, I only want to see the textbox linked to Col1, not the other textboxes that have been linked to other columns via $Col2, $Col3. Similarly, if I click on a pink grid, I want to see a random value generated from Col2, and so on. These values would basically be the reward that the participant would get on clicking.

I think another alternative could be that I use a single Textbox and a code component to assure that on clicking only a certain type of grid (eg: any of pink grids), I get random values from a particular column only (random values on each click, from column 2). Similarly, if I click a yellow grid, then I get a random value from Col1 in the same textbox and so on.

I hope I’m clearer now!

Hi @namgyal,

A note on terminology: I’m going to refer to the whole 6x6 object as a grid, and to the individual parts as squares.

So, is there just one grid that stays the same the whole time or is the idea that the grid changes after the participant clicks on a square?

In fact, I don’t quite understand why you need the grid. It seems you could also present just three coloured squares and ask participants to figure out which of these gives the highest rewards. What purpose does the grid serve?