FiducialPoints(signal: numpy.array, fs: int)¶
The purpose of the FiducialPoints class is to calculate the fiducial points.
signal – the ECG signal as a ndarray, with shape (L, N) when L is the number of channels or leads and N is the number of samples.
fs – The sampling frequency of the signal.[Hz]
import pecg from pecg.Example import load_example from pecg.ecg import FiducialPoints as Fp signal, fs = load_example(ecg_type='Holter') fp = Fp.FiducialPoints(signal, fs)
wavedet(matlab_pat: str, peaks: numpy.array = array(, dtype=float64))¶
The wavedet function uses the matlab algorithm wavedet which was compiled for Windows OS for its usage in python. The algorithm is described in the the work of Martinez et al. . The function is calculating the fiducial points of the ECG time series using the wavelet transform.
matlab_pat – path to matlab runtime 2021a directory
peaks – Optional input- Annotation of the reference peak detector (Indices of the peaks), as an ndarray of shape (L,N), when L is the number of channels or leads and N is the number of peaks. If peaks are not provided they are calculated using the jqrs detector.
fiducials: Nested dictionary of leads - For every lead there is a dictionary that includes indexes for each one of nine fiducials points.
matlab_pat = '/usr/local/MATLAB/R2021a' fiducials = fp.wavedet(matlab_pat)
This function calculates the indexes of the R-peaks with epltd peak detector algorithm. This algorithm were introduced by .
indexes of the R-peaks in the ECG signal, as an ndarray of shape (L,N), when L is the number of channels or leads and N is the number of peaks.
peaks = fp.epltd()
This function wraps the XQRS function of the WFDB package.
peaks = fp.xqrs()
jqrs(thr: float = 0.8, rp: float = 0.25)¶
The function is an Implementation of an energy based qrs detector . The algorithm is an adaptation of the popular Pan & Tompkins algorithm . The function assumes the input ecg is already pre-filtered i.e. bandpass filtered and that the power-line interference was removed. Of note, NaN should be represented by the value -32768 in the ecg (WFDB standard).
thr – threshold, default value is 0.8.
rp – refractory period (sec), default value is 0.25.
peaks = fp.jqrs()
Biomarkers(signal: numpy.array, fs: int, fiducials: dict)¶
The purpose of the Biomarkers class is to calculate the biomarkers, we divided the morphological biomarkers into two main groups: intervals and waves.
signal – The ECG signal as a ndarray.
fs – The sampling frequency of the signal [Hz].
fiducials – Nested dictionary of leads - For every lead there is a dictionary that includes indexes for for each one of nine fiducials points. this nested dictionary can be calculated using the FiducialPoints module.
import pecg from pecg.ecg import Biomarkers as Bm from pecg.ecg import FiducialPoints as Fp from pecg.Example import load_example signal, fs = load_example(ecg_type='12-lead') fp = Fp.FiducialPoints(signal, fs) matlab_pat = '/usr/local/MATLAB/R2021a' fiducials = fp.wavedet(matlab_pat) bm = Bm.Biomarkers(signal, fs, fiducials) ints, stat_i = bm.intervals() waves, stat_w = bm.waves()
intervals_b: Dictionary that includes all the raw data, for the Intervals and segments biomarkers.
intervals_statistics: Dictionary that includes the mean, median, min, max, iqr and std, for every Intervals and segments biomarker.
Time interval between P-on and P-off.
Time interval between the P-on to the QRS-on.
Time interval between the P-off to the QRS-on.
Time interval between P-peak and R-peak as defined by Mao et al.
Time interval between the QRS-on to the QRS-off.
Time interval between the QRS-on to the T-off.
Corrected QT interval (QTc) using Bazett’s formula.
QTc using the Fridericia formula.
QTc using the Framingham formula.
QTc using the Hodges formula.
Time interval between T-on and T-off.
Time interval between T-off and P-on.
Time interval between sequential R-peaks.
Time interval betweem Q-on and R-peak.
waves_b: Dictionary that includes all the raw data, for every Wave characteristic biomarker.
wave_statistics: Dictionary that includes the mean, median, min, max, iqr and std, for every Wave characteristic biomarker.
Amplitude difference between P-peak and P-off.
Amplitude difference between T-peak on and T-off.
P-wave interval area defined as integral from the P-on to the P-off.
T-wave interval area defined as integral from the T-on to the T-off.
QRS interval area defined as integral from the QRS-on to the QRS-off.
Amplitude difference between QRS-off and T-on.
Amplitude in 40ms after QRS-off as defined by Hollander et al.