QPeakExtractionForouzanfar2018#

class pepbench.algorithms.ecg.QPeakExtractionForouzanfar2018(scaling_factor: float = 2000, handle_missing_events: Literal['raise', 'warn', 'ignore'] = 'warn')[source]#

Q-peak extraction algorithm by Forouzanfar et al. (2018).

This algorithm detects the Q-peak of an ECG signal based on the last sample before the R-peak that is below a certain threshold (\(-1.2 \cdot R_peak/f_s\)), where R_peak is the amplitude of the R-peak and f_s is the sampling frequency of the ECG signal.

In this implementation, a scaling_factor is used instead of f_s since the sampling rates of the datasets can differ from the original publication (2000 Hz). Thus, the scaling_factor is set to the sampling rate of the original publication (2000 Hz) by default.

For more information on the algorithm, see [For18].

References

[For18]

Forouzanfar, M., Baker, F. C., De Zambotti, M., McCall, C., Giovangrandi, L., & Kovacs, G. T. A. (2018). Toward a better noninvasive assessment of preejection period: A novel automatic algorithm for B-point detection and correction on thoracic impedance cardiogram. Psychophysiology, 55(8), e13072. https://doi.org/10.1111/psyp.13072

Methods

clone()

Create a new instance of the class with all parameters copied over.

extract(*, ecg, heartbeats, sampling_rate_hz)

Extract Q-peaks from given ECG signal.

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

__init__(scaling_factor: float = 2000, handle_missing_events: Literal['raise', 'warn', 'ignore'] = 'warn')[source]#

Initialize new QPeakExtractionForouzanfar2018 algorithm instance.

Parameters:
scaling_factorfloat, optional

Scaling factor for the threshold used to detect the Q-peak. Default: 2000

handle_missing_eventsone of {“warn”, “raise”, “ignore”}, optional

How to handle missing data in the input dataframes. Default: “warn”

clone() Self[source]#

Create a new instance of the class with all parameters copied over.

This will create a new instance of the class itself and all nested objects

extract(*, ecg: _EcgRawDataFrame | DataFrame, heartbeats: _HeartbeatSegmentationDataFrame | DataFrame, sampling_rate_hz: float)[source]#

Extract Q-peaks from given ECG signal.

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

Parameters:
ecg: :class:`~pandas.DataFrame`

ECG signal

heartbeats: :class:`~pandas.DataFrame`

DataFrame containing one row per segmented heartbeat, each row contains start, end, and R-peak location (in samples from beginning of signal) of that heartbeat, index functions as id of heartbeat

sampling_rate_hz: float

Sampling rate of ECG signal in hz

Returns:
self
Raises:
EventExtractionError

If the event extraction fails and handle_missing is set to “raise”

get_params(deep: bool = True) dict[str, Any][source]#

Get parameters for this algorithm.

Parameters:
deep

Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like nested_object_name__ (Note the two “_” at the end)

Returns:
params

Parameter names mapped to their values.

set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.