Skip to main content

Library description

This library is meant to be used to check quality of ECG signal. Recordings of any length can be processed, memory is the only limit. The library work with three basic levels of quality:

  • Quality 1 : All important segment of ECG can be detected in the signal
  • Quality 2 : Noise is present, but the QRS complex can still be detected
  • Quality 3 : Noise is too large, not even QRS complex can be detected

Each model works with a sliding window. At each step, the window is evaluated using one of 4 models and one score from range 0 to 1 is returned. The length of sliding windows for individual models can be found in their names. The 4 supported models are:

  • cnn2s
  • cnn5s
  • lstm2s
  • oscnn2s

The stride of the sliding window can be specified. The class limits so this value is at least 1 second and is a divisor of the length of the sliding window.

There are currently 4 return modes supported:

  • score : The model returns the score between 0 and 1. 0 is meant to represent quality 1, 0.5 to represent quality 2 and 1 to represent quality 3. This is however not given and the score distributions of different qualities can differ between models.
  • three_value : Three qualities are given using thresholds.
  • bin_clean : Signal is either marked as quality 1 or as quality 2/3
  • bin_qrs: Signal is either marked as quality 1/2 or as quality 3

The thresholds used in each of these modes, except of score, can be specified by the user. However, there are default thresholds, that aim to prioritize precision with the better classes. When using three_value, the returned values are one of 1, 2 and 3, depending on the quality of the signal. When using either of the binary modes, the returned values are either 1 or 2. 1 is for the better quality signal and 2 is for the worse quality.

In terms of length of output, there are two return_types supported:

  • intervals : value is returned for each window of the size stride, since the value of the quality ill not change in these
  • full : value is returned for each value in the input

Models were trained on cleaned data. These data were cleaned using default NeuroKit2 ecg_clean method. The class can clean signal it is meant to process using ecg_clean. Currently only default version of ecg_clean us supported. It can be specified not to do this. However, it is advised to either use this option, or to pass cleaned signal to the method. We give no guarantee about the quality of the signal if uncleaned signal is processed and no cleaning is done..

Signal processed must have frequency of 250 Hz. Signal of other frequencies is not supported as the models are not trained on such a signal.

Full explanation of all the modes can be found inside the source code documentation.

Installation

The library can be easily installed through the pip utility.

pip install ecg-quality

Usage

The library offers a high-level interface. The simplest example using all the default settings:

from ecg_quality.ECGQualityChecker import ECGQualityChecker  

checker = ECGQualityChecker()  
 
signal = ...	 

output = checker.process_signal(signal)  

Metadata

Release files for ecg-quality 0.2.0

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

Source distribution (sdist)

Source distribution for ecg-quality 0.2.0
File Size Uploaded
ecg_quality-0.2.0.tar.gz 8.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ecg-quality 0.2.0
File Interpreter ABI Platform
ecg_quality-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 MB

Release files / ecg_quality-0.2.0.tar.gz

Download URL ecg_quality-0.2.0.tar.gz
Size 8.3 MB
Tags Source
SHA-256 checksum
How to use checksums
4d6fc839204367d727675ec4d2ab8425663990e9b05849b66b8511c5f7bb43d5
BLAKE2b-256 checksum
How to use checksums
e2b024c8ef3c9e750e702a353af3c82c5d0caab42bfef043b996238f9f90a7ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / ecg_quality-0.2.0-py3-none-any.whl

Download URL ecg_quality-0.2.0-py3-none-any.whl
Size 8.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bc9713b2ccc4ee65137f47f2293f83bb2ab2f8a848e016b0329c453264e38bba
BLAKE2b-256 checksum
How to use checksums
ac81c41b48cdb30df30ca33a3c9695fd981afe760073a59b988ad89598673762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

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