Skip to content

Detection refinement to local ECG peaks

What it does

This utility moves each candidate detection to the maximum ECG sample inside a local search window.

When to use it

Use it to refine approximate ECG detections after a detector has identified the correct neighborhood but not the exact local peak sample.

Canonical ID: tools.snap_to_peak

Inputs

Name Meaning Type Unit Requirements
ecg Sampled ECG signal used to refine candidate detections. real vector a.u. minimum length: 2; NaN allowed; finite
detections Candidate sample positions to move onto nearby ECG maxima. real vector sample greater than: 0; NaN allowed; finite

Parameters

Name Meaning Type Unit Default Requirements
window_size Search radius around each candidate detection. real scalar sample 20 greater than: 0

Outputs

Name Meaning Type Unit
refined_detections Detection positions moved to the selected local ECG maxima. real vector sample

Interpretation and limitations

The method assumes the desired fiducial is the local maximum. Wide windows can jump to a neighboring wave, while narrow windows may not reach the intended peak. Missing samples inside the search region are ignored according to the defined NaN behavior.

Implementations and technical resources

Python source | MATLAB source

Normative JSON | Validation cases