RapidHRV: an open-source toolbox for extracting heart rate and heart rate variability

Have ❤️ data that needs analysing but don't want the monotony of manually checking for noise and artifacts? Well hold onto your seat belts, with just one line of code needed to run, we may have a solution for you. Introducing, RapidHRV 🔥 (pre-print; pypi; tutorial). In brief, our Python package takes a transparent approach: data is preprocessed, analysed, and cleaned for outliers. Outputted are BPM, RMSSD, and SDNN. Don't feel comfortable tweaking parameters? Simply add 'liberal', 'moderate', or 'conservative' to adjust cleaning stringency.


Want to have a 🔍 check on RapidHRV's performance? Use our visualization tool! Plots the entire analyzed time series (uncleaned and cleaned) and allows the user to click on specific data points to view windows of extraction.

To scrutinize when RapidHRV does and does not work, we tested the software across five datasets which varied in recording modality, sampling rates, and conditions. First up, we simulated data across a range of sampling rates (20-250Hz) and noise (0.01-60dB). Across all sampling rates, RapidHRV demonstrated good-to-excellent detection of HR at >= 10dB and HRV at >=20-30dB.


Secondly, we again simulated data, but emulated experimental conditions based on anxiety-relevant effect sizes (d = .38). Across all sampling rates, RapidHRV was able to detect the true effect size (or v. close) at >= 30dB. Effects were detected but diminished at >=10dB.

Third, we validated RapidHRV in ECG, one of the highest standards of recording for heart rate variability. We recapitulated previous (visually inspected) analyses, demonstrating effects of age on heart rate variability during movie-watching (shout out to RainCloud plots).

Fourth, we we tested the package against a relatively noisier modality, pulse oximetry. RapidHRV cleaning enabled the detection anxiety-relevant effects, and benchmarking demonstrated good-to-excellent agreement with a previous analysis (using LabChart).

We lastly tested RapidHRV's performance in even noisier recordings (⌚️PPG) during out-of-lab activities. Our results suggested RapidHRV was able to perform good-to-excellent under low motion conditions (e.g. eating lunch), but performed less well in high motion settings.

Already in love with RapidHRV? I thought so. Preprocessing and analysis appears stable across OSs/IDEs. Note: we've encountered some IDE-specific issues in interactive visualization, which we're addressing (see README.md).

Feel free to get in touch if you have any questions!