Motor-Processed / README.md
Zachary1150's picture
Update to v0.5 export: 1114 trials, [-1,+2]s @1000Hz , 8 in-ear + 122 scalp; integrated README; drop stale v0.2.0 files
4e654b8 verified
|
Raw History Blame Contribute Delete
7.39 kB
---
license: other
tags:
- eeg
- motor
- in-ear-eeg
- scalp-eeg
- hdf5
---
# Motor-Processed
Processed HDF5 export of the **Wu et al. 2020** in-ear / scalp EEG motor dataset — paired
**in-ear EEG + high-density scalp EEG** recorded while 6 subjects performed a **2-class
left / right hand grasp** task. This repo holds the two processed HDF5 files (one per
modality); the raw Curry-7 recordings live on IEEE DataPort.
- **Paper:** Wu, Zhang, Fu, Cheung, Chan (2020). *An investigation of in-ear sensing for
motor task classification.* J. Neural Eng. 17 066010.
[10.1088/1741-2552/abc1b6](https://doi.org/10.1088/1741-2552/abc1b6)
- **Source (raw) dataset:** IEEE DataPort
[10.21227/j7rq-2p11](https://dx.doi.org/10.21227/j7rq-2p11). License: see the DataPort record.
- **Participants:** 6 adults (2 M / 4 F, ages 22–28), all right-handed. Approved by the City
University of Hong Kong ethics committee (ref. 2-25-201602_01).
## Files
| File | Channels | Shape `(N, C, T)` |
|---|---|---:|
| `motor-in-ear-eeg.h5` | `LF, LB, LOU, LOD, RF, RB, ROU, ROD` (8 in-ear) | `(1114, 8, 3000)` |
| `motor-scalp-eeg.h5` | 122 scalp EEG (Quik-Cap C190, extended 10-05) | `(1114, 122, 3000)` |
`T = 3000` is one 3-second epoch at 1000 Hz. `N = 1114` is the total number of trials — one
sample per trial. The two files are **strictly row-aligned**: sample `i` is the same trial
in both, so the in-ear and scalp views share label, `trial_id`, `split_group_id`, and window
bounds. For an ear-EEG foundation-model benchmark the 8 in-ear channels are the payload and
the 122 scalp channels are the gold-standard reference.
Label distribution (identical for both modalities):
| left | right |
|---:|---:|
| 557 | 557 |
## Preprocessing
Generated with `Ear-EEG-FM-Benchmark/dataset/preprocess_motor.py` (schema/eegfm version
`0.5.0`), reading the raw Curry-7 files directly via MNE `read_raw_curry`:
- **one trial = one sample.** Each trial has a single arrow cue; it is extracted as one
**3-second epoch spanning [−1 s, +2 s] around arrow onset** — the classifier epoch used by
the paper. At the native 1000 Hz this is `T = 3000` samples.
- **0.1–100 Hz band-pass + 50 Hz notch**, applied to the full continuous recording *before*
slicing (avoids per-window filter edge effects).
- **no re-referencing, no resampling (kept at 1000 Hz), original channel names preserved**
(no near-ear renaming). Two modality groups only: 8 in-ear + 122 scalp.
- labels from the Curry event code: **1 → `left` (0)**, **2 → `right` (1)**; Curry system
markers (codes ≥ 1e5) are dropped. The `Trigger` and `REF` channels are used only to read
events and are never stored as data.
- **bad channels are recorded, not repaired:** subject-4's known-broken `FP1` is kept as-is
and listed in the `known_bad_channels_json` file attribute. Any real non-finite samples are
preserved (gaps interpolated only on a temporary filter copy, then the original NaN mask
restored) and reported in `nan_fraction` / `channel_nan_fraction`.
## Task and labels
Each trial (10 s): a fixation cross (3 s; a warning beep 2 s after cross onset) → an **arrow
pointing left or right (pseudo-random) for 4 s**, during which the subject grasps (clenches)
the cued hand. The stored epoch is aligned to the **arrow onset** (= start of the grasp).
| Event code | Class | label |
|---:|---|---:|
| **1** | left hand | 0 |
| **2** | right hand | 1 |
The `1 = left, 2 = right` mapping is stated explicitly in the IEEE DataPort record.
## Channels
The raw recording has 132 channels = **122 scalp EEG + 8 in-ear + Trigger + REF**; the
processed files keep only the 122 scalp and 8 in-ear signals (Trigger/REF dropped). The 8
in-ear electrodes:
| Ear label | Position |
|---|---|
| `LF`, `LB` / `RF`, `RB` | left / right **ear-canal**, front & back |
| `LOU`, `LOD` / `ROU`, `ROD` | left / right **concha** (outer ear), upper & lower |
The scalp montage is the Neuroscan Quik-Cap C190 (extended 10-05):
`T9, FT9, FTT9h, T7, TP7, … C3, Cz, C4 … T8, TP8` (see `ch_names` in the file). All ear +
scalp channels were referenced to a shared scalp REF; scalp GRD was the ground.
## Per-subject / per-run trial counts
Subjects 1, 5, 6 span several chronological runs (`run-01 …`, from the raw `motorN`
recordings); subjects 2, 3, 4 are single-run. Counts parsed from the source event files:
| Subject | Runs | Trials (L / R) | ≈ blocks (÷16) |
|---|---|---:|---:|
| sub-01 | 3 | 240 (120 / 120) | 15 |
| sub-02 | 1 | 160 (80 / 80) | 10 |
| sub-03 | 1 | 160 (80 / 80) | 10 |
| sub-04 | 1 | 80 (40 / 40) | 5 |
| sub-05 | 4 | 234 (117 / 117) | ~14.6 (irregular) |
| sub-06 | 3 | 240 (120 / 120) | 15 |
| **Total** | **13** | **1114 (557 / 557)** | — |
One block = 16 trials; perfectly class-balanced overall.
## HDF5 schema (v0.5)
```text
/data (N, C, 3000) float32 # µV at 1000 Hz
/durations (N,) int64
/nan_fraction (N,) float32
/channel_nan_fraction (N, C) float32
/labels (N,) int64 # 0=left, 1=right
/sample_id (N,) int64
/subject (N,) string # 'sub-01' … 'sub-06'
/session (N,) string # '' (no sessions)
/task (N,) string # 'grasp'
/acquisition (N,) string
/run (N,) string # 'run-01' …
/recording_id (N,) string
/trial_id (N,) int64 # arrow-event index within the run
/event_id (N,) int64 # Curry trigger code (1=left, 2=right)
/split_group_id (N,) int64 # unique per trial (trial-level splitting)
/window_start_sample (N,) int64 # epoch bounds in the continuous recording
/window_stop_sample (N,) int64
/ch_names (C,) string
```
Key attributes: `sfreq` (1000.0), `class_names` (`['left','right']`), `unit` (`uV`),
`eegfm_version` (`0.5.0`), `preprocess_config_json`, `split_group_kind` (`trial`),
`event_id_kind`, `window_reference`, and `known_bad_channels_json` (`{"sub-04":["FP1"]}`).
No block grouping is baked in (`split_group_id` is unique per trial); block structure is
recoverable post-hoc from `window_start_sample` gaps (≈11 127-sample within-block cadence,
larger gaps between blocks).
## Known issues / caveats
- **Task framing is described inconsistently across sources.** The paper says subjects "make
a fist" (motor **execution**); the IEEE DataPort record says "**imagine and grasp**". The
task is stored under the neutral name `grasp` — do not hard-assert MI vs ME.
- **subject-4** `FP1` is a known-broken channel (kept, not repaired — see Preprocessing).
- **subject-5** has 234 trials — not a clean multiple of the 16-trial block (split 80/60/30/64
across 4 runs).
- **Block/subject counts in the paper / DataPort prose are unreliable** (DataPort is marked
"under construction" and disagrees with both the paper and the files). The counts here are
parsed directly from the source event files.
## Provenance
Trial counts, channel lists, and the `1 = left / 2 = right` mapping were read from the raw
`.dap` / `.rs3` / `.ceo` files and cross-checked against the paper and the IEEE DataPort
record. Processed with `dataset/preprocess_motor.py` at eegfm schema `0.5.0`.