Skip to main content

Open-source Python library for AASM 2.6-compliant automated polysomnography scoring

Project description

psgscoring

PyPI License: BSD-3 Tests Python Validated

Open-source Python library for AASM 2.6-compliant automated polysomnography scoring.

psgscoring extracts the core respiratory scoring algorithms from YASAFlaskified into a standalone, pip-installable library for the research community.

Validation (v0.2.8)

External validation on the PSG-IPA dataset (PhysioNet, 5 recordings, 47 independent scorer sessions):

PSG Scorers Median AHI psgscoring AHI ΔAHI Severity
SN1 11 6.0 8.1 +2.1 Mild ✓
SN2 4 4.4 9.3 +4.9 Mild / Normal
SN3 12 54.0 53.8 −0.2 Severe ✓
SN4 12 3.5 4.3 +0.8 Normal ✓
SN5 12 9.9 11.4 +1.5 Mild ✓
Mean 1.9 4/5 concordant

Details: Online Supplement (Wiki)

Features

  • AASM 2.6 respiratory scoring: apnea/hypopnea detection with dual-sensor support
  • 12 systematic bias corrections: 6 over-counting + 6 under-counting (details)
  • Breath-amplitude stability filter (v0.2.8): rejects false-positive hypopneas during normal breathing
  • AHI confidence interval: strict/standard/sensitive profiles with robustness grade (A/B/C)
  • Configurable scoring profiles: strict (research), standard (AASM 2.6), sensitive (UARS)
  • ECG-derived effort classification: spectral + TECG for central apnea detection
  • PLM, SpO₂, RERA/RDI, signal quality assessment

Installation

pip install psgscoring

Quick start

from psgscoring import run_pneumo_analysis
import mne

raw = mne.io.read_raw_edf("recording.edf", preload=True)
hypno = ["W", "N1", "N2", "N3", "R", ...]  # 30-s epochs

results = run_pneumo_analysis(raw, hypno, scoring_profile="standard")

# AHI
print(f"AHI: {results['respiratory']['summary']['ahi_total']}")

# AHI confidence interval (v0.2.8)
iv = results["ahi_interval"]
print(f"Interval: [{iv['interval'][0]}{iv['interval'][1]}] Grade: {iv['robustness_grade']}")

What's new in v0.2.8

  • Removed flow smoothing from standard profile (root cause: +54 false hypopneas)
  • Stability filter: rejects hypopneas during stable breathing (CV < 0.45)
  • AHI confidence interval: 3-profile analysis with robustness A/B/C
  • PSG-IPA validation: mean |ΔAHI| = 1.9/h, severity concordance 4/5

Documentation

📖 Online Supplement (Wiki) — signal processing, corrections, validation
📖 Technical Handbook (PDF) — 26-page guide

Live platform

slaapkliniek.be — upload EDF, receive complete PSG report. No installation required.

Citation

Rombaut B, Rombaut B, Rombaut C. psgscoring: An Open-Source Python Library for AASM 2.6-Compliant Automated Polysomnography Scoring. 2026. https://github.com/bartromb/psgscoring

This library builds on YASA:

Vallat R, Walker MP. An open-source, high-performance tool for automated sleep staging. eLife. 2021;10:e70092.

License

BSD-3-Clause. See LICENSE.

Disclaimer: Research use only. Not CE-marked or FDA-cleared. See DISCLAIMER.md.

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

psgscoring-0.2.9.tar.gz (66.4 kB view details)

Uploaded Source

Built Distribution

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

psgscoring-0.2.9-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

Details for the file psgscoring-0.2.9.tar.gz.

File metadata

  • Download URL: psgscoring-0.2.9.tar.gz
  • Upload date:
  • Size: 66.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for psgscoring-0.2.9.tar.gz
Algorithm Hash digest
SHA256 cbe79f08a454b7f104f276420d23a3b6b7ac1365d595ad3be54679775c00fbd0
MD5 65a4e0f09e04d0415b707c94af8a5895
BLAKE2b-256 11317c78598747ff0bb00c4726cbd80f5260dbb686ac9e24c6c388a26698f6b7

See more details on using hashes here.

File details

Details for the file psgscoring-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: psgscoring-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 69.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for psgscoring-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 33d93ae3fb3aefd8de07ce347cd48d22d8a3bc1bdcfeb2ceb1578c08bd886193
MD5 2c0ec0b326f18fd7cae8a0450c25670b
BLAKE2b-256 16b54a8a20deda4b912ccc0c0b2a323829b853c7b8ad31bdb5c174607606b9a1

See more details on using hashes here.

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