|
| 1 | +# Probabilistic Reward Task (HTML Preview) |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +| Field | Value | |
| 6 | +|---|---| |
| 7 | +| Name | Probabilistic Reward Task | |
| 8 | +| Version | html (v0.1.0-dev) | |
| 9 | +| URL / Repository | https://github.com/TaskBeacon/H000039-probabilistic-reward-task | |
| 10 | +| Short Description | Browser companion for the Chinese probabilistic reward task with short-vs-long mouth discrimination, deferred reward carryover, and psyflow-web trial-context stamping | |
| 11 | +| Created By | TaskBeacon psyflow-web py2js port | |
| 12 | +| Date Updated | 2026-04-04 | |
| 13 | +| Modality | Behavior | |
| 14 | +| Language | Chinese | |
| 15 | + |
| 16 | +## 1. Task Overview |
| 17 | + |
| 18 | +This HTML companion mirrors the local `T000039-probabilistic-reward-task` task. Participants view a cartoon face, decide whether the mouth is short or long, and receive probabilistic reward feedback when correct responses land on scheduled reward-opportunity trials. The browser preview preserves the local stage order, counterbalanced key mapping, and reward carryover logic while using the current psyflow-web unit/context APIs, a local monotonic trial-id counter, and a shortened 2-block, 24-trial preview for fast review in the shared runner. |
| 19 | + |
| 20 | +## 2. Task Flow |
| 21 | + |
| 22 | +### Block-Level Flow |
| 23 | + |
| 24 | +| Step | Description | |
| 25 | +|---|---| |
| 26 | +| Load Config | Load the browser preview config. | |
| 27 | +| Show Instructions | Present the Chinese instruction screen. | |
| 28 | +| Initialize Reward Tracker | Start cumulative reward at 0 points. | |
| 29 | +| Generate Conditions | Expand each block into a balanced short/long schedule with reward opportunities assigned at a 3:1 rich-to-lean ratio. | |
| 30 | +| Run Practice | Execute 2 practice trials with correctness-only feedback. | |
| 31 | +| Run Experimental Blocks | Execute the same fixation -> preview -> flash -> response -> feedback -> ITI flow as the local task. | |
| 32 | +| Block Break | Show the timed 30-second rest screen between blocks. | |
| 33 | +| Finalize | Show the final total score and export data through the shared runner. | |
| 34 | + |
| 35 | +### Trial-Level Flow |
| 36 | + |
| 37 | +| Step | Description | |
| 38 | +|---|---| |
| 39 | +| Fixation | A central `+` fixation cross is shown briefly. | |
| 40 | +| Face Preview | The face outline and eyes appear first without a mouth. | |
| 41 | +| Mouth Flash | The short or long mouth is flashed briefly over the same face. | |
| 42 | +| Response | Participants press the counterbalanced short-key or long-key response. | |
| 43 | +| Feedback | Practice trials show correctness feedback; experimental trials show reward feedback or a neutral fixation screen. | |
| 44 | +| Inter-trial Interval | A short fixation interval separates trials. | |
| 45 | + |
| 46 | +### Controller Logic |
| 47 | + |
| 48 | +| Feature | Description | |
| 49 | +|---|---| |
| 50 | +| Counterbalancing | `subject_id mod 4` assigns short/long key order and rich-stimulus assignment. | |
| 51 | +| Condition scheduling | Each block contains a balanced short/long mouth schedule. | |
| 52 | +| Reward sampling | Reward opportunities are placed at a 3:1 ratio for rich vs lean stimulus. | |
| 53 | +| Reward carryover | Missed reward opportunities remain pending until the next correct response of the same stimulus type. | |
| 54 | +| No-response fallback | If the response deadline expires, a configurable fallback choice is imputed for logging and downstream scoring. | |
| 55 | +| Adaptive control | None. This is a static probabilistic reward task, not a staircase or reversal task. | |
| 56 | + |
| 57 | +### Other Logic |
| 58 | + |
| 59 | +| Feature | Description | |
| 60 | +|---|---| |
| 61 | +| Trial context | Every participant-visible screen emits trial context through the current psyflow-web wrapper before `show()` or `captureResponse()`. | |
| 62 | +| Trial ids | The browser port uses a local monotonic trial-id counter instead of importing `next_trial_id` from `psyflow`. | |
| 63 | +| Deterministic QA seed | Preview sampling uses the configured block seeds for reproducible browser QA runs. | |
| 64 | +| Summary metrics | Block and final summaries report accuracy, discriminability, response bias, and total reward. | |
| 65 | + |
| 66 | +## 3. Configuration Summary |
| 67 | + |
| 68 | +Settings are defined in `config/config.yaml`. |
| 69 | + |
| 70 | +### a. Subject Info |
| 71 | + |
| 72 | +| Field | Meaning | |
| 73 | +|---|---| |
| 74 | +| `subject_id` | Numeric participant identifier supplied by the shared runner. | |
| 75 | + |
| 76 | +### b. Window Settings |
| 77 | + |
| 78 | +| Parameter | Value | |
| 79 | +|---|---| |
| 80 | +| `window.size` | `[1280, 720]` | |
| 81 | +| `window.units` | `pix` | |
| 82 | +| `window.screen` | `0` | |
| 83 | +| `window.bg_color` | `black` | |
| 84 | +| `window.fullscreen` | `false` | |
| 85 | +| `window.monitor_width_cm` | `35.5` | |
| 86 | +| `window.monitor_distance_cm` | `60` | |
| 87 | + |
| 88 | +### c. Stimuli |
| 89 | + |
| 90 | +| Name | Type | Description | |
| 91 | +|---|---|---| |
| 92 | +| `instruction_text` | text | Chinese instructions describing the short-vs-long mouth judgment task. | |
| 93 | +| `fixation` | text | Central fixation marker shown before each trial and during the ITI. | |
| 94 | +| `face_outline` | circle | Face outline shown in preview, flash, and response screens. | |
| 95 | +| `eye_left` / `eye_right` | circle | Eye markers that stay visible across face screens. | |
| 96 | +| `mouth_short` / `mouth_long` | line | Short and long mouth lines used to define the discrimination. | |
| 97 | +| `practice_feedback_correct` / `practice_feedback_incorrect` | text | Practice-only correctness feedback. | |
| 98 | +| `reward_feedback` | text | Positive reward message with the current total score. | |
| 99 | +| `block_break` | text | Timed block rest screen showing block number and current score. | |
| 100 | +| `good_bye` | text | Final total score shown at task completion. | |
| 101 | + |
| 102 | +### d. Timing |
| 103 | + |
| 104 | +| Phase | Duration | |
| 105 | +|---|---| |
| 106 | +| `timing.pre_face_duration` | `0.5 s` | |
| 107 | +| `timing.mouth_flash_duration` | `0.1 s` | |
| 108 | +| `timing.response_duration` | `2.5 s` | |
| 109 | +| `timing.reward_feedback_duration` | `1.75 s` | |
| 110 | +| `timing.practice_feedback_duration` | `1.75 s` | |
| 111 | +| `timing.iti_duration` | `0.5 s` | |
| 112 | +| `timing.block_break_duration` | `30.0 s` | |
| 113 | + |
| 114 | +### e. Browser Preview Differences |
| 115 | + |
| 116 | +| Parameter | Meaning | |
| 117 | +|---|---| |
| 118 | +| `task.total_blocks` | Shortened to 2 for preview. | |
| 119 | +| `task.trial_per_block` | Shortened to 12 for preview. | |
| 120 | +| `task.total_trials` | Shortened to 24 for preview. | |
| 121 | +| `task.block_seed` | Uses the first two block seeds from the full local task. | |
| 122 | + |
| 123 | +## 4. Methods |
| 124 | + |
| 125 | +The HTML companion presents the same probabilistic reward task as the local PsychoPy build, but inside the shared browser runner. On each trial, participants discriminate whether the mouth is short or long, receive probabilistic reward feedback on scheduled reward-opportunity trials, and accumulate score across correct rewarded responses. The preview keeps the same stage order, scoring meaning, timeout fallback behavior, and counterbalancing logic as the local task while using the current psyflow-web APIs and shortening the run length for browser testing and gallery navigation. |
| 126 | + |
| 127 | +## Run |
| 128 | + |
| 129 | +Open the TaskBeacon browser runner and launch `H000039-probabilistic-reward-task` to inspect the preview. |
0 commit comments