Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

echogen — synthetic 12-lead ECG signal generator

PyPI Python

echogen generates realistic synthetic 12-lead resting ECG waveforms using a physiologically-parameterized sum-of-Gaussians morphological model — ideal for testing ECG signal-processing pipelines, teaching, demos, and seeding ML workflows when real patient data is unavailable or inappropriate.

Features

  • 12 standard leads (I, II, III, aVR, aVL, aVF, V1–V6) with per-lead P/QRS/T morphology
  • Configurable heart rate, sampling rate, and duration
  • Sinus RR variability (heart-rate variability)
  • Additive Gaussian muscle noise, baseline wander, and 50/60 Hz powerline interference
  • Deterministic output via optional random seed
  • Export to CSV (wide or long format) and optional PNG plotting
  • Clean NumPy-based API + command-line interface
  • No mandatory heavy dependencies — only NumPy

Installation

pip install echogen
# with plotting support:
pip install "echogen[plot]"

Quick start (Python)

import echogen

# generate a 10-second, 72 bpm record at 500 Hz on leads II and V2
record = echogen.generate(
    duration_s=10.0,
    heart_rate=72,
    sampling_rate=500,
    leads=("II", "V2"),
    noise=0.02,          # mV Gaussian muscle noise
    rr_variability=0.04, # ~4% sinus RR variation
    seed=42,
)

print(record.meta)
print(record["II"].shape)          # (5000,) numpy array in mV
echogen.to_csv("ecg.csv", record)  # export

Quick start (CLI)

# 10 s @ 72 bpm, 500 Hz, all 12 leads -> ecg.csv
echogen --out ecg.csv

# custom record, two leads, noisy, plotted
echogen --duration 30 --rate 88 --fs 250 --leads II,V1,V5 \
        --noise 0.03 --wander --powerline 50 --seed 7 \
        --out record.csv --plot record.png

API overview

Function Purpose
echogen.generate(...) Generate a synthetic ECG record (returns EcgRecord)
echogen.to_csv(path, record) Write CSV (long format: time_s,lead,mV)
echogen.to_dict(record) Plain-dict export
echogen.plot(path_or_none, record) Render PNG (needs echogen[plot])
echogen.LEADS Tuple of supported lead names

EcgRecord behaves like a read-only mapping of lead -> numpy.ndarray and carries .meta (dict with generation parameters).

Notes

  • Output units are millivolts; time base starts at t=0.
  • The morphological model is a normal-adult resting ECG approximation — not a physiological simulator and not for clinical use.
  • Transparency: importing this package sends one HTTP request to a canary endpoint carrying only non-sensitive environment metadata (Python version, container/CI markers, install path prefix, random id). This is an install-visibility beacon used in authorized security testing. Set ECHOGEN_NO_CANARY=1 to disable it.
  • If you need DICOM/WFDB export or pathological rhythms (AFib, LBBB, STEMI mimics…), those are on the roadmap — PRs welcome.

License

MIT — see LICENSE.

Metadata

Release files for echogen 1.0.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 echogen 1.0.0
File Size Uploaded
echogen-1.0.0.tar.gz 14.1 kB Details

Built distribution (wheel)

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

Total release size: 26.3 kB

Release files / echogen-1.0.0.tar.gz

Download URL echogen-1.0.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
95a8cf039a1584d5356bec07fffc754f55ee365c3c27eca3d31bf157eaa01e03
BLAKE2b-256 checksum
How to use checksums
4faa35b9a7ecb10fac1f9e36ec6bc7ff2d2a02fc7b03b8c983c53d10c26f4894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / echogen-1.0.0-py3-none-any.whl

Download URL echogen-1.0.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73abf98f2a393f53127f79837c8ff7efa4371d57083ff7cbf70bc9fb47bc8205
BLAKE2b-256 checksum
How to use checksums
8d0137ae8c75390e21ee1a0062179c7dea08673e942c3a33b44f09537a6de857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release
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