Skip to content

"Add Support for PPG Amplitude Artifact Detection and Correction (Systolic & Baseline)" #1115

@Noman63ns

Description

@Noman63ns

I would like to propose the addition of a preprocessing step in the "nk.ppg_process()" pipeline that detects and corrects over-amplitude artifacts in PPG signals — specifically:

  1. Abnormally large systolic peaks that exceed a physiological threshold (often due to motion or sensor pressure).

  2. Elevated base point amplitudes between peaks that distort the waveform baseline and may lead to false HRV or peak detections.

The algorithm I’ve implemented uses:

  1. Peak-to-peak segmentation

  2. Local minimum detection to find base points

  3. A thresholding method to identify and correct outliers.

This correction improves signal quality and downstream feature extraction (e.g., HRV, waveform morphology). I’d like to contribute this as a new optional step or utility function. I attach some figures of that:
Image
Image
Image

The proposed feature could be implemented as an optional preprocessing function, either integrated into nk.ppg_process() or as a separate utility (e.g., nk.ppg_artifact_correction()), and follow this general approach:

Signal Cleaning: Use nk.ppg_clean() as usual to preprocess the raw PPG signal.

Peak Detection: Detect systolic peaks using nk.ppg_findpeaks().

Base Point Detection:

For each pair of adjacent peaks, find the local minimum between them (the base point).

This can be done using np.argmin() within the peak-to-peak segment.

Thresholding for Artifacts:

Compute statistical thresholds for both peak and base point amplitudes.

Identify over-amplified peaks and elevated base points as artifacts.

Correction Strategy:

Replace detected artifacts with a corrected value, such as the average of neighboring valid points, or clip to the threshold.

Optionally, mark corrected points in the Info dictionary for visualization and transparency.

Output:

Return the corrected signal along with updated info (e.g., PPG_Corrected, PPG_Artifacts).

Allow users to enable/disable this correction via an argument like artifact_correction=True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions