pyhrv

Python toolbox for Heart Rate Variability

https://github.com/pgomes92/pyhrv

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.6%) to scientific vocabulary

Keywords

bvp-signal ecg-signal frequency-domain heart-rate-variability hrv nni-series nonlinear-parameters python-toolbox time-domain
Last synced: 6 months ago · JSON representation

Repository

Python toolbox for Heart Rate Variability

Basic Info
  • Host: GitHub
  • Owner: PGomes92
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 22.1 MB
Statistics
  • Stars: 301
  • Watchers: 10
  • Forks: 82
  • Open Issues: 21
  • Releases: 0
Topics
bvp-signal ecg-signal frequency-domain heart-rate-variability hrv nni-series nonlinear-parameters python-toolbox time-domain
Created over 7 years ago · Last pushed almost 3 years ago
Metadata Files
Readme Changelog License

README.md

Image

GitHub Version PyPi Version Python Versions Issues Development Documentation Status Downloads License

pyHRV is an open-source Python toolbox that computes state-of-the-art Heart Rate Variability (HRV) parameters from Electrocardiography (ECG), SpO2, Blood Volume Pulse (BVP), or other signals with heart rate indicators.

With pyHRV, we aim to provide a user-friendly and versatile Python toolbox for HRV dedicated education, research, and application development.

It provides provides comprehensible source code to help beginners understand the fundamentals of HRV parameter computation, while providing the most important HRV analysis functionalities for developers and publication-quality plots of the results for researchers.

Getting Started

Installation & Python Compatibility

This toolbox can be installed using the pip tool.

python pip install pyhrv Dependencies: biosppy | numpy | scipy | matplotlib | nolds | spectrum

pyHRV is primarily maintained in Python 3.X but has been tested under Python 2.7 up to version 0.4.0.

Documentation & Tutorials

Detailed pyHRV documentation is available on ReadTheDocs:

pyHRV API Reference

Additional tutorials can be found here:

Scientific Background

The HRV algorithms have been developed and implemented according to the Heart Rate Variability - Sandards of Measurement, Physiological Interpretation, and Clinical Use Guidelines. Other references are noted in the code and in the pyHRV references.

Citing pyHRV

Please use the following conference paper to cite pyHRV in your work (Conference Paper [PDF], Conference Proceedings [PDF]):

P. Gomes, P. Margaritoff, and H. P. da Silva, “pyHRV: Development and evaluation of an open-source python toolbox for heart rate variability (HRV),” in Proc. Int’l Conf. on Electrical, Electronic and Computing Engineering (IcETRAN), pp. 822-828, 2019

latex @inproceedings{Gomes2019, author = {Gomes, Pedro and Margaritoff, Petra and Silva, Hugo}, booktitle = {Proc. Int'l Conf. on Electrical, Electronic and Computing Engineering (IcETRAN)}, pages = {822-828}, title = {{pyHRV: Development and evaluation of an open-source python toolbox for heart rate variability (HRV)}}, year = {2019} }

pyHRV Core Features & HRV Parameter List

With pyHRV, you can compute up to 78 HRV parameters while using other useful non-parameter-specific tools to support your HRV research.

Time Domain Parameters

  • Basic statistical parameters of a NNI series - pyhrv.time_domain.nni_parameters()
  • Basic statistical parameters of a ΔNNI series - pyhrv.time_domain.nni_differences_parameters()
  • Basic statistical parameters of a Heart Rate (HR) series - pyhrv.time_domain.hr_parameters()
  • Standard deviation of a NNI series (SDNN) - pyhrv.time_domain.sdnn()
  • Mean of the SDNN of 5 successive 5 minute segments extracted from long-term NNI series (SDNNindex)- pyhrv.time_domain.sdnn_index()
  • Standard deviation of the mean of 5 minute segments extracted from long-term NNI series (SDANN) - pyhrv.time_domain.sdann()
  • Root mean square of successive difference (RMSSD) - pyhrv.time_domain.rmssd()
  • Standard deviation of successive differences (SDSD) - pyhrv.time_domain.sdsd()
  • NNx & pNNx parameters - pyhrv.time_domain.nnXX()
  • NN20 & pNN20 parameters - pyhrv.time_domain.nn20()
  • NN50 & pNN50 parameters - pyhrv.time_domain.nn50()
  • Triangular Index (Maximum of the Histogram / Width of the Histogram) - pyhrv.time_domain.triangular_index()
  • Triangular Interpolation Function (TINN)1 - pyhrv.time_domain.tinn()

1 the current version of pyHRV has some bug which causes misleading and false results for the TINN function. An issue has already been opened for this purpose...

Image

Frequency Domain Parameters

Computes the following Frequency Domain parameters from the Power Spectral Density (PSD) of a NNI series computed using the following PSD methods:

  • Welch's Method - pyhrv.frequency_domain.welch_psd()
  • Autoregressive - pyhrv.frequency_domain.ar_psd()
  • Lomb-Scargle - pyhrv.frequency_domain.lomb_psd()

Frequency parameters: - Peak Frequencies - Absolute Powers - Logarithmic Powers - Relative Powers - Normalized Powers (LF and HF only) - LF/HF ratio

The parameters are computed for the Very Low Frequency (VLF), Low Frequency (LF), and High Frequency (HF) bands. The Frequency Bands can be customized, including an Ultra Low Frequency (ULF) band.

Sample plots of the resulting PSD plots and Frequency Domain parameters using pyHRV can be seen below:

Image Image Image

PSD Comparison Features - 2D Comparison Plot

Plot PSDs from multiple NNI segments extracted from a NNI series (e.g. 5 minute segments of a 60 minute recording) in a 3D Waterfall Plot using the Welch, Autoregressive or Lomb-Scargle method and compute the Frequency Domain parameters from each segment - pyhrv.frequency_domain.psd_comparison() [source].

Image Image Image

PSD Comparison Features - 3D Waterfall Plot

Plot PSDs from multiple NNI segments extracted from a NNI series (e.g. 5 minute segments of a 60 minute recording) in a single plot using the Welch, Autoregressive or Lomb-Scargle method and compute the Frequency Domain parameters from each segment - pyhrv.frequency_domain.psd_waterfall()

Image Image Image

Nonlinear Parameters

Computes the following Nonlinear Parameters and the respective plots:

  • Poincaré Plot (SD1, SD2, fittes ellipse area, SD2/SD1 ratio) - pyhrv.nonlinear.poincare()
  • Sample Entropy - pyhrv.nonlinear.sample_entropy()
  • Detrended Fluctuation Analysis (short-term and long-term)- pyhrv.nonlinear.dfa()

Image

HRV Support Tools & Other Features

  • Computation of NNI series - pyhrv.tools.nn_intervals()
  • Computation of ∆NNI series - pyhrv.tools.nn_diff()
  • Computation of HR series - pyhrv.tools.heart_rate()
  • ECG plotting on medical-grade-like ECG paper layout - pyhrv.tools.plot_ecg()
  • NNI Tachogram plotting - pyhrv.tools.tachogram()
  • Heart Rate Heatplot, a visualization & classification of HR performance based on normal HR ranges by age and gender- pyhrv.tools.heart_rate_heatplot()
  • Time varying plot of a HRV parameter over time - pyhrv.tools.time_varying()
  • Dynamic Radar chart of HRV parameters - pyhrv.tools.radar_chart()
  • Exporting HRV results into a JSON file Sample File- pyhrv.tools.hrv_export()

Image Image Image Image Image

HRV Reports

Generate HRV reports in .TXT, .CSV, and .PDF format (new in v.0.4!). Read the README file of the pyHRV report submodule for more information about how to generate pyHRV reports as the following:

Utilities

Several non-HRV specific utilities and general purpose functions which are used throughout this toolbox: - Loading NNI sample series for testing purposes - pyhrv.utils.load_sample_nni() - Loading pyHRV's hrv_keys.json file - pyhrv.utils.load_hrv_keys_json() - Format NNI series (ensure numpy array and convert data provided in seconds to ms - pyhrv.utils.nn_format() - Segmentation of time series (e.g. NNI series) - pyhrv.utils.segmentation() - and others...

Disclaimer

This program is distributed in the hope it will be useful and provided to you "as is", but WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program is NOT intended for medical diagnosis. We expressly disclaim any liability whatsoever for any direct, indirect, consequential, incidental or special damages, including, without limitation, lost revenues, lost profits, losses resulting from business interruption or loss of data, regardless of the form of action or legal theory under which the liability may be asserted, even if advised of the possibility of such damages.

This package has initially (up to version 0.3) been developed within the scope of my master thesis "Development of an Open-Source Python Toolbox for Heart Rate Variability (HRV)" at the University of Applied Sciences Hamburg, Germany (Faculty Life Sciences, Department of Biomedical Engineering) and PLUX wireless biosignals, S.A., Lisbon, Portugal.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 27
  • Fork event: 7
Last Year
  • Issues event: 1
  • Watch event: 27
  • Fork event: 7

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 30
  • Total Committers: 1
  • Avg Commits per committer: 30.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Pedro Gomes p****2@g****m 30

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 41
  • Total pull requests: 5
  • Average time to close issues: 10 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 33
  • Total pull request authors: 4
  • Average comments per issue: 0.83
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • snowuyl (5)
  • PGomes92 (3)
  • bdekoven (2)
  • tgterra (2)
  • cogitoxin (1)
  • PeterGamma (1)
  • yangpeinmgdx (1)
  • S-max-byte (1)
  • weberk (1)
  • CodeSeeker99 (1)
  • kissorsolya (1)
  • GGChe (1)
  • yingding (1)
  • jdevoldere (1)
  • lxxue (1)
Pull Request Authors
  • PGomes92 (2)
  • mmore500 (1)
  • jmmcd (1)
  • tauber (1)
Top Labels
Issue Labels
Will be fixed in next update (6) bug (3) review required (3) Improvement (1) wontfix (1) requests (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 4,627 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 7
  • Total versions: 6
  • Total maintainers: 1
pypi.org: pyhrv

Python toolbox for Heart Rate Variability.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 7
  • Downloads: 4,627 Last month
Rankings
Stargazers count: 4.4%
Forks count: 5.3%
Dependent repos count: 5.6%
Downloads: 6.1%
Average: 6.3%
Dependent packages count: 10.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • biosppy *
  • matplotlib *
  • nolds *
  • numpy *
  • scipy *
  • spectrum *