# external_data/

External datasets. The organisers allow external data (2026-09-30).
Download: `bash download.sh` (resumable), log in `download.log`.

| Folder | Dataset | Contents | Use |
|---|---|---|---|
| AASD/ | Auditory Attention Switching Dataset (Sci. Data 2026, Zenodo 17413336, CC-BY-4.0) | 18 subjects, Mandarin, spontaneous switches | evaluate on REAL switches |
| Broderick2018/ | Cocktail Party (Dryad 10.5061/dryad.070jc, CC0) | 33 subjects x 30 x 60 s, 2 dichotic audiobooks, 128 ch | extra 2-talker training data |
| Fuglsang2020/ | DTU normal-hearing and hearing-impaired (Zenodo 3618205, CC-BY-4.0) | 44 subjects, 2 competing talkers | extra 2-talker training data |

All of it is converted with the compliant pipeline:
- envelope: gammatone 150-4000 Hz with 1.5-ERB spacing, then |.|^0.6, summed, at 128 Hz. This matches the supplied envelopes at r = 0.98-0.99; see ../envelope_reverse.
- then filtfilt Butterworth order 2, 1-9 Hz, down to 32 Hz;
- then CAR and one full-trial z-score.

**Broderick2018:** Dryad blocks scripted downloads. The API returns 401 without a bearer token, and the web file stream returns 403.
Two ways to get it:
- Download `Cocktail Party.zip` (2.8 GB) in a browser from https://datadryad.org/dataset/doi:10.5061/dryad.070jc and put it in `Broderick2018/raw/`.
- Or create a free Dryad API account and give its token to `download.sh`.

## SparrKULee (KU Leuven, Accou et al. 2024) — extra training / pretraining
- Access: account from KU Leuven (credentials kept OUTSIDE the repo in `/root/.netrc_sparrkulee`, chmod 600).
- `SparrKULee/download_sparrkulee.py`: crawls `derivatives/preprocessed_eeg` (64 ch, 64 Hz, authors' preprocessing)
  and `derivatives/preprocessed_stimuli/*_-_envelope.npy` (~19 GB), resumable, `.ok` markers, `raw/ALL_DONE`.
- `SparrKULee/convert_sparrkulee.py`: same compliant pipeline as `mat_reac`; single speaker, so `env[:,1]` is a
  mismatched negative (own envelope shifted by half the run); EEG stored as float16 `<key>_eeg.npy` (mmap).
- Unattended pipeline: `decoder_lodo/runners/sparrkulee_chain.sh` (tmux window `spk`): download -> convert ->
  S1 pretraining (`pretrain_sparrkulee.py`) + S2 mixing (`--extra-frac SparrKULee=0.25`) -> S1 fine-tuning
  (`--init-from models/pretrain_spk_vlaai_ws_s*.pt`).
