Add CAP Sleep Database reader - #321
Conversation
|
Could you rebase to pull in some new Ruff rules please? |
2ae7ce5 to
781eff4
Compare
|
Done, I rebased the branch onto the current main and updated the code for the new Ruff rules. Local checks pass: Ruff, formatting, mypy, and the full test suite with 68 tests. |
|
Very nice! Just one thing that should be checked: if
Compare Suggested fix: cache |
|
Thanks for catching this. I updated the reader so cached mode downloads only the annotation files and never downloads or reads an EDF. The ECG path now stores the recording start time and duration alongside the cached heartbeat array, and cached mode restores them from that metadata. I also added a regression test that fails if cached mode attempts to download or read an EDF. Ruff, formatting, mypy, and the full test suite pass locally: 69 tests. |
|
Perfect! Thanks @viranovskaya! |
Closes #35.
This adds
read_capslpdb()for the CAP Sleep Database. The reader:Eventfield for sleep stages and maps S3 and S4 to N3;n16because it does not contain an ECG channel;I checked the parser against all 108 public annotation files, containing 108,720 valid sleep-stage rows.
nfle27has one malformed row, which is skipped with a warning. I also ran the complete reader onn12, producing 990 sleep-stage epochs and 30,656 heartbeat times.The tests cover stage mapping, time and header variants, missing rows, EDF boundaries, midnight alignment, malformed rows, irregular grids, bipolar ECG, heartbeat rebasing,
n16, and downloaded EDF cleanup.