Skip to main content

ECG waveform delineation for P, QRS, and T waves with WFDB-compatible annotations

Project description

PQRSTann

DOI

PQRSTann is a Python module for beat-to-beat ECG waveform delineation, providing annotations of complete P, QRS, and T waves, including both peaks and waveform boundaries, in WFDB-compatible formats. The module supports delineation of individual ECG cycles as well as full ECG waveforms.

Peak detection is performed using the Pan-Tompkins algorithm [1], after which PQRST boundaries are identified using algorithms described in [2, 3].

Key features of PQRSTann:

  • Customizable parameters for tuning performance for different signal conditions which includes Adult and Fetal ECG signals
  • Provides for single beat detection as well with an optional provided param of DEFAULT_RR_MS
  • Works with signals of any sampling frequency
  • Optional utility to save annotations to WFDB or CSV formats
  • Allows for use of different R-peak detectors including use of own, instead of Pan-tompkins algorithm

PQRSTann is primarily a Python reimplementation of ECGPUWAVE provided by PhysioNet, with extensions aimed at improved performance and usability.

Methods

get_pqrst_anns(file_path, channel=0, fs=None, write_annotation_file=False, r_peaks=None, running_rr=None, qrs_detector='pantompkins', params=None)
  • file_path (str): Path to the WFDB record (excluding the .dat or .hea extension).
  • channel (int, default=0): The index of the ECG channel/lead to process.
  • fs (float, optional): Sampling frequency of the signal in Hz.
  • write_annotation_file (bool, default=False): If True, writes the output annotations to a WFDB-compatible file alongside the original record.
  • r_peaks (array-like, optional): Pre-computed R-peak sample indices.
  • running_rr (array-like, optional): Array of RR intervals (in milliseconds). Overrides the dynamic interval calculation (which is necessary for single-cycle delineation where historical interval data is absent).
  • qrs_detector (str, default="pantompkins"): The algorithm used for initial R-peak detection.
  • params (dict, optional): Dictionary to tune algorithmic performance and override default constraints. This allows users to optimize the detector for different signal conditions.

Results

PQRSTann was qualitatively validated on adult (MIT-BIH Arrhythmia Database, MIT-BIH Normal Sinus Rhythm Database) and fetal ECG datasets (ADFECGDB scalp recordings, FECGSYN data). Qualitative comparisons with ECGPUWAVE (Physionet) are provided where it could be obtained.

Adult ECG

Adult ECG Validation (Top row: ECGPUWAVE Reference. Bottom row: PQRSTann)

Fetal ECG

Fetal ECG Validation

Dynamic Window Configuration for Fetal ECG signals

Because fetal heart rates and waveform morphologies differ significantly from adult ECGs, PQRSTann supports dynamic windowing to isolate specific wave characteristics. During validation, the P-wave search windows were explicitly tuned for the target physiology via the params dictionary:

  • Adult ECG Parameters:

    • PWAVE_SEARCH_WINDOW_START_MS: 225
    • PWAVE_SEARCH_WINDOW_END_MS: 70
  • Fetal ECG Parameters:

    • PWAVE_SEARCH_WINDOW_START_MS: 165
    • PWAVE_SEARCH_WINDOW_END_MS: 41

Acknowledgements

This module was primarily developed by Shaun Dsouza as part of a collaborative work between Sardar Patel Institute of Technology (Mumbai) and Indian Institute of Technology Bombay.

References

[1] Pan, Jiapu, and Willis J. Tompkins. "A real-time QRS detection algorithm." IEEE transactions on biomedical engineering 3 (2007): 230-236.

[2] Laguna, Pablo, Raimon Jané, and Pere Caminal. "Automatic detection of wave boundaries in multilead ECG signals: Validation with the CSE database." Computers and biomedical research 27.1 (1994): 45-60.

[3] Jane, R., et al. "Evaluation of an automatic threshold based detector of waveform limits in Holter ECG with the QT database." Computers in Cardiology 1997. IEEE, 1997.

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

pqrstann-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

pqrstann-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file pqrstann-0.1.0.tar.gz.

File metadata

  • Download URL: pqrstann-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pqrstann-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9a5a4b2bc29d9fdbeb4426dccc4e833448e8e8404d1bcac18e6f6ba88209ab5
MD5 a7c7350678b73933943a1cae5708f456
BLAKE2b-256 a261ead600356a64695ed2698baa1cfa98b912efb9c972763c8c491960f48992

See more details on using hashes here.

Provenance

The following attestation bundles were made for pqrstann-0.1.0.tar.gz:

Publisher: publish.yml on foreverallama/PQRSTann

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pqrstann-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pqrstann-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pqrstann-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4a57410a060cac4b61a3f50c8b76fce022944748994e8278a7baab176f3c740
MD5 63582792919d4b29cc070e899d77aa1d
BLAKE2b-256 2376131ace032267d363349812898ffdb0195e71846e22ec2a1808b8f2ff44df

See more details on using hashes here.

Provenance

The following attestation bundles were made for pqrstann-0.1.0-py3-none-any.whl:

Publisher: publish.yml on foreverallama/PQRSTann

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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