Skip to main content

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

Metadata

Release files for spectHR 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spectHR 0.1.11
File Size Uploaded
specthr-0.1.11.tar.gz 7.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for spectHR 0.1.11
File Interpreter ABI Platform
specthr-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 MB

Release files / specthr-0.1.11.tar.gz

Download URL specthr-0.1.11.tar.gz
Size 7.8 MB
Tags Source
SHA-256 checksum
How to use checksums
2500ac27a8b9d3cb29e55c91c63f19a0395c35b74e8b7cbe9ae7211faf1aec37
BLAKE2b-256 checksum
How to use checksums
1142089136fb4bf4009bdeb2160f175aa069f49dad6439b40b8f1997ade33796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / specthr-0.1.11-py3-none-any.whl

Download URL specthr-0.1.11-py3-none-any.whl
Size 4.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
620804263d20b4d2e15f55ec98c85be58a9621a553fb42e58116124ed9ff90e2
BLAKE2b-256 checksum
How to use checksums
02ea529027e76fd30ba2039b1db7eb64d0f4571672fb339bee39f92d97743610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page