systole.correction.correct_ectopic_peaks#
- systole.correction.correct_ectopic_peaks(peaks: List | ndarray, idx: int, signal: List | ndarray | None = None) ndarray [source]#
Correct pseudo ectopic heartbeat in boolean peak vector.
- Parameters:
- peaks
Boolean vector of peaks detection.
- idx
Index (sample number) of the peaks corresponding to the etopic interval (i.e. the long interval following the short interval).
- signal
(Optional) The raw ECG or PPG signal. If provided, the pseudo-ectopic interval is re-estimated using this signal.
- Returns:
- clean_peaks
Corrected boolean vector of peaks.
- Raises:
- ValueError
If the artefact index is outside the range of the peaks vector.
Notes
This function aims to correct misdetection or R wave (e.g. in the T wave) that are labelled as ectopic beats by the artefact detection algorithm, in the form of a short interval followed by a long interval. If the raw (ECG or PPG) signal is provided, the most probable real peak location will be re-estimated using this signal.