You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/header-files.md
+62-7Lines changed: 62 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,29 +21,52 @@ A header file contains:
21
21
22
22
Each line must be under 255 characters, and fields are separated by spaces or tabs (except where otherwise noted).
23
23
24
+
Detailed documentation on header files can be found at: [https://physionet.org/physiotools/wag/header-5.htm](https://physionet.org/physiotools/wag/header-5.htm)
25
+
24
26
---
25
27
26
28
## Record Line
27
29
28
30
The first non-comment line is the **record line**, which provides metadata about the overall record. It includes:
29
31
30
32
| Field | Description |
31
-
|:------|:------------|
33
+
|:------|:-----------|
32
34
| Record name | Identifier for the record (letters, digits, underscores only). |
33
35
| Number of segments (optional) | If present, appended as `/n`. Indicates a multi-segment record. |
34
36
| Number of signals | Number of signals described in the header. |
35
37
| Sampling frequency (optional) | Samples per second per signal. Defaults to 250 if omitted. |
36
38
| Counter frequency (optional) | Secondary clock frequency, separated from sampling frequency by a `/`. |
37
39
| Base counter value (optional) | Offset value for counter, enclosed in parentheses. |
38
-
| Number of samples (optional) | Total samples per signal. |
40
+
| Number of samples (optional) | Total samples per signal when `samps_per_frame`=1; total frames otherwise. |
39
41
| Base time (optional) | Start time of the recording (`HH:MM:SS`). |
40
42
| Base date (optional) | Start date (`DD/MM/YYYY`). |
41
43
42
-
**Example:**
44
+
### Examples
45
+
46
+
**Basic header (uniform sampling frequency):**
47
+
record 100 from the [MIT-BIH database](https://www.physionet.org/content/mitdb)
48
+
```text
49
+
100 2 360 650000
50
+
```
51
+
52
+
-`100`: Record name (must match the filename prefix).
53
+
-`2`: Number of signals in the record.
54
+
-`360`: Sampling frequency in Hz.
55
+
-`650000`: Number of samples for each signal.
56
+
57
+
**Multi-frequency header (unique sampling rates per channel):**
58
+
43
59
```text
44
-
100 2 360 650000 12:00:00 01/01/2000
60
+
12345 3 62.5 625 12:00:00 30/01/1989
45
61
```
46
62
63
+
-`12345`: Record name (must match the filename prefix).
64
+
-`3`: Number of signals in the record.
65
+
-`62.5`: Sampling frequency in Hz.
66
+
-`625`: Number of samples. For multi-frequency records this is the total frames for each signal.
67
+
-`12:00:00`: Base time.
68
+
-`30/01/1989`: Base date.
69
+
47
70
---
48
71
49
72
## Signal Specification Lines
@@ -67,12 +90,43 @@ Each signal has its own line immediately following the record line (for single-s
67
90
| Block size (optional) | Number of samples per block (for formats supporting block I/O). |
68
91
| Description (optional) | Free-text description of the signal (e.g., lead name `ECG Lead II`). |
69
92
70
-
**Example:**
93
+
### Examples
94
+
95
+
**Basic header (uniform sampling frequency):**
96
+
record 100 from the [MIT-BIH database](https://www.physionet.org/content/mitdb)
71
97
```text
72
-
100.dat 212 200 11 1024 995 0 MLII
73
-
100.dat 212 200 11 1024 995 0 V5
98
+
100.dat 212 200 11 1024 995 -22131 0 MLII
99
+
100.dat 212 200 11 1024 1011 20052 0 V5
74
100
```
75
101
102
+
-`100.dat`: File name of the signal file.
103
+
-`212`: Format samples are stored in (12-bit two's complement).
104
+
-`200`: ADC gain (i.e. number of digital values per physical unit).
105
+
-`11`: ADC resolution (bits).
106
+
-`1024`: ADC zero value.
107
+
-`995`, `1011`: Initial value.
108
+
-`-22131`, `20052`: Checksum (sum of all signal samples modulo 2^16).
109
+
-`0`: Block size.
110
+
-`MLII`, `V5`: Description (e.g., signal lead names).
111
+
112
+
**Multi-frequency header (unique sampling rates per channel):**
113
+
```text
114
+
12345.dat 16x4 200/μV 12 0 0 2178 0 ECG
115
+
12345.dat 16x2 16/mmHg 12 0 0 3497 0 ICP
116
+
12345.dat 16x1 2500/Ohm 12 0 0 1366 0 RESP
117
+
```
118
+
119
+
-`12345.dat`: File name of the signal file.
120
+
-`16`: Format samples are stored in (16-bit integers).
121
+
-`x4`,`x2`,`x1`: 4, 2, and 1 samples per frame, respectively. This indicates that the ECG signal has `157 * 4 = 628` samples while the ICP signal has 314 samples and the RESP signal has 157 samples.
122
+
-`200/μV`, `16/mmHg`, `2500/Ohm`: ADC gain (i.e., number of digital values per physical unit).
123
+
-`12`: ADC resolution (bits).
124
+
-`0`: ADC zero value.
125
+
-`0`: Initial value.
126
+
-`2178 `, `3497`, `1366`: Checksum (sum of all signal samples modulo 2^16).
127
+
-`0`: Block size.
128
+
-`ECG`, `ICP`, `RESP`: Description (e.g., signal lead names).
129
+
76
130
---
77
131
78
132
## Comments and Info Strings
@@ -87,4 +141,5 @@ Each signal has its own line immediately following the record line (for single-s
87
141
88
142
- A header file may describe signals stored in multiple files or multiple signals in a single file.
89
143
- Fields like sampling frequency, counter frequency, and base time/date improve time-aligned analysis but are optional.
144
+
- Storage format options and details can be found at: [https://physionet.org/physiotools/wag/signal-5.htm](https://physionet.org/physiotools/wag/signal-5.htm)
90
145
- Multi-segment records use a slightly different structure (described separately).
0 commit comments