Time zeros and loaded subsets¶
A VitalDB time "from the start" depends on which tracks were loaded: loading a subset moves the zero to that subset's first record, seconds or hours later. The arrhythmia database's annotations count from the full file's zero.
| Date | 2026-11-03 |
| Status | current |
| Methods | Reading the stamps, Reading the source |
| Techniques | Beat matching |
| Clocks | Recorder PC clock |
| Devices | Vital Recorder, SNUADC |
| Variables | ECG lead II (SNUADC) |
Data¶
The VitalDB Arrhythmia Database (PhysioNet 1.0.0; 482 cases, about 20 minutes of annotated ECG each, R peaks on a 1/360 s grid) against R peaks detected in SNUADC ECG II; work of the R-peak timing session, consolidated here.
Method¶
Commands (vitaldb-bench): python tools/time_zeros.py run --root $R --ann $ARR --out $W/time_zeros/run2.jsonl (ARR,
the Arrhythmia Database folder; resumable, run in four calls) and python tools/time_zeros.py agg --cases
$W/time_zeros/run2.jsonl --out $W/time_zeros (summary.json). Beat-train alignment: impulse trains in 10 ms bins,
FFT cross-correlation over ±120 s, each annotation matched to the nearest detected R peak within 150 ms, and a
straight line through the matched differences for the offset and drift. Detected R peaks (SNUADC ECG II) are
placed by the ECG track's stamps and counted from its first sample; the offset is compared with that track's start
delay after the file's first record of any track.
Results¶
- A constant offset per case: median −1.55 s (5–95% −4.5 to −0.4 s). In 470 of 482 cases it equals minus the ECG track's start delay after the file's first record to within 10 ms (absolute difference 1.5 ± 1.0 ms), and in 474 to within 35 ms.
- So the annotations count from the full-file zero. The file's zero is its first record of any track (the EVENT track in all 482 files); loading only some tracks, in the vitaldb package or in our reader, moves it.
- After removing it, the median case matches 99.2% of annotations within 150 ms (5th percentile 93.4%), with a median drift of −0.2 ppm (5–95% −1.8 to +2.0).
- The annotations follow the stamps, not the sample count: of the 59 cases with a stamp jump in the ECG within the annotated window, 56 keep the rule to within 10 ms when the detected beats are placed by their stamps; the other three are among the unexplained below.
- Unexplained: three recordings whose ECG starts 198 s to 2.4 h after the file's zero (case 3170, case 6309, case 12), where no offset within ±120 s fits; one case the alignment fails (case 5741, 8% matched); and constant shifts of 25–254 ms in eight cases (largest case 1165, −254 ms).
Discussion¶
Times taken from different track subsets share an axis only in absolute file time. vitaldb-reader reads whole files, so nothing in the builds moves. Beat-train alignment recovers offsets to about 1 ms, and serves as an integrity check and as a second cross-device method; the time-zero convention belongs in a reporting checklist.
Observations it supports¶
| Observation | Status | Summary |
|---|---|---|
| All SNUADC channels share one clock | established | Every SNUADC waveform track of a case (ECG leads, ART, PLETH, CVP) has the same first stamp, the same record timing and the same corrections. They are stamped together. |
| Every time is quantised, and fiducials inherit it | established | A time on a grid of step Δ carries an error of Δ/√12 (1 SD). In VitalDB that is 0.58 ms for a 500 Hz sample, 2.3 ms for BIS EEG, 0.8 ms for the arrhythmia annotations' 1/360 s grid, and up to ±17 ms for PPG fiducials taken on raw samples, which lock to the 33.3 ms frame. |
| Time zero depends on the tracks loaded | established | A file's time zero is its first record of any track. Loading only some tracks moves the zero to their first record: seconds later, and up to hours. |