The PPG sawtooth and its correction¶
The ECG→PPG delay creeps at 18–52 ppm and jumps up by one 33.3 ms frame at each slip, every 11–31 minutes. First of the sawtooth series. Its first correction, a tooth-by-tooth fit (physiosync's detect method), was essentially exact where confident on injected test data; it has been replaced as the atlas default by the rebuilt correction of The rebuilt PPG slip finder and its correction, which brings finger PAT closer to arterial PAT, and is kept here as history.
| Date | 2026-10-10 |
| Status | current |
| Methods | Clocks carried in the signal |
| Techniques | Beat matching, Phase-step detection, Null controls |
| Clocks | Pulse oximeter frame clock, SNUADC sample clock |
| Devices | SNUADC, Solar8000 monitor |
| Variables | Plethysmogram (SNUADC), ECG lead II (SNUADC), PPG sawtooth chained tooth, PPG sawtooth tooth, PPG timing quality |
Background¶
SNUADC samples ECG and PPG together, so its own drift cannot move one against the other. Any drift between them comes from inside the monitor.
Data¶
The same 266 cases (378 hours); a benchmark of a known sawtooth injected into 35 real recordings without one.
Method¶
The first correction (10 Oct 2026; history). The atlas now corrects with the rebuilt slip finder of
The rebuilt PPG slip finder and its correction (physiosync 0.3.3, fit_ecg_ppg_delay(method="rebuilt")): one-frame slips only,
confirmed by the pulse shape and the arterial line, each tooth closing exactly one frame between its slips; tiers A,
B and C corrected, U and I (isolated slips, no sawtooth) not. What follows describes the first correction,
method="detect", which physiosync keeps as its default for other data.
The PPG delay is modelled as D(t) = offset + frame × (slips so far) − creep. The fit detects resets in the beat-matched pulse arrival time and keeps a slip only if it is one frame and falls between two beats (physiological changes build over several beats); puts back missed slips only where a gap holds whole teeth and the data show a step; gives each tooth the creep rate frame ÷ length, so a wrong slip distorts only its own tooth; and shifts the median to the adopted pulse arrival time. Each tooth gets a confidence tier: A (rate corroborated, clean slips, low noise), B, C, N (no sawtooth evident for 45 minutes or 1.5 teeth) or U (possibly affected, not corrected).
Figures. ppg-correction-check: python tools/ppg_sawtooth_figures.py inputs --per-case
$W/results/pat/ppg_correction_check_per_case.json --out $W/ppg_correction_check, then python tools/ppg_fix_check.py --root $R --cases
$W/ppg_correction_check/cases266.json --out $W/ppg_correction_check/check_tierC.jsonl --adopted-pat 0.27 --priors
$W/ppg_correction_check/priors266.json --apply-min-tier C (resumable; about 11 minutes), then python
tools/ppg_sawtooth_figures.py check --scan $W/ppg_correction_check/check_tierC.jsonl --units
$W/results/sync_full/units.csv --modes $W/results/sync_full/snuadc_mode_label.json --out $W/ppg_correction_check.
The case list and the per-case setup priors are those of the saved first run
(results/pat/ppg_correction_check_per_case.json, whose priors file was not kept). pat-timeseries: python
tools/ppg_sawtooth_figures.py timeseries --root $R --cases 1912 2 2153 2611 476 3964 4194 5581 489 1599 1759 1858
--out $W/pat_timeseries.
Results¶
- One frame per slip: the step has a median of 32.4 ms (IQR 30.4–34.8); other sizes are no more common than in a sign-flipped control.
- Regular: slips recur every frame ÷ rate, stable to about 0.2 ppm; a few recordings creep by about 1 ppm over 90 minutes.
- Fixed per setup, 18–52 ppm, unrelated to the SNUADC drift (r = 0.09 on the cases with three or more kept slips, 0.13 with the rebuilt correction of The rebuilt PPG slip finder and its correction; a first, unsaved estimate of −0.22 is not reproduced) or the frame clock (r = 0.13). One port hosts two PPG sources: step-mode cases at 51 ppm and frequent-mode cases at 27 ppm.
- Invisible in the waveform: no repeated or held 33 ms segment at a slip (3.5% against 5% by chance).
The first correction's tiers on injected test data (history; the rebuilt correction's are in The rebuilt PPG slip finder and its correction):
| Tier | Share of injected time | Error after correction (RMS) | Time over 10 ms | Share of real time |
|---|---|---|---|---|
| A | 60% | 0.2 ms | 0.1% | 17.0% |
| B | 17% | 1.6 ms | 3.7% | 16.6% |
| C | 19% | 5.3 ms | 14% | 26.8% |
| U (not corrected) | 3% | 9.0 ms | 34% | 24.5% |
| N (no sawtooth) | 0.5% (wrongly) | — | — | 15.0% |
Uncorrected, the injected sawtooth has an RMS of 9.5 ms.
| Parameter | Value | Status | From |
|---|---|---|---|
| PPG sawtooth rate | 18–52 ppm by setup | measured | The PPG sawtooth and its correction |
| PPG slip size | 32.4 ms (IQR 30.4 to 34.8) | measured | The PPG sawtooth and its correction |
Discussion¶
Under the first correction, tiers A and B covered 34% of the real time analysed (378 h in 266 recordings; the 10 Oct ppg_sawtooth_labels.csv), 49% with the stretches where no sawtooth is running, and its benchmark was optimistic: its physiology came from quiet recordings. Tested end to end against the arterial line in 2,976 recordings, it narrowed the spread of finger minus arterial PAT in sawtooth recordings from a median of 14.0 to 11.2 ms; the rebuilt correction narrows it to 9.5 ms, though it leaves more recordings worse than uncorrected (7.3% against 2.9%; The rebuilt PPG slip finder and its correction). The PPG timing labels now carry the rebuilt correction: in 265 of the 266 recordings, 861 of 1,199 teeth are corrected (A 749, B 98, C 14), and each label carries its tier, so a user can choose how much time to trust (PPG sawtooth tooth, PPG timing quality).
The last step of the fit, shifting each recording's median to the adopted pulse arrival time, also removes real differences between patients. One device delay for the PLETH across the release later showed that one global delay (385 ms, PPG hardware delay) fits the whole release, so the atlas removes that instead and keeps those differences (Pulse arrival time in two correction steps).
Observations it supports¶
| Observation | Status | Summary |
|---|---|---|
| The ECG→PPG delay is a sawtooth | established | Inside the oximeter the PPG content creeps 18–52 ppm against its 30 Hz frames; every 11–31 minutes the delay steps up by one 33 ms frame (no repeated frame shows in the waveform). The rate is fixed per recording setup. |
| The PLETH arrives about 0.4 s late | established | Raw R-to-PPG-foot pulse arrival time in VitalDB has a median of 0.64–0.71 s, about 0.4 s more than physiology: the monitor's buffering and filtering. One delay fits the whole release: no clusters by setup, SNUADC port or case order (One device delay for the PLETH across the release). |
| The plethysmogram is built in 30 Hz frames | established | The SNUADC PLETH waveform comes from the oximeter in 33.3 ms frames, smoothed to 500 Hz. Its content changes once per frame, on the oximeter's own clock, about 0.4 s after the finger. |
Limitations¶
The outputs of tier_bench.py and frame_an.py behind the benchmark and the correlations were not saved; the hours, the per-setup rates and the steps after correction are checked against saved files.
Worked examples¶
| Example | Side | Status | Summary |
|---|---|---|---|
| Pulse arrival time against blood pressure, before and after synchronisation | time | current | In 3,270 recordings, PAT tracks systolic pressure only once each pulse is paired with its own beat: the hourly correlation moves from a mean of −0.05 to −0.21 (88% of recordings negative), reproducing Ruffolo et al. 2025 in a second dataset; paired naively, PAT is a heart-rate signal. |
| Pulse arrival time in two correction steps | time | current | As stored, the ECG-to-finger PAT in VitalDB is about 0.72 s, far beyond any physiological value, because a device delay of about 0.39 s and a frame-slip sawtooth sit inside it. Removing the sawtooth narrows finger minus arterial PAT from 13.6 to 11.1 ms in the median case, and removing one global delay brings PAT to about 0.33 s to the upstroke, keeping the differences between patients. |
Code¶
- physiosync:
physiosync/ecg_ppg.py,physiosync/slips.py,physiosync/labels.py - vitaldb-bench:
tools/tier_bench.py,tools/ppg_fix_check.py,tools/ppg_sawtooth_figures.py
Figures¶