Code for "Prior Sensory Tuning Orients Error Processing During Sensorimotor Adaptation." Implements the three Bayesian state-space models (M1 Coupling, M2 Dissociation, M3 Dissociation + Decomposition) and the parameter / model recovery pipeline.
[Link to paper — TBD]
Requires Python 3.12 and Poetry.
poetry config virtualenvs.in-project true
poetry env use 3.12
poetry installThe repository ships fitted posteriors and recovery results — see
data/README.md. The figure script runs end-to-end on
shipped data:
poetry run python scripts/analysis/fig34.pyWrites fig3.png (β_R) and fig4.png (β_cog) to figures/.
Raw and trial-level CSVs are not redistributed (see data/README.md
for the expected schemas). With those files in place, the full pipeline is:
Requires data/adaptation_trials.csv.
# M1 (Coupling)
poetry run python scripts/modeling/fit_m1.py --plateau-group-specific --save-posterior
# M2 (Dissociation) and M3 (Dissociation + Decomposition)
poetry run python scripts/modeling/fit_m2_m3.py --plateau-group-specific --save-posterior
# Parameter recovery and model recovery → Table 2
poetry run python scripts/recovery/parameter_recovery.py
poetry run python scripts/recovery/model_recovery.pyHeteroscedastic complete-pooling Bayesian HLM in Stan via cmdstanpy.
Requires scripts/complete_pooling/_preprocessed/pa_long_trials.csv and a
working CmdStan installation (cmdstanpy.install_cmdstan() once).
cd scripts/complete_pooling
poetry run jupyter nbconvert --execute --inplace completepooling_pipe.ipynb
poetry run jupyter nbconvert --execute --inplace completepooling_vis.ipynbcompletepooling_pipe.ipynb fits the CP1–CP8 family and writes posteriors to
./results/CP{L}/posterior.nc plus CP_model_comparison_loo.csv.
completepooling_vis.ipynb reads CP4 / CP7 / CP8 posteriors and renders the
μ and σ panels behind Fig. 2.
See LICENSE.