How the Primus AWP is stamped, and which breath the lag locks onto¶
The Primus airway-pressure stamps are an anchor plus a sample count; the anchor holds across the regular pauses and is reset, with an error of up to about ±2 s, at irregular gaps. Separately, about a quarter to a third of the stretches in the release-wide breath matching were measured a whole breath off, which inflated the apparent per-recording offset. Each stretch's breath is now set from pauses in ventilation or a rule, and the breath error that remains is stated on its own. Most of the AWP's lead over the breath is real on the recorder's timeline, bounded by the PC-stamped PIP numerics.
| Date | 2026-11-11 |
| Status | current |
| Methods | Reading the stamps, One event, two clocks |
| Techniques | Windowed cross-correlation, Null controls |
| Clocks | Primus clock, SNUADC sample clock |
| Devices | Primus anaesthesia machine, SNUADC |
| Variables | Airway pressure (Primus), Capnogram (Primus) |
Background¶
Breath matching gave the Primus a per-recording offset against the SNUADC with a wide spread (a median of about 1.8 s, 5th–95th percentile −0.7 to +5.8 s) that no recording property explained. Two things could produce it: how the recorder stamps the Primus waveform, or the lag measurement itself. Ventilation is regular, so the lag between a breath in the airway pressure and its effect on CVP or ART is only defined to within a breath unless something else picks the breath; the release-wide run finds each window's lag within half a breath of a coarse envelope estimate and starts each window from the previous one, without the breath-identity check of the pilot.
Data¶
The record times of Primus/AWP and Primus/CO2 in all 6,388 recordings (6,360 with AWP), and every Primus track's first record. The per-window AWP-to-reference lags of The Primus ventilator against SNUADC, by breaths's release-wide run (tools/primus_sync_accuracy.py, 19 October; CVP arm in 1,069 recordings, ART arm alone in 948), and the ventilator's set and measured breath rates (Primus/SET_RR_IPPV, Primus/RR_CO2) in the 2,022 recordings with a lag.
Method¶
- Record times. For AWP and CO₂: the share of consecutive records exactly one record (30 samples, 0.48 s) apart, and each gap (stamp step over 5 s) in record lengths.
- Stretches. Per recording (CVP arm, else ART), a line of lag against time in each stretch between AWP pauses: its offset at the stretch start, slope and residual; the step at each pause.
- Breath periods. Each stretch's breath period T from the set rate (else the measured rate); offsets and steps in breath periods; offsets stratified by set rate (strata by rate, not by offset / T, which would bias the comparison; a regression within bands of offset / T was tried and dropped for that reason).
- Two references. In recordings with both arms, ART minus CVP per stretch, in breath periods.
- Gap kind. Each pause step matched to its AWP gap: a whole number of records (the 0.48 s grid carries on) or not (a new anchor).
- Breath identity from the signals (test on two recordings). tools/primus_breath_id.py repeats the
release-wide lag and keeps, per window, the shape correlation's peaks over −3 to +8 s, and per 30-minute block
the pilot's breath-size check (The Primus ventilator against SNUADC, by breaths, breath i against breath i + k). Run on
one recording in the main mode and one placed a breath above it, before any release-wide run
(
work/primus_breath_id/test/; a test on the 2 November inputs, not repeated on the November rates, which do not change the comparison of lags one breath apart within a window). - Breath identity from pauses in ventilation (test on four recordings). tools/primus_vent_events.py finds
runs of no breaths while the AWP stream continues (and the start and end of ventilation), and times the stop
and restart in both signals: the envelopes of the airway pressure and of the reference's breathing band
(0.1–0.7 Hz, the reference low-passed over 2 s) are cross-correlated within ±150 s of each edge over lags −3 to
+12 s. An edge resolves the breath when its peak correlation is at least 0.5 and 0.15 above the correlation one
breath either side. Its lag is compared with the matched lag of the nearest window in the same stretch (within
10 minutes): k = (matched − event) / T (
work/primus_vent_events/test/).
Results¶
- The AWP stamps are an anchor plus a sample count. In 6,312 of 6,360 recordings every record is exactly 0.48 s after the one before; none is stamped on arrival. AWP and CO₂ are anchored separately: their gaps coincide in only 778 recordings.
- The anchor holds across the regular pauses and resets at irregular gaps. Of 13,988 AWP gaps, 74% are a
whole number of records. Pause steps at those (2,791, gaps of about 20–23 s): median +0.01 s (IQR −0.13 to
+0.15). At gaps that are not (726, gaps of 5–38 s): median −0.32 s (IQR −1.33 to +0.80), 87% over 0.25 s
(v4 rates, 11 November;
$W/primus_awp_anchor_v4/gapsteps_summary.json). - About a quarter to a third of stretches are measured a whole breath off. Stratified by set rate, offsets have a main mode at 0.5–1.0 s at every rate and a second mode one breath period above it (18/min: 3.5–4.5 s; 16/min: 4.0–5.0; 14/min: 4.5–5.5; 12/min: 5.0–6.5; 10/min: weak, 6.0–7.5), with a small third. In 1,127 stretches of 459 recordings with both references, ART minus CVP is within a quarter breath in 63% (median +0.26 s) and about one whole breath in 34%, its side modes moving with the set rate; within a stretch the two agree to 0.09 s (SD). Pause steps are rarely whole breaths (under 2% of either gap kind).
- Release-wide, pauses in ventilation say most +1-breath offsets are slips (2 November). 26,022
events in 3,470 recordings; 5,165 edges in 939 recordings resolve the breath (
work/primus_vent_events_v4/summary.json, v4 rates, 10 Nov; 5,166 in 943 before). With CVP (2,316 resolved edges) the event lag is a median 1.7 s (p10–p90 0.6–4.0 s) and, in breath periods, falls away steadily from 0–0.5 breaths with no second mode one breath up, where the matched offsets have one. Where a matched window is within 10 minutes, the matched lag agrees with the event (k within a quarter of 0) for about 70% of CVP edges and is about one breath late for about 20%. The ART events sit later than the matched ART lag by a third to half a breath, so the arterial breathing modulation answers a pause later than its breath-by-breath shape does: ART pauses are not used as a reference. - The first test of pauses (four recordings, before the release-wide run). 20 of 160 event edges resolved, in all four recordings. In three recordings the CVP events give 0.7–1.0 s (and 2.4 s later in one), r 0.7–0.9, matching the matched lag (k about 0); in one, the ART events give 1.5 s against a matched 5.3 s, a breath off. In the recording with both references at about 5.5 s, the strongest events come in a regular series and do not resolve the breath; the one that does gives 0.8–0.9 s against a matched 5.7 s, so there both references were a breath off, probably because both start from the same coarse estimate. Many events are uninformative (correlation under 0.5, or the peak at the edge of the range).
- The pause method has no bias against CVP (bias check, 2 November). Where a CVP event and the matching agree on the breath (1,344 edges, k within a quarter of 0), event minus matched lag is a median +0.006 s (IQR −0.11 to +0.14 s; p10–p90 −0.25 to +0.33 s; v4 rates; 0.000 s on 1,350 edges before), the same at stops and restarts, at weaker and stronger correlations, and with the matched window within 2 minutes. Its spread, about 0.2 s, is far inside half a breath, so a resolved CVP pause fixes the breath. For ART the same comparison gives +0.15 s (IQR −0.05 to +0.33 s, 584 edges; +0.16 s before). The selection (k within a quarter breath) limits the differences to about ±1 s, so this tests bias, not the tails.
- A rule for every stretch, checked by leaving stretches out (2 November). tools/primus_breath_rule.py
(
work/primus_breath_rule_v4/, on the v4 sync windows and vent events, 11 Nov) gives each stretch a whole number of breaths k to take off its matched lag: (1) from its own resolved CVP pauses; (2) carried from a neighbour across a gap that keeps the 0.48 s grid, so that the corrected offset is continuous; (3) otherwise the k that puts its corrected start nearest the main mode, 1.25 s (the median over stretches fixed by their own CVP pauses); (4) recordings with ART only, the same with ART pauses corrected by their +0.15 s. Of 3,119 CVP stretches, 497 are set by their own pauses, 394 by carrying and 2,228 by the main mode (ART-only: 185, 143 and 2,087 of 2,415). Leaving out each of the 497 stretches with its own pauses: trusting the matching (k = 0) is right for 73%; carrying, where it reaches (114), is right for 81%; the main mode (383) for 86%. The rule changes k in 28% of CVP stretches and 45% of ART-only ones. The corrected start offsets of the stretches fixed by their own pauses are a median 1.25 s, IQR 0.64–2.05 s, 5th–95th percentile 0.05–4.58 s (2 November, before the v4 rates: 1.28 s, 0.67–2.08 s): wide, so the main mode cannot be right for all, and about one stretch in seven that relies on it is still a breath off. - The Primus numbers with each stretch on its right breath (2 November; v4 rates 11 November,
work/primus_numbers_v4). tools/primus_numbers.py (which reproduces the earlier numbers exactly with no breath correction): the AWP bias against the breath on CVP is a median −1.478 s per recording (5th–95th percentile −3.540 to −0.449 s, was −1.787 s, −5.782 to +0.693 s), and its spread between recordings 0.694 s (was 1.325 s). Within a stretch on its right breath the matching is as before (robust SD 79 ms). After the rule, 12.2% of windows sit in a stretch still a whole breath off; as a mixture its standard deviation is 1.498 s, and the 95% interval of the matching error with it −4.39 to +4.39 s. The timing forms of primus-awp and primus-co2 carry these, the breath error as its own component.
- Most of the AWP lead is real against the recorder's clock (causality bound, 2 November). The Primus
numerics are stamped by the PC on arrival, so a PIP value cannot carry a stamp before its breath happened. The
release-wide fit of the PIP rule (How the monitor numerics are computed, over the whole release; the peak of the last breath in 924 of
the 1,064 recordings that also have a CVP lag) gives per recording the delay d from the end of a breath's
inspiration on the AWP stamps to the PIP stamp: d = (the device's true delay, never negative) minus the AWP bias,
so the AWP cannot be early by more than d. d is a median 1.40 s (p5–p95 0.35–3.40 s), against the AWP lag
behind CVP of 1.46 s (0.44–3.49 s) in the same recordings. Their difference, d minus the CVP lag, is the
device's true delay less the CVP reference's own delay and the airway-to-CVP physiology: a median −0.16 s
(IQR −0.55 to +0.35 s; d is shorter in 59% of recordings). So most of the lead, up to 1.40 s typically, is
the AWP stamps sitting early on the recorder's own timeline, and a few tenths of a second is the reference and
physiology. Across recordings d rises with the CVP lag (Theil slope 0.47, 95% 0.40–0.54; Spearman 0.37): part
of the spread between recordings is in the AWP stamps, the rest in the reference, the fits or the breath
rule. The PIP fit maps the AWP stamps to recorder time with a drift from each stretch's start, which the CVP
lag does not, so the two differ by a few tenths of a second (
work/primus_anchor_check_v4/numerics_summary.json, v4 rates). - Matching breaths cannot tell which breath is right (null result, two recordings). The shape correlation is nearly equal one breath apart (0.971 against 0.970), and the breath-size check is weak (correlations 0.02–0.40), changes between blocks (k = 0, 1, 0) and disagrees between the two references (CVP mostly k = 0, ART k = 2). In the recording placed a breath above the main mode, CVP (5.2–5.8 s) and ART (5.7–6.2 s) agree at about 5.5 s, so not every offset a breath above the main mode is a slip: some may be real.
- Two attempts to bound the lead from single PIP records did not work (tests, six recordings). Choosing the
delay at which the share of matched PIP records rises fails because peak pressure barely changes between
neighbouring breaths, and using records that match exactly one recent breath gives delays that do not hang
together (
work/primus_anchor_check/test/).
| Parameter | Value | Status | From |
|---|---|---|---|
| Spread of the Primus AWP offset between recordings | 0.694 s (n = 1067) | measured | How the Primus AWP is stamped, and which breath the lag locks onto |
| Primus AWP stamps against the breath on CVP | −1.478 s (p5–p95 −3.54 to −0.449; n = 1067; 1,067 recordings with a CVP arm; median of the corrected window lags per recording, sign reversed) | measured | How the Primus AWP is stamped, and which breath the lag locks onto |
| Upper bound on the Primus AWP lead on the recorder's timeline | 1.40 s (p5–p95 0.35 to 3.40; n = 924; per recording, the release-wide PIP fit (rule: peak of the last breath); d minus the AWP lag behind CVP, median -0.16 s (IQR -0.55 to +0.35 s)) | measured | How the Primus AWP is stamped, and which breath the lag locks onto |
| Primus breath error as a standard uncertainty | 1.498 s (p 12.2%, median breath period 4.286 s; 95% interval of the matching error with it −4.39 to +4.39 s) | estimated | How the Primus AWP is stamped, and which breath the lag locks onto |
| Share of Primus breath matching a whole breath off | 12.2% (n = 37,875; by the rule's step: own CVP pauses 0% (taken as the reference), carried 19.3%, main mode 13.8% (leave-one-out, 497 stretches)) | estimated | How the Primus AWP is stamped, and which breath the lag locks onto |
Discussion¶
The wide per-recording offset was mostly the measurement's: a stretch that starts on the wrong breath stays on it, and its windows agree with each other, so leave-one-out within a stretch cannot see it. Pauses in ventilation are not periodic and fix the breath where they resolve it; with them and the rule, each stretch's breath is now set, and the offset that is left is the anchor's: set when the AWP stream starts or restarts after an irregular gap, kept across the regular pauses, a median −1.478 s against the breath on CVP with a spread between recordings of 0.694 s. The matching places a stretch on its right breath to about 80 ms; the remaining breath error (12.2% of the matched time) is stated as its own component, not folded into one standard uncertainty, because it is a whole breath or nothing. Analyses that need every breath right can keep to stretches with their own resolved CVP pauses.
Limitations¶
The breath of most stretches comes from the rule, not from their own pauses, and the rule is right for about 86% of those it reaches (leave-one-out on 497 stretches with their own pauses, which are themselves the reference). ART pauses answer later than ART matching (+0.15 s where they agree, more in the tails), so recordings with ART only rest on a correction. The breath periods come from the ventilator's settings, sampled every fourth record. Physiology between the airway pressure and CVP is not separated from the stamp offset.
Open questions¶
- A better rule for stretches without their own pauses (next step). The rule is right for about 86% of the stretches it sets without their own pauses. Possible gains: combining carrying with the main mode, using both references where both exist, and other non-periodic events (changes of the set rate, the start of ventilation inside a recording). Each would be checked by the same leave-one-out. Other arterial references (the ECG-to-ART delay, the pulse pressure) do not pick the breath better than the arterial mean (The Primus ventilator against SNUADC, by breaths).
- What sets the anchor (unexplained phenomenon). The AWP stamps sit early on the recorder's timeline by up to 1.40 s typically (bounded by the PC-stamped PIP), and the anchor is reset at irregular gaps with an error of up to about ±2 s. What the recorder anchors to, so that the stamps come out early rather than late, is not known: Vital Recorder's handling of the Primus stream is not documented in the release.