File size: 7,102 Bytes
5782785
7392df7
5782785
 
 
 
7392df7
 
5782785
 
 
 
7392df7
5782785
77069ef
 
5782785
 
fd0d2ca
5782785
7392df7
 
77069ef
7392df7
77069ef
 
 
 
5782785
7392df7
5782785
77069ef
 
 
 
 
 
 
 
 
 
 
5782785
 
7392df7
 
77069ef
 
5782785
77069ef
 
 
5782785
fd0d2ca
 
77069ef
5782785
77069ef
5782785
77069ef
 
 
 
 
7392df7
77069ef
fd0d2ca
77069ef
 
 
 
 
 
 
 
 
 
fd0d2ca
 
5782785
7392df7
77069ef
7392df7
 
fd0d2ca
7392df7
 
 
 
 
 
 
 
 
 
 
 
 
 
5782785
7392df7
77069ef
7392df7
 
33cf229
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
license: cc0-1.0
tags:
  - eeg
  - sleep-staging
  - in-ear-eeg
  - scalp-eeg
  - hdf5
---

# EESM23-Processed

Processed HDF5 export of the [EESM23 OpenNeuro dataset](https://doi.org/10.18112/openneuro.ds005178.v1.0.0). It contains paired in-ear EEG and scalp EEG sleep-staging samples from the scored `ses-001` and `ses-002` recordings of 10 subjects.

> **Update:** this export now stores one **30-second epoch per sample** (previously seven 4-second windows). This matches [`EESM19-Processed`](https://huggingface.co/datasets/Zachary1150/EESM19-Processed) and the canonical sleep-staging unit. See "Preprocessing" below.

## Preprocessing

Generated with `Ear-EEG-FM-Benchmark/dataset/preprocess_eesm23.py` using schema/eegfm version `0.5.0`:

- 0.1–100 Hz band-pass and 50 Hz notch filtering on each continuous recording
- no re-referencing, resampling, or channel renaming
- **each labeled 30-second AASM scoring event is stored as one 30-second window** (one sample = one epoch = one label = one prediction — the canonical sleep-staging unit)
- classes: `Wake`, `N1`, `N2`, `N3`, `REM`; `Artefact` events are dropped
- real sensor/data-loss NaN/Inf samples are preserved and recorded in overall and per-channel quality fields
- the ear-EEG and scalp outputs are strictly row-aligned; a session is excluded from both when either modality is missing/unreadable, and a sample is retained only when it exists in both modalities
- recording bounds are checked per 30-second window (the full epoch must lie inside the recording)
- all signal values are stored as `float32` microvolts at 250 Hz (7,500 samples per window)

Brief device data-loss gaps are interpolated before filtering to prevent FIR-kernel contamination, after which the original NaN positions are restored before window selection.

### Why 30-second windows (and how to get 4-second windows)

The 30-second epoch is the unit at which sleep is scored (AASM) and evaluated. Every
reference EEG foundation model that does sleep (BENDR, EEGPT, CBraMod, REVE, and the
EEGPT comparison implementations of LaBraM/BIOT) ingests the full 30-second epoch
downstream and emits one stage prediction per epoch, rather than splitting one label
into independently-scored short windows. Storing 30 s is also a strict superset: the
benchmark loader (`dataset/loader.py`) accepts an `epoch_sec` argument and crops a
shorter window from each stored sample at load time, so a 4-second (or any ≤30 s) view
is available without re-exporting; the reverse is not possible.

## Files

| File | Channels | Shape `(N, C, T)` | Size |
|---|---|---:|---:|
| `eesm23-in-ear-eeg.h5` | RB, RT, LB, LT | `(15,523, 4, 7500)` | 1.74 GiB |
| `eesm23-scalp-eeg.h5` | M1, F3, C3, O1, M2, F4, C4, O2 | `(15,523, 8, 7500)` | 3.48 GiB |

`T = 7500` is one 30-second epoch at 250 Hz. `N` is the number of scored epochs, one sample per 30-second AASM epoch.

Label distribution (identical for both modalities — the samples are row-aligned):

| Wake | N1 | N2 | N3 | REM |
|---:|---:|---:|---:|---:|
| 1,375 | 1,292 | 7,328 | 2,494 | 3,034 |

## Retained and discarded epochs

The source scoring files label 17,074 30-second epochs across the 20 sessions (10
subjects × `ses-001`/`ses-002`): 16,558 carry one of the five retained sleep-stage
labels and 516 are labeled `Artefact`. Each retained epoch becomes one 30-second
sample, so the final files contain **15,523** strictly paired samples per modality.
The exclusions from the 16,558 five-class candidates are:

| Reason | Epochs |
|---|---:|
| Entire `sub-006/ses-002` pair: truncated/unreadable PSG | 1,031 |
| 30-second epoch out of bounds or with no cross-modality partner | 4 |
| **Total excluded** | **1,035** |

(The 516 `Artefact` epochs are outside the five-class task and are never candidates.)

`sub-006/ses-002` is dropped because its scalp PSG file is truncated/unreadable
(`OSError: could not read bytes`). No sample is excluded because it contains NaN/Inf:
the files retain 2,230 in-ear and 1,913 scalp samples with at least one non-finite
value; their indices remain paired even when quality differs between modalities.

## HDF5 schema (v0.5)

```text
/data                 (N, C, 7500) float32
/durations            (N,)         int64
/nan_fraction         (N,)         float32
/channel_nan_fraction (N, C)       float32
/labels               (N,)         int64
/sample_id            (N,)         int64
/subject              (N,)         string
/session              (N,)         string
/task                 (N,)         string
/acquisition          (N,)         string
/run                   (N,)         string
/recording_id          (N,)         string
/trial_id              (N,)         int64
/event_id              (N,)         int64
/split_group_id        (N,)         int64
/window_start_sample   (N,)         int64
/window_stop_sample    (N,)         int64
/ch_names              (C,)         string
```

`event_id` and `split_group_id` both identify the source 30-second scoring row; here each sample *is* one epoch, so there is one sample per split group. For sequence-model sleep staging that needs adjacent-epoch context, group by `subject`+`session` and order by `window_start_sample`.

Important attributes include `sfreq`, `class_names`, `unit`, `eegfm_version`, `preprocess_config_json`, `split_group_kind`, and `window_reference`.

<!-- derived-stores:begin -->
## Derived stores

Re-referenced / cleaned / resampled copies of the native stores, built by `scripts/sbatch/build_stores.sbatch` of github.com/zhikaili1150/Ear-EEG-FM-Benchmark (order: native [-> `dataset/reject_electrodes.py`] -> `dataset/referencing.py` -> `dataset/make_200hz.py`; file-name suffix order = processing order). Full sha256 in `SHA256SUMS`.

| file | rows | bytes | sha256 | attrs | code commit | uploaded |
|---|---|---|---|---|---|---|
| `eesm23-in-ear-eeg-car-200hz.h5` | 15523 | 1496508180 | `3eccf2acc3f1b6ad…` | derived_by=dataset/make_200hz.py; derived_from=data/EESM23-Processed/eesm23-in-ear-eeg-car.h5; derived_src_sfreq=250.0; eegfm_version=0.5.0; reference_scheme=common_average_reference_over_file_channels; sfreq=200.0 | `11a951ef91` | 2026-10-06 |
| `eesm23-in-ear-eeg-car.h5` | 15523 | 1869240088 | `90af29b0b5d749e1…` | derived_by=dataset/make_car.py; derived_from=data/EESM23-Processed/eesm23-in-ear-eeg.h5; eegfm_version=0.5.0; reference_scheme=common_average_reference_over_file_channels; sfreq=250.0 | `11a951ef91` | 2026-10-06 |
| `eesm23-scalp-eeg-car-200hz.h5` | 15523 | 2986964612 | `b848180225d876c1…` | derived_by=dataset/make_200hz.py; derived_from=data/EESM23-Processed/eesm23-scalp-eeg-car.h5; derived_src_sfreq=250.0; eegfm_version=0.5.0; reference_scheme=common_average_reference_over_file_channels; sfreq=200.0 | `11a951ef91` | 2026-10-06 |
| `eesm23-scalp-eeg-car.h5` | 15523 | 3732262232 | `fe7f889316baf810…` | derived_by=dataset/make_car.py; derived_from=data/EESM23-Processed/eesm23-scalp-eeg.h5; eegfm_version=0.5.0; reference_scheme=common_average_reference_over_file_channels; sfreq=250.0 | `11a951ef91` | 2026-10-06 |
<!-- derived-stores:end -->