Datasets:
pdf pdf |
|---|
cap32 — 32-channel dry-electrode motor imagery EEG
One subject, one low-cost 32-channel dry-electrode cap (TI ADS1299, 250 Hz, WiFi/UDP). Motor imagery and cognitive-task sessions, plus a set of calibrator recordings used to characterise the amplifier.
Code, analysis and reports: github.com/twu3202/EEG_MI
Read §4 before analysing. Two of the five MI sessions have defects that change what you can conclude from them, and they are not visible in the file itself.
1. Quick start
from load_cap32 import load, epochs, to_mne
rec = load("data/mi/cap32_20260725_163251_hands-feet-math.npz")
X, y, t = epochs(rec, tmin=-1.0, tmax=4.0) # (75, 32, 1250) µV, relative to imagery onset
print(X.shape, set(y)) # {'hands', 'feet', 'math'}
raw = to_mne(rec) # or read the paired _raw.fif directly
raw.info["bads"] = ["F7"] # see §4.3
raw.filter(1., 40.).notch_filter(50.).set_eeg_reference("average")
Pure MNE:
import mne
raw = mne.io.read_raw_fif("data/mi/cap32_20260725_163251_hands-feet-math_raw.fif", preload=True)
events, event_id = mne.events_from_annotations(raw)
ep = mne.Epochs(raw, events, event_id, tmin=-1., tmax=4., baseline=(-1., 0.))
python load_cap32.py summarises every session. The loader needs only numpy (MNE optional).
2. Hardware and montage
| Amplifier | TI ADS1299, 24 bit, gain 24 |
| Scaling | µV = counts × 0.02235; full scale ±187500 µV |
| Sampling | 250 Hz |
| Electrodes | dry, 32 channels |
| Reference | on-board floating reference (not re-referenced in these files) |
| Transport | WiFi UDP, 105-byte frames with a 1-byte sequence counter |
Channel order (the row order of data):
FP1 FP2 AF3 AF4 F3 F4 F7 F8 FC1 FC2 FC5 FC6 C3 C4 T7 T8
CP1 CP2 CP5 CP6 P3 P4 P7 P8 PO3 PO4 O1 O2 FZ CZ PZ OZ
The signal is raw: unfiltered, not re-referenced, in µV. The CAR and 1–40 Hz band-pass shown in the acquisition GUI affect the display only and are never written to disk, so you choose the preprocessing. Dry electrodes drift hard — high-pass at 0.5–1 Hz before looking at anything.
3. File format
data/mi/*.npz — the complete source
| key | dtype | shape | meaning |
|---|---|---|---|
data |
float32 | (32, N) | raw µV, unfiltered, pre-CAR |
fs |
float64 | () | 250.0 |
ch_names |
U3 | (32,) | the order above |
marker |
int32 | (N,) | primary label track; the task code at imagery onset, 0 elsewhere |
trigger |
int32 | (N,) | hardware trigger echo (redundant path; all-zero when the firmware does not echo) |
gap |
int8 | (N,) | 1 = this sample was linearly interpolated across a dropped UDP frame — not EEG |
trial_* |
(n_trials,) | trial table: index/code/name/onset/cue_onset/end, in sample indices |
|
meta_json |
str | () | full snapshot of paradigm, timing, link statistics, acquisition settings |
format_version |
int64 | () | 2 (with trial table); the two earliest recordings lack this field |
Prefer the trial table over the label track — it also records where the cue ended and imagery began.
data/mi/*_raw.fif — MNE version
Same signal in volts, with the standard_1020 montage and task names as annotations.
It does not carry the gap track — go back to the npz to exclude interpolated samples.
data/mi/*.json — sidecar
A readable copy of meta_json, so paradigm and link stats can be inspected without opening
the npz.
Task codes
| code | name | kind | code | name | kind | |
|---|---|---|---|---|---|---|
| 1 | rest | rest | 10 | math | cognitive (serial subtraction by 7) | |
| 2 | left | motor (left hand) | 11 | words | cognitive (word association) | |
| 3 | right | motor (right hand) | 12 | song | cognitive (auditory imagery) | |
| 4 | feet | motor (both feet) | 13 | navigate | cognitive (spatial navigation) | |
| 5 | tongue | motor (tongue) | 14 | rotation | cognitive (mental rotation) | |
| 6 | hands | motor (both hands) | 15 | face | cognitive (familiar face) |
Only left / right / hands / rest / feet / math actually occur here.
Trial timing
Four-phase state machine, 9.0 s per trial: fixation 1.5 → cue 1.5 → imagery 4.0 → rest 2.0.
trial_onset points at imagery onset; trial_cue_onset at cue onset. Imagery was
kinesthetic (imagine the feeling of moving, not watching yourself move).
4. Known issues — please read all of these
4.1 The hands-rest session has only 19 usable trials
cap32_20260725_143756_hands-rest lists 50 trials. Only 19 are real.
The acquisition socket had no timeout, so when the board stopped sending, recvfrom blocked
forever and the reader thread died silently. The paradigm kept running, and trials 20–50 were
all logged at the same frozen sample index (the end of the file). They are kept in the table
for provenance but carry no signal.
valid_trials() in the loader filters them; never use len(trials). Only this session is
affected.
4.2 The left/right session has a visual confound
During cap32_20260725_135441_mi, a countdown digit on screen changed four times during
the imagery window. The result: the only significant effect in the whole session was
occipital 13–30 Hz (+46 %, p = 0.023) — that is the digit, not motor imagery. Central
channels showed nothing (p = 0.41).
Usable for studying visual/artifact responses; not usable for evaluating MI decoding. Later sessions keep the countdown inside the cue phase and hold the imagery screen static.
4.3 F7 is an intermittent open circuit
F7 is flagged bad in all four sessions here. But it worked in a separate SSVEP test and has gone green in impedance checks — so this is a connector/lead fault, not scalp contact.
Treat F7 as a bad channel (interpolate or drop), but not as a permanently dead electrode.
cap32_20260722_135310 additionally has FC1 / O2 / OZ bad.
4.4 The subject was MI-naive
This affects interpretation: for an untrained subject, the urge to suppress actual movement plausibly dominated the motor imagery itself. Both engage somatotopically organised sensorimotor cortex, so this offline data cannot separate the two. Do not read any hands-vs-feet effect here as pure motor imagery.
4.5 Interpolated samples
gap == 1 marks linear interpolation, not measurement. Per session: hands-rest 84 samples
(0.198 %, 3 bursts, longest 40 frames = 160 ms); all others 0.
Interpolating rather than skipping is deliberate — silently dropping missing frames compresses the time axis and shifts every downstream latency and frequency estimate. Exclude affected trials when epoching (the loader does by default), or at least know that you did not.
5. Sessions
| file | duration | tasks | usable trials | bad channels | frame loss |
|---|---|---|---|---|---|
cap32_20260721_224212 |
1 s | — | — | — | — |
cap32_20260722_135310 |
31 s | — | — | F7, FC1, O2, OZ | — |
cap32_20260725_135441_mi |
270 s | left / right | 30 (15+15) | F7 | 0.108 % |
cap32_20260725_143756_hands-rest |
170 s | hands / rest | 19 of 50 | F7 | 0.308 % |
cap32_20260725_163251_hands-feet-math |
675 s | hands / feet / math | 75 (25×3) | F7 | 0.045 % |
sessions.csv is the machine-readable version.
6. Calibrator recordings
data/calibrator/ holds the amplifier characterisation: the cap off the head, an external
generator's ground tied to board GND and REF, and a 7 Hz sine driven into one channel
input with every other input left open.
| file | driven | rate | duration |
|---|---|---|---|
cal_7hz_180s.npz |
CH29 (FZ), VHDCI pin 31 | 250 Hz | 179 s |
cal_7hz_fp1_250sps_180s.npz |
CH1 (FP1), VHDCI pin 2 | 250 Hz | 180 s |
cal_7hz_fp1_1000sps_180s.npz |
CH1 (FP1), VHDCI pin 2 | 1000 Hz | 180 s |
cal_7hz_xt7hz_60s.npz, cal_7hz_probe11s.npz |
CH29 (FZ) | 250 Hz | 59 s, 11 s |
Two things to know before using them. First, an open ADS1299 input rails: 25–28 of the 32 channels sit pinned at +187500 µV and carry no information at all. Second, the tone is at 7.0226 Hz, not 7.000 — fitting the nominal frequency over a long record averages a steady 24.5 µV tone down to 0.31 µV.
The terminated channel is a clean characterisation of the front end: 0.092 µV rms
(20–45 Hz), THD 0.22 %, 50 Hz at 0.0045 µV, and the two driven electrodes agree on amplitude
to 0.05 %. No crosstalk was detectable into any other channel; the measurement bounds it at
−24 dB, a bound set by the open inputs' noise rather than by the amplifier.
Full analysis in docs/crosstalk_report.pdf.
7. What has been found so far
From docs/mi_pilot_report.pdf:
- left vs right is not decodable (p = 0.41). A dry cap does not resolve C3 vs C4 finely enough, and that session also carried the visual confound in §4.2.
- hands vs rest is decodable, AUC 0.83–0.87 (n = 19, breadth search over 115 channel × band × pipeline combinations). An earlier 0.90 in the report was best-of-5-bands selection bias and is corrected there.
- hands vs feet separates in mu (8–13 Hz) on 17 central+frontal channels, AUC 0.704, p = 0.040. Exploratory and selection-biased; turning it into a trustworthy result needs a pre-registered re-recording.
- Seven EEG foundation models all lost to the classical pipeline (CSP / Riemannian tangent space + LR, 0.790). The initially top-ranked BENDR (0.733) was an artifact of zero padding — it scored 0.303 once the input was fixed. A representation-health gate (padding fraction, channel coverage, centred variation ratio, effective rank) now runs before any probe score is trusted.
8. Citation and license
CC BY 4.0. If you use this data, please link back to github.com/twu3202/EEG_MI.
@misc{cap32_mi_eeg_2026,
title = {cap32: 32-channel dry-electrode motor imagery EEG},
author = {Twu},
year = {2026},
url = {https://huggingface.co/datasets/Twu31/cap32-mi-eeg}
}
Recordings are from a single consenting adult subject (the author), released deliberately. No clinical or identifying information is included.
- Downloads last month
- 4