Skip to main content

Cardiac signal analysis with Python

Project description

https://img.shields.io/badge/License-GPL%20v3-blue.svg https://badge.fury.io/py/systole.svg https://zenodo.org/badge/219720901.svg https://travis-ci.org/embodied-computation-group/systole.svg?branch=master https://codecov.io/gh/embodied-computation-group/systole/branch/master/graph/badge.svg https://img.shields.io/badge/code%20style-black-000000.svg https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 http://www.mypy-lang.org/static/mypy_badge.svg https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
https://github.com/embodied-computation-group/systole/raw/master/source/images/banner.png

Systole is an open-source Python package implementing simple tools for working with cardiac signals for psychophysiology research. In particular, the package provides tools to pre-process, visualize, and analyze cardiac data. This includes tools for data epoching, artefact detection, artefact correction, evoked heart-rate analyses, heart-rate variability analyses, circular statistical approaches to analysing cardiac cycles, and synchronising stimulus presentation with different cardiac phases via the psychopy.

The documentation can be found under the following link.

Installation

Systole can be installed using pip:

pip install systole

The following packages are required to use Systole:

Required when using Matplotlib plotting backend: * Matplotlib (>=3.0.2) Required when using Bokeh plotting backend: * Bokeh (>=2.3.3)

Tutorials

For an introduction to Systole and cardiac signal analysis, you can refer to the following tutorial:

  1. Cardiac signal analysis - Colab badge 1

  2. Detecting cardiac cycles - Colab badge 2

  3. Detecting and correcting artefats - Colab badge 3

  4. Heart rate variability - Colab badge 4

  5. Instantaneous and evoked heart rate - Colab badge 5

Getting started

from systole import import_dataset1

# Import ECg recording
signal = import_dataset1(modalities=['ECG']).ecg.to_numpy()

Signal extraction and interactive plotting

The package integrates a set of functions for interactive or non interactive data visualization based on Matplotlib and Bokeh.

from systole.plots plot_raw

plot_raw(signal[60000 : 120000], modality="ecg", backend="bokeh",
            show_heart_rate=True, show_artefacts=True, figsize=300)
https://github.com/embodied-computation-group/systole/blob/dev/source/images/raw.png

Artefacts detection and rejection

Artefacts can be detected and corrected in the RR interval time series or the peaks vector using the method proposed by Lipponen & Tarvainen (2019).

from systole.detection import ecg_peaks
from systole.plots plot_subspaces

# R peaks detection
signal, peaks = ecg_peaks(signal, method='pan-tompkins', sfreq=1000)

plot_subspaces(peaks, input_type="peaks", backend="bokeh")
https://github.com/embodied-computation-group/systole/blob/dev/source/images/subspaces.png

Heart rate variability analysis

Systole implements time-domain, frequency-domain and non-linear HRV indices, as well as tools for evoked heart rate analysis.

from bokeh.layouts import row
from systole.plots plot_frequency, plot_pointcare

row(
    plot_frequency(peaks, input_type="peaks", backend="bokeh", figsize=(300, 200)),
    plot_pointcare(peaks, input_type="peaks", backend="bokeh", figsize=(200, 200)),
    )
https://github.com/embodied-computation-group/systole/blob/dev/source/images/hrv.png

Online systolic peak detection, cardiac-stimulus synchrony, and cardiac circular analysis

The package natively supports recording of physiological signals from the following setups: - Nonin 3012LP Xpod USB pulse oximeter together with the Nonin 8000SM ‘soft-clip’ fingertip sensors (USB). - Remote Data Access (RDA) via BrainVision Recorder together with Brain product ExG amplifier (Ethernet).

Development

This module was created and is maintained by Nicolas Legrand and Micah Allen (ECG group, https://the-ecg.org/). If you want to contribute, feel free to contact one of the developers, open an issue or submit a pull request.

This program is provided with NO WARRANTY OF ANY KIND.

Contributors

Acknowledgements

This software and the ECG are supported by a Lundbeckfonden Fellowship (R272-2017-4345), and the AIAS-COFUND II fellowship programme that is supported by the Marie Skłodowska-Curie actions under the European Union’s Horizon 2020 (Grant agreement no 754513), and the Aarhus University Research Foundation.

Systole was largely inspired by pre-existing toolboxes dedicated to heartrate variability and signal analysis.


AU lundbeck lab

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

systole-0.2.0-py3-none-any.whl (99.7 kB view hashes)

Uploaded Python 3

Supported by

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