biopsykit.signals.icg.outlier_correction package

Module for outlier correction of ICG signals.

class biopsykit.signals.icg.outlier_correction.BaseBPointOutlierCorrection[source]

Bases: Algorithm

Initialize new Outlier Correction Algorithm.

points_: biopsykit.utils.dtypes._BPointDataFrame | pandas.core.frame.DataFrame
correct_outlier(*, b_points, c_points, sampling_rate_hz, **kwargs)[source]
Parameters
  • b_points (biopsykit.utils.dtypes._BPointDataFrame | pandas.core.frame.DataFrame) –

  • c_points (biopsykit.utils.dtypes._CPointDataFrame | pandas.core.frame.DataFrame | None) –

  • sampling_rate_hz (float) –

static detect_b_point_outlier(stationary_data)[source]

Detect outliers in stationary B-Point data.

Outliers are detected based on the median absolute deviation of the stationary data. If the difference between the stationary data and the median is greater than 3 times the median absolute deviation, the data point is considered an outlier.

Parameters

stationary_data (DataFrame) – DataFrame containing the stationary B-Point data

Returns

DataFrame containing the detected outliers

Return type

DataFrame

static stationarize_b_points(b_points, c_points, sampling_rate_hz)[source]

Stationarize B-Point data by removing the baseline.

The B-points are stationarized by removing the baseline from the distance to the C-point. The baseline is estimated using a 4th order low-pass Butterworth filter with a cutoff frequency of 0.1 Hz.

Parameters
  • b_points (DataFrame) – Dataframe containing the extracted B-Points per heartbeat, index functions as id of heartbeat

  • c_points (DataFrame) – Dataframe containing the extracted C-Points per heartbeat, index functions as id of heartbeat

  • sampling_rate_hz (float) – Sampling rate of ICG signal in Hz

Returns

DataFrame containing the stationarized B-Point data

Return type

DataFrame

class biopsykit.signals.icg.outlier_correction.OutlierCorrectionDummy[source]

Bases: BaseBPointOutlierCorrection

Initialize new Outlier Correction Algorithm.

correct_outlier(*, b_points, c_points, sampling_rate_hz, **kwargs)[source]

Perform outlier correction.

This method does nothing and passes through the input data unchanged.

The results of the outlier correction are saved in the points_ attribute of the super class.

Parameters
  • b_points (DataFrame) – Extracted B-points. Each row contains the B-point location (in samples from beginning of signal) for each heartbeat, index functions as id of heartbeat. B-point locations can be NaN if no B-points were detected for certain heartbeats.

  • c_points (DataFrame) – Extracted C-points. Each row contains the C-point location (in samples from beginning of signal) for each heartbeat, index functions as id of heartbeat. C-point locations can be NaN if no C-points were detected for certain heartbeats.

  • sampling_rate_hz (int) – sampling rate of ICG derivative signal in hz

  • kwargs (dict) – Additional keyword arguments. Not used.

Return type

self

class biopsykit.signals.icg.outlier_correction.OutlierCorrectionForouzanfar2018[source]

Bases: BaseBPointOutlierCorrection

Initialize new Outlier Correction Algorithm.

correct_outlier(*, b_points, c_points, sampling_rate_hz, **kwargs)[source]

Perform outlier correction on B-Point data.

The outliers are corrected using an autoregressive model.

The results of the outlier correction are saved in the points_ attribute of the super class.

Parameters
  • b_points (DataFrame) – Extracted B-points. Each row contains the B-point location (in samples from beginning of signal) for each heartbeat, index functions as id of heartbeat. B-point locations can be NaN if no B-points were detected for certain heartbeats.

  • c_points (DataFrame) – Extracted C-points. Each row contains the C-point location (in samples from beginning of signal) for each heartbeat, index functions as id of heartbeat. C-point locations can be NaN if no C-points were detected for certain heartbeats.

  • sampling_rate_hz (int) – sampling rate of ICG derivative signal in hz

  • kwargs (dict) –

    Additional keyword arguments:
    • verbose: bool, optional

      Whether to print additional information. Default: False

Return type

self

class biopsykit.signals.icg.outlier_correction.OutlierCorrectionLinearInterpolation[source]

Bases: BaseBPointOutlierCorrection

Initialize new Outlier Correction Algorithm.

correct_outlier(*, b_points, c_points, sampling_rate_hz, **kwargs)[source]

Perform outlier correction on B-Point data.

The outliers are corrected using linear interpolation.

The results of the outlier correction are saved in the points_ attribute of the super class.

Parameters
  • b_points (DataFrame) – Extracted B-points. Each row contains the B-point location (in samples from beginning of signal) for each heartbeat, index functions as id of heartbeat. B-point locations can be NaN if no B-points were detected for certain heartbeats.

  • c_points (DataFrame) – Extracted C-points. Each row contains the C-point location (in samples from beginning of signal) for each heartbeat, index functions as id of heartbeat. C-point locations can be NaN if no C-points were detected for certain heartbeats.

  • sampling_rate_hz (int) – sampling rate of ICG derivative signal in hz

  • kwargs (dict) –

    Additional keyword arguments:
    • verbose: bool, optional

      Whether to print additional information. Default: False

Return type

self