Package: hrv-analysis
Heart Rate Variability analysishrvanalysisis a Python module for Heart Rate Variability analysis of RR-intervals built on top of SciPy, AstroPy, Nolds and NumPy and distributed under the GPLv3 license.The development of this library started in July 2018 as part ofAura Healthcareproject, inOCTO TechnologyR&D team and is maintained by Robin Champseix.Full documentation:https://aura-healthcare.github.io/hrvanalysis/Website:https://www.aura.healthcareGithub:https://github.com/Aura-healthcareVersion: 1.0.4Installation / PrerequisitesUser installationThe easiest way to install hrv-analysis is usingpip:$ pip install hrv-analysisyou can also clone the repository:$ git clone https://github.com/aura-healthcare/hrvanalysis.git
$ python setup.py installDependencieshrvanalysisrequires the following:Python (>= 3.5)astropy >= 3.0.4future >= 0.16.0nolds >= 0.4.1numpy >= 1.15.1scipy >= 1.1.0Note: The package can be used with all Python versions from 3.5 to latest version (currently Python 3.9).Getting startedOutliers and ectopic beats filtering methodsThis package provides methods to remove outliers and ectopic beats from signal for further analysis. Those methods are useful to get Normal to Normal Interval (NN-intervals) from RR-intervals.
Please use this methods carefully as they might have a huge impact on features calculation.fromhrvanalysisimportremove_outliers,remove_ectopic_beats,interpolate_nan_values# rr_intervals_list contains integer values of RR-intervalrr_intervals_list=[1000,1050,1020,1080,...,1100,1110,1060]# This remove outliers from signalrr_intervals_without_outliers=remove_outliers(rr_intervals=rr_intervals_list,low_rri=300,high_rri=2000)# This replace outliers nan values with linear interpolationinterpolated_rr_intervals=interpolate_nan_values(rr_intervals=rr_intervals_without_outliers,interpolation_method="linear")# This remove ectopic beats from signalnn_intervals_list=remove_ectopic_beats(rr_intervals=interpolated_rr_intervals,method="malik")# This replace ectopic beats nan values with linear interpolationinterpolated_nn_intervals=interpolate_nan_values(rr_intervals=nn_intervals_list)You can find how to use the following methods, references and more details in thedocumentation:remove_outliersremove_ectopic_beatsFeatures calculationThere are 4 types of features you can get from NN-intervals:Time domain features :Mean_NNI, SDNN, SDSD, NN50, pNN50, NN20, pNN20, RMSSD, Median_NN, Range_NN, CVSD, CV_NNI, Mean_HR, Max_HR, Min_HR, STD_HRGeometrical domain features :Triangular_index, TINNFrequency domain features :LF, HF, VLF, LH/HF ratio, LFnu, HFnu, Total_PowerNon Linear domain features :CSI, CVI, Modified_CSI, SD1, SD2, SD1/SD2 ratio, SampEnAs an exemple, what you can compute to get Time domain analysis is :fromhrvanalysisimportget_time_domain_features# nn_intervals_list contains integer values of NN-intervalnn_intervals_list=[1000,1050,1020,1080,...,1100,1110,1060]time_domain_features=get_time_domain_features(nn_intervals_list)>>>time_domain_features{'mean_nni':718.248,'sdnn':43.113,'sdsd':19.519,'nni_50':24,'pnni_50':2.4,'nni_20':225,'pnni_20':22.5,'rmssd':19.519,'median_nni':722.5,'range_nni':249,'cvsd':0.0272,'cvnni':0.060,'mean_hr':83.847,'max_hr':101.694,'min_hr':71.513,'std_hr':5.196}You can find how to use the following methods, references and details about each feature in thedocumentation:get_time_domain_featuresget_geometrical_featuresget_frequency_domain_featuresget_csi_cvi_featuresget_poincare_plot_featuresget_sampenPlot functionsThere are several plot functions that allow you to see, for example, the Power Spectral Density (PSD) for frequency domain features or Poincaré Plot for non linear domain features:fromhrvanalysisimportplot_psd# nn_intervals_list contains integer values of NN-intervalnn_intervals_list=[1000,1050,1020,1080,...,1100,1110,1060]plot_psd(nn_intervals_list,method="welch")plot_psd(nn_intervals_list,method="lomb")fromhrvanalysisimportplot_poincare# nn_intervals_list contains integer values of NN-intervalnn_intervals_list=[1000,1050,1020,1080,...,1100,1110,1060]plot_poincare(nn_intervals_list)plot_poincare(nn_intervals_list,plot_sd_features=True)You can find how to use methods and details in thedocumentation:plot_distribplot_timeseriesplot_psdplot_poincareHere is a high level view of the distinct building blocks of the package:ReferencesHere are the main references used to compute the set of features and for signal processing methods:Heart rate variability - Standards of measurement, physiological interpretation, and clinical use, Task Force of The European Society of Cardiology and The North American Society of Pacing and Electrophysiology, 1996Signal Processing Methods for Heart Rate Variability - Gari D. Clifford, 2002Physiological time-series analysis using approximate entropy and sample entropy, Joshua S. Richman, J. Randall Moorman - 2000Using Lorenz plot and Cardiac Sympathetic Index of heart rate variability for detecting seizures for patients with epilepsy, Jesper Jeppesen et al, 2014AuthorsRobin Champseix- (https://github.com/robinchampseix)LicenseThis project is licensed under theGNU GENERAL PUBLIC License- see theLICENSE.mdfile for detailsHow to contributePlease refer toHow To ContributeAcknowledgmentsI hereby thank Laurent Ribière and Clément Le Couedic, my coworkers who gave me time to Open Source this library.
I also thank Fabien Arcellier for his advices on to how build a library in PyPi.