Skip to content

Finding and placing each PPG frame slip

First of a series characterising the ECG–PPG sawtooth in detail (with The PPG sawtooth and its correction as the overview, The PPG sawtooth's period, its phase jumps, and the reversed sawtooth and Where the PPG sawtooth stops next). A new detector tests every point of a series of three fiducials per pulse for a sharp, persistent step of exactly one frame, confirms it against arterial pressure, uses the grid of the other slips and the earlier fit's slips as priors, and places each slip between two fiducials. Built on a benchmark of 273 recordings and run on all 5,714 with ECG lead II and PLETH. On held-out injected ground truth in 219 recordings it finds 88% of slips (the earlier fit 89%) with 3 false slips (the earlier fit 38) and places them two and a half times as closely. It also finds slips that lose a frame instead of gaining one. A blinded manual labelling of 172 real events, weighted to the whole release, puts its precision at 0.95 against 0.72 for the earlier fit, and its recall at 0.88 against 0.94. The final slip finder and correction, built on this detector, are in The rebuilt PPG slip finder and its correction.

Date 2026-11-13
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 Solar8000 monitor, SNUADC
Variables Plethysmogram (SNUADC), ECG lead II (SNUADC), Arterial pressure (SNUADC)

Background

The earlier fit (physiosync's detect, The PPG sawtooth and its correction) finds slips from a 15-beat running median and gives every tooth its own rate, so each slip is placed to a beat or a few and each tooth's period is free. If the period is constant, or changes slowly, most of that freedom is unnecessary, and the slips could be placed far more closely: a slip is one frame (33 ms) against a beat-to-beat noise of 2–5 ms (panel a of the figure below). This study builds the detector and placement the rest of the series relies on, and checks them against a known sawtooth.

Six panels. A sawtooth delay trace with four one-frame jumps over an hour; a pulse with foot, upstroke and peak marked; fiducial delays stepping up by 33 ms inside one beat; a step fitted against a line and a ramp; three delay traces where two step and the ECG-to-arterial one stays flat; and before and after points with a peaked posterior and a bracket.
How the detector finds and places a slip, drawn on synthetic data (illustrative; no recording). (a) The ECG→PPG delay creeps between slips and jumps by one 33 ms frame at each. (b) Three fiducials per pulse: foot, steepest upstroke and peak. (c) All of them in time order, moved onto one level: a slip falling inside a beat leaves its foot before the step and its upstroke and peak after. (d) The step test: a sharp one-frame step against no step (one straight line) and against the same change spread over 7 beats, as physiology would make it. (e) The arterial check: ECG→PPG and ART→PPG step by a frame while ECG→ART does not, so the step is in the oximeter. (f) Placement: each fiducial near the slip is before or after it, an outlier tolerated; the posterior over the slip's position and its 95% bracket.

Data

  • Full release: every VitalDB case ($W/sawtooth_char/cases_all.json, 6,388) with a continuous stretch of ECG lead II and PLETH of at least 20 minutes and 600 matched beats: 5,714 recordings, the longest such stretch in each, up to 90 minutes (7,789 hours). Arterial pressure where present. The 497 recordings in which the earlier fit (physiosync) finds no slip are the hosts for the injected sawtooths.
  • Benchmark, on which the detector was built: the 300 random cases of the PAT benchmark ($W/pat/cases_pat300.json), 273 recordings, 373 hours (the earlier benchmark's rule gave 266); 22 hosts.

Method

Commands (vitaldb-bench tools/sawtooth_char.py; the scan, slips and mech stages as in SHA-256 46110308f725…, aggregated with 8f5734d273f5…, whose mech-agg reads the parts of a run directly):

  • Full release (WSL, 8 parts, K = 0–7): scan --root $R --cases $W/sawtooth_char/cases_all.json --out $W/sawtooth_char/scan_full --part K --of 8; slips --scan $W/sawtooth_char/scan_full --inj-seeds 6 --out $W/sawtooth_char/full/slips_partK.jsonl --part K --of 8, concatenated into full/slips.jsonl; agg --slips $W/sawtooth_char/full/slips.jsonl --out $W/sawtooth_char/full --ports $W/setups/ports.jsonl --assigned $W/setups/assign/assigned.csv --rates $W/correction_census/census_rates.csv (summary.json, recordings.csv).
  • Benchmark: the same on $W/pat/cases_pat300.json into $W/sawtooth_char/scan and $W/sawtooth_char/bench8 (4 parts). Earlier development runs (bench1–bench7) are not cited.

  • Fiducials. R peaks (5–25 Hz, sub-sample); per pulse the foot, steepest upstroke, peak and half-height on the downslope of the 0.5–10 Hz PLETH (the first three in panel b); the arterial upstroke per beat; the frame clock from the raw PLETH maximum.

  • Detection on the time-ordered series of every foot, upstroke and peak (each moved onto the upstroke's level), so a slip inside a pulse is a clean step between two points (panel c). At every point: the log likelihood ratio of a sharp one-frame step against none (15 beats each side, one straight line through both), the free step size, and a sharp step against the same change spread over 7 beats (panel d). A slip found on its own must also persist (the level 15–40 or 15–75 beats on differs by about a frame), lie in a quiet stretch, and, where the arterial line is clean, step ART→PPG but not ECG→ART (panel e). The same search for downward steps finds slips the other way.
  • Priors. Each run of the recording's slip grid (The PPG sawtooth's period, its phase jumps, and the reversed sawtooth) predicts slips over its own stretch, and the earlier fit's slips (moved from ECG to PPG time) are candidates too; a step there is accepted on looser tests (ratio > 8, not clearly a ramp, about a frame, holding, or too near an end to test that).
  • Placement. The fiducials of three beats either side of a slip, in time order, are each before or after it (a robust likelihood that allows 5% outliers); the posterior over the split gives the most likely gap between two fiducials and a 95% bracket (panel f).
  • Injected ground truth. On the host recordings in which the detector also finds no one-frame step either way (219 of 497; 14 of 22 in the benchmark): one sawtooth written into the PLETH waveform (15–55 ppm, random phase, 33 ms of content held at each slip) and the fiducials found again; the same slips as a shift of the fiducial times; and six more fiducial-shift sawtooths per recording, seeds 0–2 used while setting thresholds (on the benchmark) and 3–5 held out. The earlier fit is run on each for comparison.
  • Manual labels: label-sample --scan $W/sawtooth_char/scan_full --slips $W/sawtooth_char/full/slips.jsonl --out $W/sawtooth_char/labels draws 172 events, stratified by which detector found them (both, each alone, predicted by the grid but not found, downward steps, mid-tooth and slip-free controls; seed 20261102), shown blinded on a private labelling page as ECG→PPG, ART→PPG and ECG→ART per beat. The labeller answers for each delay separately (step up, down, none, can't tell, artefact), with the step's size, position (a point or an interval) and other features; label-eval turns the answers into verdicts through ECG→PPG = ECG→ART + ART→PPG and weights each stratum by its size in the run.

Results

  • Blinded manual labels (172 events, all labelled; $W/label_eval_final/label_eval.json), weighted by the size of each stratum: precision 0.95 for the new detector (16,040 of 16,874 slips real) against 0.72 for the earlier fit (17,027 of 23,769), and recall 0.88 against 0.94 of the real slips in the sampled strata. A real slip is a one-frame step on the PPG side, confirmed by the arterial line where one is clean.
  • Held-out injected ground truth:
Full release: new detector Earlier fit Benchmark: new detector Earlier fit
Sawtooths (slips; recordings) 657 (2,950; 219) 42 (210; 14)
Found 87.9% 89.1% 88% 92%
Found, 30 beats or more from either end 92.1% 93.3% 90% 95%
False slips 3 38 1 8
Placement error, median 0.11 s 0.28 s 0.11 s 0.25 s
Placement error, 95th percentile 0.91 s 2.0 s 1.9 s 2.5 s
95% bracket holds the slip 92.4% — 93% —

The tuning seeds give the same on the full release (87.9%, 4 false; the earlier fit 88.8%, 44). The earlier fit's slips are in ECG time and are moved to PPG time by the typical delay before comparing. - The waveform injection (1,029 slips; benchmark 80) gives 81% found, 5 false, median error 0.15 s, and brackets that hold the slip 90% of the time against 93% for the same slips as a fiducial shift (81%, 1 false, 0.12 s); on the benchmark 85% against 96%. Holding 33 ms of content at the slip distorts the fiducials beside it and the brackets are then a little too narrow. A real slip shows no held segment (The PPG sawtooth and its correction), so the shifted case is probably the closer. - Real recordings: 17,373 upward slips in 4,836 of 5,714 recordings (the earlier fit finds 25,558) and 2,883 downward one-frame steps; 2,427 of the upward slips (14%) are off the recording's grid. By the rule of The PPG sawtooth's period, its phase jumps, and the reversed sawtooth, 2,701 recordings have an upward sawtooth, 203 a downward one, and 2,810 too few steps to say. Upward and downward steps are the same size (median 32.0 and 31.8 ms; a frame is 33.3 ms). Benchmark: 898 upward slips in 234 of 273 (the earlier fit 1,248), 128 downward. - The two detectors disagree on real data far more than on injected slips. The earlier fit finds 47% more slips than the new detector on real recordings, against 1% more on injected ones; 8,668 of its slips have no upward or downward step from the new detector within 60 s. The labels show that most of the earlier fit's extra slips are not slips. - "Sawtooth-free" recordings are not all free: 278 of the 497 recordings in which the earlier fit finds no slip (56%) have one-frame steps, upward or downward, without any injection (benchmark: 8 of 22). - One step or two? A test of two steps against one around each slip prefers two at 59% of real slips and at 45% of injected single steps, on the full release as on the benchmark (59% and 44%), and the split it finds has no preferred share of the frame ($W/sawtooth_char/full_mech/agg/mech_summary.json). The test is too ready to see two steps to say a slip is made of two; the consistent excess on real slips is not explained.

Discussion

On the full release the detector is about as sensitive as the earlier fit (a point lower), an order of magnitude less often wrong on injected data, and places slips two and a half times as closely; the benchmark's figures hold up on fifteen times as many injected sawtooths. Placing a slip to a tenth of a second matters: a slip misplaced by s seconds leaves a whole-frame error for s seconds. On real recordings the earlier fit reports half as many slips again, which its recall on injected slips does not explain; either it finds real slips the new detector misses in disturbed data, or it reports steps that are not slips. The blinded labels show both, but mostly the second. The earlier fit's recall is higher by six points, and its precision is lower by twenty-three.

Limitations

Thresholds were set while looking at the 273 benchmark recordings (which are part of the full release), so the injected test is the honest measure of the detector, and the hosts are recordings without slips, which may not be typical. The injection holds 33 ms of content at each slip; a real slip shows no held segment (The PPG sawtooth and its correction), so the real waveform near a slip may differ from the injected one. The labels sample 172 events, so the weighted precision and recall carry the sampling error of a few dozen events per stratum.

Open questions

  • The last few percent (next step). The slips the earlier fit finds and this detector does not are mostly near the ends of the stretch or coincide with a physiological ramp; a fit of a fixed one-frame step with the ramp as a nuisance term may recover them.
  • Does a real slip distort the pulse beside it? (next step). The brackets are calibrated if not and too narrow if so. The share of fiducials only partly shifted at real slips (recorded per slip) against the two injections would tell.

Code