Skip to main content

HRApp: An Interactive Heart Rate Variability (HRV) Analysis Tool

Project description

Binder

⚠️ CAUTION:

This project is work in progress. It can not be used for data analysis yet. Breathing and blood pressure data are totally untested/not yet implemented.

This project is mainly the introduction of a library. The idea is that library can be used without knowledge of python by using the App. The App runs primarily in Jupyter.

HRApp: An Interactive Heart Rate Variability (HRV) Analysis Tool

Overview

The HRApp is an interactive tool designed to assist in the analysis of heart rate variability (HRV) data. It provides a graphical user interface (GUI) within Jupyter Notebooks to explore, preprocess, and visualize HRV data. The app organizes its features into multiple tabs, each focusing on a specific aspect of HRV analysis.

Features

  1. PreProcessing Tab

    • Provides tools to preprocess HRV data, such as cleaning and inspecting inter-beat intervals (IBI).
    • Displays a customizable GUI for manipulating the dataset.
  2. Poincare Tab

    • Visualizes HRV data using Poincaré plots, which highlight the relationships between successive IBIs.
    • Ideal for assessing nonlinear dynamics in heart rate data.
  3. Descriptives Tab

    • Computes detailed descriptive statistics for IBIs, grouped by epochs.
    • Includes metrics such as mean, standard deviation, RMSSD, SDNN, SD1, SD2, and others.
    • Integrates power spectral density (PSD) results into the statistics, if available.
  4. PSD Tab

    • Uses Welch's method to compute power spectral density (PSD) for HRV data.
    • Groups PSD results by epochs, providing insights into the frequency domain features of HRV.
  5. Epochs Tab

    • Visualizes epochs of HRV data using a Gantt chart.
    • Offers a clear representation of time-based data segmentation.

How It Works

Inputs

  • Dataset: The app requires a dataset containing HRV-related data, such as IBIs, epochs, and other time-series information. This dataset is expected to support operations defined in the spectHR library.

Workflow

  1. Launch the App
    Call the HRApp(DataSet) function with the appropriate dataset as input. This displays the GUI with five tabs.

  2. Switch Between Tabs
    Navigate through tabs to explore different aspects of HRV analysis. The selected tab dynamically updates its content:

    • Preprocessing tools in the PreProcessing tab.
    • Poincaré plot in the Poincare tab.
    • Statistical summaries in the Descriptives tab.
    • PSD analysis in the PSD tab.
    • Epoch visualizations in the Epochs tab.
  3. Real-Time Updates
    The app dynamically updates visualizations and calculations as you interact with each tab. Outputs are recalculated and displayed in real-time.

  4. Data Saving
    Changes to the dataset, such as computed statistics or PSD values, are saved automatically.

Outputs

  • Visualizations (e.g., plots, charts) for exploring HRV dynamics.
  • Computed metrics and summaries for HRV data.
  • Processed datasets ready for further analysis.

Dependencies

  • Python Libraries:

    • pyxdf: For reading .XDF files.
    • ipywidgets: For interactive UI elements.
    • spectHR: Custom library for HRV preprocessing and analysis.
    • pyhrv: For HRV metrics calculation.
    • pandas: For data manipulation and statistics.
  • Environment:

    • Jupyter Notebook or JupyterLab (preferred) for running and displaying the app.

Example Usage

import spectHR as cs
%matplotlib widget

DataSet = cs.SpectHRDataset("SUB_005.xdf", use_webdav=True, reset = False)
DataSet = cs.borderData(DataSet)
DataSet = cs.filterECGData(DataSet, {"filterType": "highpass", "cutoff": .50})
if not hasattr(DataSet, 'RTops'):
    DataSet = cs.calcPeaks(DataSet)

# Launch the HRV analysis application
App = cs.HRApp(DataSet)

Screenshots

Because everybody likes screenshots:

Preprocessing interface

Poincare Plots

Example statistics

Frequency domain Plots

Experiment epochs


This tool is ideal for researchers, clinicians, and students who work with HRV data and require an interactive, user-friendly interface for their analyses.

spectHR - Cardiovascular Spectral Analysis Toolkit

spectHR is a Python library designed for interactive analysis of time series data, particularly focused on ECG and breathing patterns. The library provides tools for detecting peaks (R-tops) in ECG data, spectral analysis, and interactive visualization of time series data. It includes various modes for modifying, selecting, and analyzing R-tops and other key events in the data.

Features

  • Reads XDF: It reads labstreaminglayers .XDF files. the ECG stream is detected if its label contains 'polar'. Generally for use with the PolarBand H10 and the PolarGUI application. Markers are ready from a seperate stream, and should follow the patterns start label and end label to mark an epoch (named 'label').
  • ECG and Breathing Pattern Analysis: Process and analyze time series data, including ECG and breathing patterns.
  • Peak Detection (R-tops): Automatically detect R-top times in ECG signals.
  • Interactive Plotting: Use draggable vertical lines to visualize and manipulate R-tops within a plot.
  • Zoom and Epoch Selection: Interactively zoom into regions of interest and select epochs for marking.
  • Spectral Analysis: Perform cardiovascular spectral analysis to study heart rate variability and other metrics.

Installation

Requirements

  • Python 3.7+
  • Jupyter notebook or JupyterLab
  • ipywidgets
  • pyhrv
  • ipyvuetify (for nicer looking widgets)

Install the library

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

specthr-0.1.11.tar.gz (7.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

specthr-0.1.11-py3-none-any.whl (4.5 MB view details)

Uploaded Python 3

File details

Details for the file specthr-0.1.11.tar.gz.

File metadata

  • Download URL: specthr-0.1.11.tar.gz
  • Upload date:
  • Size: 7.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for specthr-0.1.11.tar.gz
Algorithm Hash digest
SHA256 2500ac27a8b9d3cb29e55c91c63f19a0395c35b74e8b7cbe9ae7211faf1aec37
MD5 257a9d92ba3986e0b7f36759c4853455
BLAKE2b-256 1142089136fb4bf4009bdeb2160f175aa069f49dad6439b40b8f1997ade33796

See more details on using hashes here.

File details

Details for the file specthr-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: specthr-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for specthr-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 620804263d20b4d2e15f55ec98c85be58a9621a553fb42e58116124ed9ff90e2
MD5 0899ee3facbddcf086e3aadc8e2348cc
BLAKE2b-256 02ea529027e76fd30ba2039b1db7eb64d0f4571672fb339bee39f92d97743610

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page