Code for "Single-Trial EEG Shapes Confidence and Speed" The data are the open OpenNeuro data set ds004295 (Stolz, Pickering, & Mueller, 2022; https://doi.org/10.18112/openneuro.ds004295.v1.0.0). Files File -What it does - `extract_eeg_full.py` | Preprocessing (ICA, filtering, robust re-reference) and all single-trial, block and person EEG measures → `trials_full.csv`, `blocks_full.csv`, `person_full.csv`, `waveforms_full.csv` - `extract_eeg.py` - `--behavior-only`: builds `behavior_corrected.csv` from `RevEx1_behavioralData.mat` (corrects the task-label error) and checks it against the EEG markers - `check_ds004295_behavior.py` -Stand-alone verification of the three issues in the shared behavioural files -`qlearning_ds004295.py` -Reinforcement-learning models (RW, RW2, RW2K and two P3 models) → `results/qlearning/` - `decision_ds004295.py` | Decision-time EEG (CPP, pre-response theta), whole-scalp decoding, GLM-HMM → `paper2_addon/` -`ewos_analysis.R` | All statistics, tables and figures (Parts A–E, see the header of the script) -`run_all.bat` | Windows: runs everything in order and skips finished steps Run order ``` python extract_eeg_full.py --bids --out python extract_eeg.py --behavior-only --bids --out [--beh-mat ] python qlearning_ds004295.py --data python decision_ds004295.py --bids --out --q /results/qlearning Rscript ewos_analysis.R - set DATA_DIR and PART at the top, or the environment variables DS_DIR and DS_PARTICIPANTS ``` `decision_ds004295.py` imports `extract_eeg_full.py`, so both must be in the same folder. - Outputs (in DATA_DIR) - `results/` - Models 1–5 and robustness analyses (Part A); `results/choice_path/` - RL, confidence and loss-sensitivity analyses (Part B) - `results_paper2/` - tests across the choice cycle, decoding summary, latent states (Part C) - `results/combined/` - Figures 1–5 and S1, numbered as in the manuscript (Part D) - `results/Results_APA.docx` - APA-formatted summary of Parts A and B (Part E) -Requirements Python ≥ 3.10: `mne` (≥ 1.6), `mne-bids`, `numpy`, `scipy`, `pandas`, `scikit-learn`, `python-picard`; optional `specparam` (or `fooof`), `matplotlib`. R ≥ 4.3: `dplyr`, `tidyr`, `lme4`, `lmerTest`, `ordinal`, `emmeans`, `performance`, `glmmTMB`, `ggplot2`, `patchwork`, `officer`, `flextable` (missing packages are installed automatically). -Notes - Random seeds are fixed in every script (ICA `random_state = 97`; analyses `20261122`/`20261123`). - The strict artifact rule (`EEG_Kept`) reproduces the earlier extraction exactly; other rules are compared in the artifact multiverse (Part A, R6). - GLM-HMM state names are assigned from the fitted weights (largest value weight = `engaged`; largest previous-choice weight among the others = `perseverative`; remaining = `weakly_guided`). The analyses select states by their weights, not by their names

Evaluation Without Selection Single-Trial EEG

Amin Alvani
Software
2026

Abstract

Code for "Single-Trial EEG Shapes Confidence and Speed" The data are the open OpenNeuro data set ds004295 (Stolz, Pickering, & Mueller, 2022; https://doi.org/10.18112/openneuro.ds004295.v1.0.0). Files File -What it does - `extract_eeg_full.py` | Preprocessing (ICA, filtering, robust re-reference) and all single-trial, block and person EEG measures → `trials_full.csv`, `blocks_full.csv`, `person_full.csv`, `waveforms_full.csv` - `extract_eeg.py` - `--behavior-only`: builds `behavior_corrected.csv` from `RevEx1_behavioralData.mat` (corrects the task-label error) and checks it against the EEG markers - `check_ds004295_behavior.py` -Stand-alone verification of the three issues in the shared behavioural files -`qlearning_ds004295.py` -Reinforcement-learning models (RW, RW2, RW2K and two P3 models) → `results/qlearning/` - `decision_ds004295.py` | Decision-time EEG (CPP, pre-response theta), whole-scalp decoding, GLM-HMM → `paper2_addon/` -`ewos_analysis.R` | All statistics, tables and figures (Parts A–E, see the header of the script) -`run_all.bat` | Windows: runs everything in order and skips finished steps Run order ``` python extract_eeg_full.py --bids --out python extract_eeg.py --behavior-only --bids --out [--beh-mat ] python qlearning_ds004295.py --data python decision_ds004295.py --bids --out --q /results/qlearning Rscript ewos_analysis.R - set DATA_DIR and PART at the top, or the environment variables DS_DIR and DS_PARTICIPANTS ``` `decision_ds004295.py` imports `extract_eeg_full.py`, so both must be in the same folder. - Outputs (in DATA_DIR) - `results/` - Models 1–5 and robustness analyses (Part A); `results/choice_path/` - RL, confidence and loss-sensitivity analyses (Part B) - `results_paper2/` - tests across the choice cycle, decoding summary, latent states (Part C) - `results/combined/` - Figures 1–5 and S1, numbered as in the manuscript (Part D) - `results/Results_APA.docx` - APA-formatted summary of Parts A and B (Part E) -Requirements Python ≥ 3.10: `mne` (≥ 1.6), `mne-bids`, `numpy`, `scipy`, `pandas`, `scikit-learn`, `python-picard`; optional `specparam` (or `fooof`), `matplotlib`. R ≥ 4.3: `dplyr`, `tidyr`, `lme4`, `lmerTest`, `ordinal`, `emmeans`, `performance`, `glmmTMB`, `ggplot2`, `patchwork`, `officer`, `flextable` (missing packages are installed automatically). -Notes - Random seeds are fixed in every script (ICA `random_state = 97`; analyses `20261122`/`20261123`). - The strict artifact rule (`EEG_Kept`) reproduces the earlier extraction exactly; other rules are compared in the artifact multiverse (Part A, R6). - GLM-HMM state names are assigned from the fitted weights (largest value weight = `engaged`; largest previous-choice weight among the others = `perseverative`; remaining = `weakly_guided`). The analyses select states by their weights, not by their names
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11576/2785254
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus ND
  • ???jsp.display-item.citation.isi??? ND
social impact