Skip to main content

OkekeClean

PyPI Python 3.12+ License: AGPL v3

OkekeClean is a Python package for detecting artifact in physiological waveforms. It ships released inference code for arterial blood pressure (ABP) and electrocardiogram (ECG) models, and downloads the corresponding model weights from Hugging Face on first use.

Installation

pip install okekeclean

Or with uv:

uv add okekeclean

Quick Start

ABP

import pandas as pd
import torch

from okekeclean import ABPParams, detect_artifacts, load_model

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = load_model("okekeclean-abp-ensemble", device=device)

waveform = pd.Series(
    [80.0, 83.2, 90.5, 102.1, 110.4, 105.0, 96.3, 88.7] * 500,
    index=pd.Timestamp("2025-01-01")
    + pd.to_timedelta(range(4000), unit="s") / 125,
)

artifact_flags = detect_artifacts(
    waveform=waveform,
    modality="ABP",
    model=model,
    params=ABPParams(),
    device=device,
)

ECG

import numpy as np
import pandas as pd
import torch

from okekeclean import ECGParams, detect_artifacts, load_model

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = load_model("okekeclean-ecg-efficientnet_b0", device=device)

samples = 5000
time = np.arange(samples) / 500.0
waveform = pd.Series(
    0.9 * np.sin(2 * np.pi * 1.2 * time) + 0.05 * np.random.randn(samples),
    index=pd.Timestamp("2025-01-01") + pd.to_timedelta(time, unit="s"),
)

artifact_probs = detect_artifacts(
    waveform=waveform,
    modality="ECG",
    model=model,
    params=ECGParams(),
    device=device,
    return_type="probability",
)

Runnable examples:

Released Models

Model Signal Architecture Threshold Test performance
okekeclean-abp-ensemble ABP ResNet-18 (full FT) + EfficientNet-B0 (shallow FT) 0.184 AU-ROC 0.958, sensitivity 0.952, specificity 0.730, accuracy 0.795
okekeclean-abp-resnet18 ABP ResNet-18 (full FT) 0.17785164713859558 AU-ROC 0.951, sensitivity 0.915, specificity 0.824, accuracy 0.851
okekeclean-abp-efficientnet_b0 ABP EfficientNet-B0 (shallow FT) 0.04994076117873192 AU-ROC 0.945, sensitivity 0.799, specificity 0.939, accuracy 0.898
okekeclean-ecg-efficientnet_b0 ECG EfficientNet-B0 (full FT) 0.20802117884159088 AU-ROC 0.970, sensitivity 0.858, specificity 0.950, accuracy 0.922

Input Requirements

  • ABP: pd.Series with a DatetimeIndex, sampled at 125 Hz, units in mmHg.
  • ECG: pd.Series with a DatetimeIndex, sampled at 500 Hz, units in mV. ECG segments are resampled to 500 Hz internally if needed.

Model Weights

License

GNU Affero General Public License v3. See LICENSE.

Citation

@misc{okekeclean,
  title = {OkekeClean},
  author = {Tony Kabilan Okeke},
  year = {2026},
  howpublished = {\url{https://github.com/moberg-analytics/oss-models}}
}

Metadata

Release files for okekeclean 1.1.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 okekeclean 1.1.0
File Size Uploaded Provenance Actions
okekeclean-1.1.0.tar.gz 20.3 kB Without provenance Details for okekeclean-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 41.8 kB

Release files / okekeclean-1.1.0.tar.gz

Download URL okekeclean-1.1.0.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
467ec5374a09e1e7752ad4af7f315425042ff28bc7d6a264287b7ed390b60b89
BLAKE2b-256 checksum
How to use checksums
4e811e671ed9f74fca56a49b89109c30a1b8893886b14e82694f8dad8ed000c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / okekeclean-1.1.0-py3-none-any.whl

Download URL okekeclean-1.1.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2517881a8e8266c90f1099eb2a9f56a7ab57955d3b017a9e1d3adbb5537d11f8
BLAKE2b-256 checksum
How to use checksums
574a3820707a070ebc8c4bc9f36893009853be3d1b80f309119a98728f34e6b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for okekeclean 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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