A PsychoPy implementation of the two-step decision task (Daw et al., 2011) with a within-subject cognitive load manipulation.
This project investigates whether concurrent working-memory load shifts behavioural control from model-based toward model-free reinforcement learning, following Otto et al. (2013). Participants complete a two-step task while performing a 1-back letter task during the deliberation period of load blocks.
This project needs Python 3.11 — PsychoPy does not build on newer Pythons,
so the package pins requires-python = ">=3.11,<3.12".
conda installs its own Python 3.11 into an isolated environment, so this
works regardless of which Python you already have — a system Python 3.12/3.13
is fine, conda doesn't touch it. From the repo root:
conda env create -f environment.yml # `stress` env: Python 3.11, wxPython, and the package
conda activate stressOn Ubuntu / Linux, also install one system library — Qt6's startup dialog needs it (wxPython is already handled by conda above):
sudo apt install libxcb-cursor0Verify the install:
pytest -q # expect: 55 passedIf a 3.11 interpreter already exists on your machine, a plain venv works.
(venv cannot create 3.11 for you — install it first via pyenv, Homebrew, or
python.org if you only have a newer Python.)
python3.11 -m venv .venv && source .venv/bin/activate
pip install -e ".[task,dev]" # or ".[dev]" for tests + analysis only (no PsychoPy)On Linux, prefer the conda path above: pip has no wxPython wheel for Linux, so this route would try to compile wxPython from source.
- base (
pip install -e .) — engine + analysis only (NumPy, pandas, scipy, statsmodels, matplotlib) task— adds PsychoPy, needed only to run the live experimentdev— adds pytest, nbconvert, ipykernel (tests + vignette execution)
- Experiment:
python -m two_step_stress.task.run_experiment(needs thetaskextra) - Analysis:
python scripts/run_analysis.py --csv data/raw/sub-<id>_<timestamp>.csv - Tests:
pytest
- Core: NumPy, pandas, scipy, statsmodels, matplotlib
taskextra: PsychoPy (live experiment only)devextra: pytest, nbconvert, ipykernel (tests + vignette execution)
- Daw et al. (2011). Model-based influences on humans' choices and striatal prediction errors. Neuron.
- Otto et al. (2013). The curse of planning. Psychological Science.