This app implements a perceptual discrimination task with optional confidence reporting in oTree. On each round, participants briefly observe a grid of colored symbols and must decide which symbol category is the correct answer. After responding, they may also report how confident they are in their answer, depending on the value of the constant CONFIDENCE. The task is designed to collect both accuracy and, when enabled, subjective confidence for each perceptual decision.
How it works
The app runs over multiple rounds. In each round, participants are shown a fixation cross followed by a stimulus grid made of colored symbols. The stimulus contains four symbol categories, labeled internally as: a, b,c, or d. One of these categories is designated as the correct solution for the round. The correct category appears more often in the grid than the three alternatives. The participant’s task is to identify the category that appears most frequently.
After the participant answers, the app records:
the chosen answer
the response time
whether the answer is correct
If confidence reporting is enabled, the participant is then taken to a second page where they report their confidence in their answer.
Stimulus generation
For each round, the app randomly selects one correct solution among the four possible categories. The remaining three categories are treated as incorrect alternatives.
The composition of the stimulus grid is determined by the function construct_array(). This function creates a list of symbols with:
a proportion of cells assigned to the correct solution
the remaining cells divided approximately equally among the three incorrect solutions
The symbols are then shuffled randomly before being displayed in the grid.
Difficulty level
The proportion of correct symbols in the grid is controlled by the dictionary: DIFFICULTY_BY_SOLUTION
In the current version, all four categories use the same difficulty value: 0.40
This means that the correct category occupies 40% of the grid, while the remaining 60% is distributed across the three incorrect categories (so 15% each).
Increasing this value makes the task easier, because the correct symbol becomes more frequent. Decreasing it makes the task harder. Maximum difficulty is 0.2.
Stimulus appearance
The duration of the stimulus display is controlled by the constant TIME_APPEARANCE
In the current version: TIME_APPEARANCE = 1. This means the stimulus is visible for 1 second.
The app also defines four colors, one for each category:
COLOR_A = "#0072B2"
COLOR_B = "#E69F00"
COLOR_C = "#009E73"
COLOR_D = "#D55E00"
These colors are used to maximize visual discriminability between categories.
The symbol shapes are defined by: SYMBOL_A, SYMBOL_B, SYMBOL_C, SYMBOL_D
In the current code, all four are set to "■", so the categories differ only by color.
Data recorded
For each round, the app records:
solution: the correct category for the round
wronganswers: the three incorrect categories
actuallettertasktdif: the difficulty level used for the round
answer: the participant’s chosen response
timetask: the response time for the perceptual task
is_correct: whether the response was correct
confloc: the reported confidence level
timeconfloc: the response time for the confidence judgment
In practice: How to make it run?
Download perceptualtaskandconf.zip from this repository
Places the files in your oTree project
Add the perceptualtaskandconf folder to your otree main folder
Add the following configuration to the SESSION_CONFIGS list in your settings.py file:
dict(
name='perceptualtaskandconf',
display_name="A Perceptual Task with Confidence Judgments",
app_sequence=['perceptualtaskandconf'],
num_demo_participants=10,
),