Task dossier

Delay Discounting Task

T000017T000017-delay-discountingDraftWeb preview availableUpdated Jun 19, 2026

MCQ-27 style intertemporal choice task (smaller-sooner vs larger-later)

Delay Discounting Task flow diagram
Delay Discounting Task flow diagram
Preview path
This task ships with a matched HTML companion so the browser preview can stay aligned to the canonical local repository.
Quick start
Clone locally, then follow the README for install and run instructions.
git clone https://github.com/TaskBeacon/T000017-delay-discounting.git
cd T000017-delay-discounting
# Follow the README for local setup and run steps

Delay Discounting Task

Maturity: draft

FieldValue
NameDelay Discounting Task
Versionv0.2.0-dev
URL / Repositoryhttps://github.com/TaskBeacon/T000017-delay-discounting
Short DescriptionMCQ-27 style intertemporal choice task (smaller-sooner vs larger-later)
Created ByTaskBeacon
Date Updated2026-02-17
PsyFlow Version0.1.9
PsychoPy Version2025.1.1
ModalityBehavior
LanguageChinese
Voice Namezh-CN-YunyangNeural

1. Task Overview

This task implements an MCQ-27 style delay discounting paradigm where participants repeatedly choose between a smaller-sooner (SS) and larger-later (LL) monetary option. Trial offers are generated from a fixed 27-item item pool using deterministic utility-based planning, with configurable randomization and side counterbalancing. The implementation supports human, qa, and sim modes, records choice and RT outcomes at trial level, and emits structured triggers for each phase.

2. Task Flow

Task Flow

Block-Level Flow

StepDescription
1. Parse mode and configmain.py resolves human/qa/sim and loads the requested YAML profile.
2. Build participant contextHuman mode uses full subject form; QA and sim use synthetic IDs from runtime context.
3. Initialize runtimeConstruct TaskSettings, initialize trigger runtime, window, keyboard, and preload all configured stimuli.
4. Initialize condition generation configmain.py loads condition_generation settings (item pool, randomization, side counterbalancing) for deterministic planning helpers in src/utils.py.
5. Start experimentEmit exp_onset; show instruction screen and wait for continue key.
6. Prepare block conditionsFor each block (total_blocks=1), BlockUnit.generate_conditions(func=build_block_conditions, ...) generates readable magnitude-label conditions from a deterministic MCQ plan.
7. Run trialsBlockUnit emits block_onset, executes run_trial(...) for each condition label, and run_trial.py reconstructs the exact item spec deterministically from block seed + trial position, then emits block_end.
8. Compute block summaryAfter block, compute response rate, LL choice rate, and mean RT from collected trial records.
9. Show block breakPresent block summary screen (block_break) with formatted metrics.
10. FinalizeShow final summary screen (good_bye), emit exp_end, save CSV, close trigger runtime, and quit PsychoPy.

Trial-Level Flow

StepDescription
1. Resolve planned offerrun_trial.py derives block-trial index, reconstructs the deterministic block plan, and fetches the matching MCQ item spec (magnitude, amounts, delay, side assignment, item ID).
2. Cue phaseShow neutral fixation for cue_duration=0.6 s and emit cue_onset. Condition labels are intentionally not shown before choice.
3. Anticipation phaseShow fixation for anticipation_duration=0.2 s and emit anticipation_onset.
4. Choice phaseDraw left/right option text and choice prompt; collect f/j response within decision_duration=6.0 s; emit choice_onset, response trigger (31/32), or timeout trigger (39).
5. Choice state derivationCompute chosen side, chosen option (ss/ll), chosen amount, chosen delay, and LL indicator (chose_ll).
6. Choice confirm phase (if responded)Present both options plus a highlight rectangle on selected side for choice_confirm_duration=0.3 s; emit choice_confirm_onset.
7. Feedback phaseIf responded, show feedback_choice (feedback_choice_onset=40); if timeout, show feedback_timeout (feedback_timeout_onset=41) for feedback_duration=0.5 s.
8. ITI phaseShow fixation for iti_duration=0.5 s and emit iti_onset.

Controller Logic

ComponentDescription
Adaptive controllerNot used in this task.
RationaleDelay discounting here does not require adaptive RT-window control or staircase difficulty adjustment.

Condition Generation Logic

ComponentDescription
Item poolUses embedded/default 27-item MCQ table (MCQ27_ITEMS) or config-provided subset with fields: item ID, magnitude tier, SS amount, LL amount, delay days, and reference discount factor (k_ref).
Block plan generationbuild_block_plan(...) deterministically builds a per-block trial list of length trial_per_block from item pool + seed and optional order randomization.
Side assignmentWith counterbalance_sides=true, LL side is balanced across trials (half left, half right when possible) and shuffled by seed.
Option rendering fieldsFor each trial, utility planning computes left_amount/right_amount, left_delay_days/right_delay_days, ll_side, ss_side, and condition_id.
Trial servingrun_trial.py reconstructs the planned trial spec by block seed and block-trial index, and validates magnitude-label agreement with the BlockUnit condition.

Other Logic

ComponentDescription
Neutral pre-choice designAlthough cue_text is defined in config, current trial logic intentionally presents fixation in cue phase to avoid exposing condition labels before choice.
Derived behavioral outputsTrial data includes response presence, response key, RT, chosen side, chosen option, LL choice flag, and chosen value/delay fields.
Block-level metricsMain loop computes response rate, LL rate among valid responses, and mean RT for block feedback text.
Trial context plumbingEach stage (pre_choice_fixation, offer_onset_jitter, intertemporal_choice, choice_confirmation, outcome_feedback, inter_trial_interval) calls set_trial_context(...) for responder compatibility and simulation auditability.

Runtime Context Phases

Phase LabelMeaning
pre_choice_fixationpre choice fixation stage in src/run_trial.py responder context.
offer_onset_jitteroffer onset jitter stage in src/run_trial.py responder context.
intertemporal_choiceintertemporal choice stage in src/run_trial.py responder context.
choice_confirmationchoice confirmation stage in src/run_trial.py responder context.
outcome_feedbackoutcome feedback stage in src/run_trial.py responder context.
inter_trial_intervalinter trial interval stage in src/run_trial.py responder context.

3. Configuration Summary

All settings are defined in config/config.yaml.

a. Subject Info

FieldMeaning
subject_idRequired participant ID, integer, 3 digits, constrained to 101-999.
subnameParticipant name string (pinyin label in mapping).
ageInteger age constrained to 5-60.
genderChoice field with Male and Female.

b. Window Settings

ParameterValue
size[1280, 720]
unitspix
screen0
bg_colorblack
fullscreenfalse
monitor_width_cm35.5
monitor_distance_cm60

c. Stimuli

NameTypeDescription
fixationtextCenter fixation + used in cue/anticipation/ITI.
instruction_texttextChinese instruction describing SS/LL choices and key mapping.
cue_texttextCondition label text template (金额等级...) defined in config; currently not shown in trial runtime.
option_lefttextLeft offer text stimulus, rebuilt each trial with concrete amount and delay.
option_righttextRight offer text stimulus, rebuilt each trial with concrete amount and delay.
highlight_leftrectLeft-side selection highlight rectangle shown after response.
highlight_rightrectRight-side selection highlight rectangle shown after response.
choice_prompttextNeutral choice prompt shown during decision window.
feedback_choicetextFeedback text for valid choices.
feedback_timeouttextFeedback text for missed responses.
block_breaktextBlock summary text with response rate, LL rate, and mean RT.
good_byetextFinal summary with total trials, valid trials, and LL rate.

d. Timing

PhaseDuration
cue0.6 s
anticipation0.2 s
choice response window6.0 s
choice confirm0.3 s
feedback0.5 s
iti0.5 s

e. Triggers

EventCode
exp_onset1
exp_end2
block_onset10
block_end11
cue_onset20
anticipation_onset25
choice_onset30
choice_response_left31
choice_response_right32
choice_confirm_onset33
choice_no_response39
feedback_choice_onset40
feedback_timeout_onset41
iti_onset50

f. Condition Generation

ParameterValue
randomize_ordertrue (condition_generation.randomize_order)
counterbalance_sidestrue (condition_generation.counterbalance_sides)
ll_left_prob0.5 (condition_generation.ll_left_prob, used when side counterbalancing is disabled)
enable_loggingtrue (condition_generation.enable_logging)
item pool size27 MCQ items by default (or config-provided subset under condition_generation.item_pool)
seed behaviorBlock seed passed via settings.block_seed[block_i]; produces deterministic block plan for fixed seed
adaptation styleNon-adaptive deterministic item/side planning via src/utils.py helpers

4. Methods (for academic publication)

Participants performed a delay discounting task based on the 27-item Monetary Choice Questionnaire framework. On each trial, they selected between two monetary options: a smaller immediate reward (SS) and a larger delayed reward (LL). The task used one block of 27 trials, with item content spanning small, medium, and large magnitude tiers. Responses were made with two keys (F/J) mapped to left/right options.

Each trial started with a neutral fixation cue (0.6 s) and a brief anticipation interval (0.2 s), followed by the decision screen (maximum 6.0 s). The decision screen displayed two option texts containing amount and delay information. If a choice was made, a short confirmation stage (0.3 s) highlighted the selected side without revealing internal condition labels; then feedback was shown for 0.5 s. Missed trials produced timeout feedback. A 0.5 s inter-trial interval separated trials.

Offer generation is implemented by deterministic utility helpers initialized from the configured block seed, with optional order randomization and side counterbalancing to distribute LL placement across left and right positions. Behavioral outputs included response rate, reaction time, choice side, and LL choice proportion at both trial and block level. Event markers were emitted for all principal phases to support synchronized behavioral and neurophysiological analyses.