Systole: A python package for cardiac signal synchrony and analysis
Project description
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 Psychopy.
The documentation can be found under the following link.
If you have questions, you can ask them in the discussion section of this repository.
How to cite?
If you are using Systole in a publication we ask you to cite the following paper:
Legrand et al., (2022). Systole: A python package for cardiac signal synchrony and analysis. Journal of Open Source Software, 7(69), 3832, https://doi.org/10.21105/joss.03832
Installation
Systole can be installed using pip:
pip install systole
The following packages are required to use Systole:
Numpy (>=1.21,<=1.26)
SciPy (>=1.3.0)
Pandas (>=0.24)
Numba (>=0.58.0)
Seaborn (>=0.9.0)
Matplotlib (>=3.0.2)
Bokeh (>=3.0.0)
pyserial (>=3.4)
setuptools (>=38.4)
requests (>=2.26.0)
tabulate (>=0.8.9)
The Python version should be 3.7 or higher.
Tutorials
For an introduction to Systole and cardiac signal analysis, you can refer to the following tutorial:
Cardiac signal analysis |
|
Detecting cardiac cycles |
|
Detecting and correcting artefats |
|
Heart rate variability |
|
Instantaneous and evoked heart rate |
|
Working with BIDS folders |
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 import plot_raw
plot_raw(signal[60000 : 120000], modality="ecg", backend="bokeh",
show_heart_rate=True, show_artefacts=True, figsize=300)
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 import plot_subspaces
# R peaks detection
signal, peaks = ecg_peaks(signal, method='pan-tompkins', sfreq=1000)
plot_subspaces(peaks, input_type="peaks", backend="bokeh")
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 import plot_frequency, plot_poincare
row(
plot_frequency(peaks, input_type="peaks", backend="bokeh", figsize=(300, 200)),
plot_poincare(peaks, input_type="peaks", backend="bokeh", figsize=(200, 200)),
)
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).
Interactive visualization of BIDS structured datasets
from systole.viewer import Viewer
view = Viewer(
input_folder="/BIDS/folder/path/",
pattern="task-mytask",
modality="beh",
signal_type="ECG"
)
Inserting and removing peaks
Annotating bad segments
Development
This repository is a fork of the original Systole repository <https://github.com/embodied-computation-group/systole> and is maintained by Nicolas Legrand. 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.
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.
HeartPy: https://python-heart-rate-analysis-toolkit.readthedocs.io/en/latest/
ECG-detector: https://github.com/berndporr/py-ecg-detectors
Pingouin: https://pingouin-stats.org/
NeuroKit2: https://github.com/neuropsychology/NeuroKit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file systole-0.3.0.tar.gz
.
File metadata
- Download URL: systole-0.3.0.tar.gz
- Upload date:
- Size: 123.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee8f3a692e255418736b0b204150fcac66d9fd306ffe70a1680e0979b532baf2 |
|
MD5 | 08677c88cae1bc6963ac43bb17fabfbe |
|
BLAKE2b-256 | 60cf4faab7b159a58bdbdd410ef8d1dd4ba8e0c2cda3f74551c9c8c647ef5f70 |
File details
Details for the file systole-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: systole-0.3.0-py3-none-any.whl
- Upload date:
- Size: 158.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc1b986e546460ef568815f7beccb0362c30635aa962c76fbf7b05a59f439e4b |
|
MD5 | 624bc4c9ceff7c32aa76eaf99de80cc6 |
|
BLAKE2b-256 | a3502eec7c3e5b6043fee4e5e3cf1721589b2b2eb6907ac98d2af26b1dfc434e |