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.8.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.8-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: psgscoring-0.2.8.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.8.tar.gz
Algorithm Hash digest
SHA256 71d2cfc72c04cdcb806d3c72f46555de4207054d8f1fc367c40d64b9e392c0f1
MD5 ea866c4aa2889f55a7f90c2b5e566291
BLAKE2b-256 fc9da22c844e9017419f0c2cc9905065e86de019455e9056eeeba369caaa050b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: psgscoring-0.2.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 71258ea19f8b15822ca9c92cbeb1ad92065e6266fc8ecde64c256be9ad7c9ae7
MD5 cdf9f74b60a0cd584207650576948896
BLAKE2b-256 7ef442db54e79d02d878e4de927fbc87cd2927929052f28abb01dfbc9ebdf0b2

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