MCPcopy Index your code
hub / github.com/cbrnr/sleepecg

github.com/cbrnr/sleepecg @v0.5.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.9 ↗ · + Follow
116 symbols 642 edges 31 files 97 documented · 84%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Python PyPI Docs DOI License

SleepECG

SleepECG provides tools for sleep stage classification when EEG signals are not available. Based only on ECG, SleepECG provides functions for

  • downloading and reading open polysomnography datasets,
  • detecting heartbeats from ECG signals, and
  • classifying sleep stages (which includes preprocessing, feature extraction, and classification).

Documentation

Documentation for SleepECG is available on Read the Docs. Check out the changelog to learn what we added, changed, or fixed.

Installation

SleepECG is available on PyPI and can be installed with pip:

pip install sleepecg

SleepECG with all optional dependencies can be installed with the following command:

pip install "sleepecg[full]"

If you want the latest development version, use the following command:

pip install git+https://github.com/cbrnr/sleepecg

Example

The following example detects heartbeats in a short ECG (a one-dimensional NumPy array):

import numpy as np
from sleepecg import detect_heartbeats, get_toy_ecg

ecg, fs = get_toy_ecg()  # 5 min of ECG data at 360 Hz
beats = detect_heartbeats(ecg, fs)  # indices of detected heartbeats

Contributing

The contributing guide contains detailed instructions on how to contribute to SleepECG.

Core symbols most depended-on inside this repo

Shape

Function 96
Class 12
Method 7
Route 1

Languages

Python97%
C3%

Modules by API surface

src/sleepecg/classification.py15 symbols
tests/test_heartbeat_detection.py11 symbols
src/sleepecg/feature_extraction.py11 symbols
src/sleepecg/io/sleep_readers.py9 symbols
src/sleepecg/io/ecg_readers.py8 symbols
tests/test_sleep_readers.py7 symbols
src/sleepecg/heartbeats.py7 symbols
tests/test_config.py5 symbols
src/sleepecg/io/nsrr.py5 symbols
tests/test_nsrr.py4 symbols
src/sleepecg/utils.py4 symbols
src/sleepecg/config.py4 symbols

For agents

$ claude mcp add sleepecg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page