Skip to content

Estimate PPG pulse envelopes

What it does

Joins basal amplitudes to form the lower envelope and apex amplitudes to form the upper envelope. Both curves share the PPG sample grid.

When to use it

Pass pulse detection times to delineate both fiducials with pulsedel, or supply the apex and basal times you already have. Supply the sampling frequency in Hz and express all times in seconds from the first PPG sample.

Canonical ID: ppg.pulsenv

Inputs

Name Meaning Type Unit Requirements
ppg Sampled PPG waveform. real vector a.u. minimum length: 1; NaN allowed; finite
sampling_frequency Sampling frequency of the PPG in Hz. real scalar Hz greater than: 0; no NaN; finite
t_d Detection times for automatic delineation. real vector s NaN allowed; finite
t_a Precomputed apex times, supplied with basal times. real vector s NaN allowed; finite
t_b Precomputed basal times, supplied with apex times. real vector s NaN allowed; finite

Parameters

Name Meaning Type Unit Default Requirements
window_a Forward apex search window. real scalar s 0.25 greater than: 0
window_b Backward basal search window. real scalar s 0.15 greater than: 0
max_gap Maximum separation before starting a new interpolation segment. real scalar s not applicable greater than: 0

Outputs

Name Meaning Type Unit
lower_envelope PPG amplitudes interpolated between basal points. real vector a.u.
upper_envelope PPG amplitudes interpolated between apex points. real vector a.u.

How it works

Each refined fiducial selects the amplitude and time of its nearest PPG sample. PCHIP interpolates between those anchors. Set max_gap in seconds to split each curve wherever successive valid fiducials of its own type reach that separation. Each segment needs at least two distinct sampled anchors.

Interpretation and limitations

The envelopes can bridge missing PPG samples when there are sufficiently close anchors on either side. Outside supported segments the corresponding curve is NaN. The two curves can begin and end at different samples. They are fitted independently and may cross.

Implementations and technical resources

Python source | MATLAB source

Normative JSON | Validation cases