The repository replicates the task described in Gueguen et al. (2024) in PsychoPy. Different variants of this task are also used and described in Bavard et al. (2021).
Conditions (i.e., trial information) is specified in stim/conditions.csv.
Note that the task currently does not automatically create rewards and manage reward probabilities. All of this work and logic needs to be provided in the conditions.csv file for now. While this is a bit more tedious, it allows for a great level of control over what is shown. In the future, a script creating the conditions.csv file can be used to implement different task variants.
The conditions-file should have the following columns:
phase: This specifies the task phase. Accepted values are:"training": Trials in this phase don't count towards total points tally and can be repeated up totraining_n_repeats_maxtimes. They use a separate set of symbols (identified bysymbol1andsymbol2values - see below - starting with"T")"learning": Trials in this phase count towards total points tally. They usesymbolvalues"A","B", etc."transfer": Technically, can be identical to thelearningphase, but will accept a different set of instructions, and, for example, different symbol pairings orfeedbackconditions (see below)"explicit": In this phase, no symbols are shown. Insteadprobabilityandoutcomeare shown explicitly for each option.
block: This allows for splitting phases into blocks. Ifshow_block_dividersis set toTrue, break screens will be included. Block values can re-start within everyphase. Note that thetemporal_arrangementsetting that shuffles trials or trial blocks (based ontrial_type, see below) applies within each block.trial_id: A running ID for trials. They are written into the data, they're not used for anything else.trial_type: This variable is used to determine thetemporal_arrangementsetting. Within each block, iftemporal_arrangementis set to"interleaved", all trial types are shuffled randomly. In contrast, iftemporal_arrangementis set to"blocked", trials with the sametrial_typeremain chunked together, but the chunk order is shuffled.symbol1,symbol2: These specify the symbols shown for each trial. Training symbols are denoted withT(e.g.,T1). Task symbols are denoted with uppercase lettersA,B, etc. Note, that the task will map different symbols (i.e., image files) to these symbol IDs for each run.option1pos: Denotes the position (leftorright) of option 1. Option 2 will take the other position.feedback: Sets the feedback condition. This lets you change behavior intransferandexplicitphases. Accepted values are:"complete": Outcomes of both options (chosen and unchosen) are shown."partial": Outcome of the chosen option is shown. Unchosen outcome is shown as "?""none": Both outcomes are shown as "?""skip": Feedback phase is skipped completely
outcome_randomness: Allows you to determine if option outcomes are realized truly random, according to specified probabilities in each trial (see below), or pseudorandomly, where you predefine the outcomes in theactual_outcomecolumns (see below)."random": Each option's realized outcome will be drawn truly randomly. For example, the outcome in columnpotential_outcome1will be realized with probability given in theprobability1column, or 0 otherwise."pseudorandom": Each option's realized outcome in this trial is predefined in itsactual_outcomecolumn.
potential_outcome1,potential_outcome2: Potential outcomes of the two options in this trial. Ifoutcome_randomnessis"random", outcomes in each trial will be this value with givenprobability, or 0 otherwise. Values in this column are also displayed inexplicitphase.actual_outcome1,actual_outcome2: Values in these columns are the realized outcomes. Ifoutcome_randomnessis"random", you don't need to specify these values, as actual outcomes will be stochastically determined (according to theprobabilityvalues). Ifoutcome_randomnessis"pseudorandom", you need to specify the actual outcomes of each option in each trial. Across multiple rows of the conditions file, you can implicitly define the options' outcome probabilities.probability1,probability2: Ifoutcome_randomnessis"random", these are the probabilities with which outcomes are realized in the trial. In theexplicitphase they are also used to display reward probabilities of the two options explicitly. Ifoutcome_randomnessis"pseudorandom", the probabilities do not influence realized outcomes in each trial, but are only used for display in theexplicitphase.
Additional task settings (e.g., timing variables, colors, etc.) can be set in the settings.py file. You should not be required to make changes to task.py.
Task instructions for the different phases can be defined in instructions.py.
Instructions are implemented as src.slideshow.SlideShow, allowing forward and backward navigation. Instruction content can be provided as plain text slides (using src.slideshow.TextSlide) or image slides (src.slideshow.ImageSlide), or a mix of the two.
If not specified differently, task data are saved to data. In addition to the experimental data, task settings (contained in the exp_info dictionary), and PsychoPy's own .psydat file are saved for every run.
Stimulus images are made with the Identicon generator.
- Bavard, S., Rustichini, A., & Palminteri, S. (2021). Two sides of the same coin: Beneficial and detrimental consequences of range adaptation in human reinforcement learning. Science Advances, 7(14), eabe0340. https://doi.org/10.1126/sciadv.abe0340
- Gueguen, M. C. M., Anlló, H., Bonagura, D., Kong, J., Hafezi, S., Palminteri, S., & Konova, A. B. (2024). Recent Opioid Use Impedes Range Adaptation in Reinforcement Learning in Human Addiction. Biological Psychiatry, 95(10), 974–984. https://doi.org/10.1016/j.biopsych.2023.12.005
- Include serial port triggers
- Allow for counterbalancing of trial_type / block-orders and/or disabling random shuffling
- Perform thorough check of the task. Is everything on time? Is everything shown properly? Is everything recorded? Does the random stimulus mapping work as expected?
- Document output file
- Write script to create
conditions.csvmirroring literature - (low priority) What if we want to skip phases? problems: RNG, points counting.
- (low priority) Check if we can read the settings.json for a rerun
- Integrate Tobii Eyetracker using Titta
-
Clarify: Is feedback ("?") shown if no response given? -> No -
(Bug): Explicit phase trials with "pseudorandom" mode do not make any sense, because probabilities are shown, but not used. Shown outcomes are always realized. -
Implement actual stochastic outcomes that useprobabilitycolumns of the conditions file -
Research casino animation during choice phase: could be done by prerendering a movie for each symbol and showing a movie -
Revise feedback phases. "none" becomes "skip". "partial" and "none" need to show question marks. -
Make timing physiology compatible: Allow for fixed (choice+feedback) duration. In this case, what happens to missed responses? -
see if we can record screen resolution into data or experiment_settings -
variable ITIs -
debriefing slides should be slides not slideshow -
Add support for multiple stimulus sets (e.g., to use for different visits) -
Check if trials are randomized within blocks if temporal_arrangemend == 'blocked' -
Double check temporal arrangement options. I think there should also be randomization if this is "blocked". -
fix bug with random seed. currently, changing it in the GUI doesnt do anything -
Fix ImageSlide instructions -
End screen message can be SlideShow, too -
Remove unnecessary "exp_info" in main script. only necessary within functions -
Include intermediate points tally -
Ensure all data are recorded -
Keep track of rewards over trials (for each phase) -
Check if image size is specified properly -
Specify text color -
Make trials look nicer: Include background and feedback rectangles -
Make counterfactual outcome have different color -
Implement explicit phase -
Record all data (ideally, just include all condition data) -
Is feedback an option in the explicit phase? -
Refactor code to reduce duplication across phases -
Prepare serial port triggers (viaexp_info?) -
Implement ITI -
Move timing variables intoexp_info(currently hardcoded intrial.run()) -
Implement random assignment of icons to choice options -
Implement temporal arrangement (temporal_arrangement; "blocked" vs. "interleaved") -
Fix instruction slideshow -
Implement left/right shuffle (currently calledstim1pos)



