biosppy.signals.pcg¶
biosppy.signals.pcg¶
This module provides methods to process Phonocardiography (PCG) signals.
- copyright:
2015-2026 by Instituto de Telecomunicacoes
- license:
BSD 3-clause, see LICENSE for more details.
Functions
|
Assign state labels to PCG recording based on markers from simultaneous ECG signal. |
|
Finds the peaks of the heart sounds from the homomorphic envelope |
|
Compute average heart rate from the signal's homomorphic envelope. |
|
Finds the homomorphic envelope of a signal. |
|
Classify heart sound peaks as S1 or S2 |
|
|
- biosppy.signals.pcg.ecg_based_segmentation(pcg_signal=None, ecg_signal=None, sampling_rate=1000.0, show=False)[source]¶
Assign state labels to PCG recording based on markers from simultaneous ECG signal.
Adapted to Python from original MATLAB code written by David Springer, 2016 (C), for comparison purposes in the paper [Springer15]. Available at: https://github.com/davidspringer/Springer-Segmentation-Code
Heart sounds timing durations were obtained from [Schimdt10].
- Parameters:
pcg_signal (array) – PCG signal to be segmented.
ecg_signal (array) – Simultaneous ECG signal.
sampling_rate (int, float, optional) – Sampling frequency (Hz) of both signals.
show (bool, optional) – If True, show a plot with the segmented signal.
- Returns:
states (array) – State labels of PCG recording
References
[Springer15]D.Springer, “Logistic Regression-HSMM-based Heart Sound Segmentation”, IEEE Trans. Biomed. Eng., In Press, 2015.
[Schimdt10]S. E. Schmidt et al., “Segmentation of heart sound recordings by a duration-dependent hidden Markov model”, Physiol. Meas., 2010
- biosppy.signals.pcg.find_peaks(signal=None, sampling_rate=1000.0, filter=True)[source]¶
Finds the peaks of the heart sounds from the homomorphic envelope
- Parameters:
signal (array) – Input filtered PCG signal.
sampling_rate (int, float, optional) – Sampling frequency (Hz).
- Returns:
peaks (array) – peak location indices.
envelope (array) – Homomorphic envelope (normalized).
- biosppy.signals.pcg.get_avg_heart_rate(envelope=None, sampling_rate=1000.0)[source]¶
Compute average heart rate from the signal’s homomorphic envelope.
Follows the approach described by Schmidt et al. [Schimdt10], with code adapted from David Springer [Springer16].
- Parameters:
envelope (array) – Signal’s homomorphic envelope
sampling_rate (int, float, optional) – Sampling frequency (Hz).
- Returns:
heart_rate (double) – Average heart rate (bpm).
systolic_time_interval (double) – Average systolic time interval (seconds).
Notes
Assumes normal human heart rate to be between 40 and 200 bpm.
Assumes normal human systole time interval to be between 0.2 seconds and half a heartbeat
References
[Schimdt10]S. E. Schmidt et al., “Segmentation of heart sound recordings by a duration-dependent hidden Markov model”, Physiol. Meas., 2010
[Springer16]D.Springer, “Heart sound segmentation code based on duration-dependant HMM”, 2016. Available at: https://github.com/davidspringer/Springer-Segmentation-Code
- biosppy.signals.pcg.homomorphic_filter(signal=None, sampling_rate=1000.0, f_LPF=8, order=2, filter=True)[source]¶
Finds the homomorphic envelope of a signal.
Adapted to Python from original MATLAB code written by David Springer, 2016 (C), for comparison purposes in the paper [Springer15]. Available at: https://github.com/davidspringer/Springer-Segmentation-Code
Follows the approach described by Schmidt et al. [Schimdt10].
- Parameters:
signal (array) – Input filtered PCG signal.
sampling_rate (int, float, optional) – Sampling frequency (Hz).
f_LPF (int, float, optional) – Low pass cut-off frequency (Hz)
order (int, optional) – Order of Butterworth low pass filter.
- Returns:
envelope (array) – Homomorphic envelope (non-normalized).
References
[Springer15]D.Springer, “Logistic Regression-HSMM-based Heart Sound Segmentation”, IEEE Trans. Biomed. Eng., In Press, 2015.
[Schimdt10]S. E. Schmidt et al., “Segmentation of heart sound recordings by a duration-dependent hidden Markov model”, Physiol. Meas., 2010
- biosppy.signals.pcg.identify_heart_sounds(beats=None, sampling_rate=1000.0)[source]¶
Classify heart sound peaks as S1 or S2
- Parameters:
beats (array) – Peaks of heart sounds
sampling_rate (int, float, optional) – Sampling frequency (Hz).
- Returns:
classification (array) – Classification of heart sound peaks. 1 is S1, 2 is S2
- biosppy.signals.pcg.pcg(signal=None, sampling_rate=1000.0, units=None, path=None, show=True)[source]¶
- Parameters:
signal (array) – Raw PCG signal.
sampling_rate (int, float, optional) – Sampling frequency (Hz).
units (str, optional) – The units of the input signal. If specified, the plot will have the y-axis labeled with the corresponding units.
path (str, optional) – If provided, the plot will be saved to the specified file.
show (bool, optional) – If True, show a summary plot.
- Returns:
ts (array) – Signal time axis reference (seconds).
filtered (array) – Filtered PCG signal.
peaks (array) – Peak location indices.
hs (array) – Classification of peaks as S1 or S2.
heart_rate (double) – Average heart rate (bpm).
systolic_time_interval (double) – Average systolic time interval (seconds).
heart_rate_ts (array) – Heart rate time axis reference (seconds).
inst_heart_rate (array) – Instantaneous heart rate (bpm).