Template-based interbeat interval extraction
This is a Python package for extracting interbeat intervals from various heartbeat signals. It includes a template-based method developed for in-ear heartbeat sounds, which has also been tested for electrocardiography and photoplethysmography signals. The tests on in-ear heartbeat sounds are described in the following paper:
Benesch, D., Chabot, P., Tom, A., Voix, J., & Bouserhal, R. E. (2024). Template-based Extraction of Interbeat Intervals from In-Ear Heartbeat Sounds. IEEE International Conference on Wearable and Implantable Body Sensor Networks (BSN 2024).
from tempbeat.extraction.heartbeat_extraction import hb_extract
# sig is a 1D numpy array
# peak_time is a 1D numpy array with the time of each heartbeat in seconds
peak_time = hb_extract(sig, sampling_rate=sampling_rate, method="temp")
To use a method implemented in MATLAB, you need to have MATLAB installed and
the MATLAB engine for Python. After putting the MATLAB code in the
src/matlab
folder, you can use it as follows:
peak_time = hb_extract(sig, sampling_rate=sampling_rate, method="matlab")
This project uses pre-commit, please make sure to install it before making any changes:
pip install pre-commit cd tempbeat pre-commit install
It is a good idea to update the hooks to the latest version:
pre-commit autoupdate
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.