biopsykit.signals.ecg.outlier_correction package

Outlier correction for R-peaks in ECG signals.

class biopsykit.signals.ecg.outlier_correction.BaseRPeakOutlierDetection[source]

Bases: Algorithm

Initialize new Outlier Correction Algorithm.

points_: DataFrame
detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierCorrection(*, imputation_type='linear_interpolation', imputation_params=None)[source]

Bases: Algorithm

Initialize new RPeakOutlierCorrection algorithm instance.

Parameters
  • imputation_type (str, optional) –

    The type of imputation to use. Options are:
    • ”linear_interpolation” (default): Use linear interpolation to fill in missing values.

    • ”moving_average”: Use moving average to fill in missing values. The window size (centered) can be

    specified in the imputation_params dictionary with the key “window_size”.

    Default: “linear_interpolation”

  • imputation_params (dict, optional) – additional parameters for the imputation method. For “moving_average”, the window size can be specified with the key “window_size”. Default: None

IMPUTATION_TYPES: ClassVar[Sequence[str]] = ['linear_interpolation', 'moving_average']
ecg_processed_: DataFrame
points_: DataFrame
imputation_type: str
imputation_params: dict[str, Any]
correct_outlier(*, ecg, rpeaks, outlier_detection_results)[source]

Correct outliers in the R-peak data.

Parameters
  • ecg (DataFrame) – The ECG data.

  • rpeaks (DataFrame) – The R-peak data.

  • outlier_detection_results (list of DataFrame) – The results of the outlier detection algorithms.

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierCorrectionHrvLipponen2019[source]

Bases: Algorithm

Initialize new RPeakOutlierCorrectionHrvLipponen2019 algorithm instance.

points_: DataFrame
correct_outlier(*, rpeaks, sampling_rate_hz)[source]

Correct outliers in the R-peak data.

Parameters
  • rpeaks (DataFrame) – The R-peak data. The DataFrame contains the R-peak locations, with the index representing the heartbeat IDs and the column “r_peak_sample” containing the R-peak samples.

  • sampling_rate_hz (float) – The sampling rate of the ECG signal in Hz.

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierDetectionBerntson1990[source]

Bases: BaseRPeakOutlierDetection

Initialize new RPeakOutlierDetectionBerntson1990 algorithm instance.

detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierDetectionCorrelation(correlation_threshold=0.3)[source]

Bases: BaseRPeakOutlierDetection

Initialize new RPeakOutlierDetectionCorrelation algorithm instance.

Parameters

correlation_threshold (float, optional) – Threshold for the cross-correlation coefficient below which a beat is considered an outlier. Default: 0.3

correlation_threshold: float
detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierDetectionPhysiological(hr_thresholds=(45, 200))[source]

Bases: BaseRPeakOutlierDetection

Initialize new RPeakOutlierDetectionPhysiological algorithm instance.

Parameters

hr_thresholds (tuple of int, optional) – Tuple containing the lower and upper heart rate thresholds in beats per minute (bpm). Default: (45, 200)

hr_thresholds: tuple[int, int]
detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierDetectionQuality(quality_threshold=0.4)[source]

Bases: BaseRPeakOutlierDetection

Initialize new RPeakOutlierDetectionQuality algorithm instance.

Parameters

quality_threshold (float, optional) – Threshold for the signal quality below which a beat is considered an outlier. Default: 0.4

quality_threshold: float
detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierDetectionRRDiffIntervalStatistics(rr_diff_statistics_threshold=1.96)[source]

Bases: BaseRPeakOutlierDetection

Initialize new RPeakOutlierDetectionRRDiffIntervalStatistics algorithm instance.

Parameters

rr_diff_statistics_threshold (float, optional) – Threshold for the successive RR interval statistics above which a beat is considered an outlier. Default: 1.96 (95% confidence interval)

rr_diff_statistics_threshold: float
detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –

class biopsykit.signals.ecg.outlier_correction.RPeakOutlierDetectionRRIntervalStatistics(rr_statistics_threshold=2.576)[source]

Bases: BaseRPeakOutlierDetection

Initialize new RPeakOutlierDetectionRRIntervalStatistics algorithm instance.

Parameters

rr_statistics_threshold (float, optional) – Threshold for the RR interval statistics above which a beat is considered an outlier. Default: 2.576 (99% confidence interval)

rr_statistics_threshold: float
detect_outlier(*, ecg, rpeaks, sampling_rate_hz)[source]
Parameters
  • ecg (DataFrame) –

  • rpeaks (DataFrame) –

  • sampling_rate_hz (float) –