Skip to content

Allow None for annotations without notes in wrann - #614

Merged
tompollard merged 1 commit into
MIT-LCP:mainfrom
TheNetherWatcher:wrann-aux-note-none
Oct 31, 2026
Merged

tompollard merged 1 commit into
MIT-LCP:mainfrom
TheNetherWatcher:wrann-aux-note-none

Conversation

@TheNetherWatcher

@TheNetherWatcher TheNetherWatcher commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Found by @tompollard while reviewing #605.

The wrann docstring (and the Annotation example) say an aux note can be None for annotations without a note, but None was rejected:

wfdb.wrann("a", "atr", np.array([1, 5, 9]), symbol=["N", "N", "V"], aux_note=[None, "(VT", None])
# TypeError: Subelements of the aux_note field must be strings

compact_fields already turns empty notes into None before writing, so the writer handles None. Only check_field rejected it. It now skips None in aux_note, so None is written exactly like "" (byte-identical files), and rdann reads both back as "". I kept the docstring as it is, since it already describes this.

Tests: None and "" notes give byte-identical files, and read back as "". The test fails on main. pytest -m "not network" passes (100 tests), and the docs build passes.

The docstring says aux_note can hold None for annotations without a
note, and compact_fields already writes None like an empty string, but
check_field rejected it with a TypeError.
@tompollard
tompollard merged commit 68e458f into MIT-LCP:main Oct 31, 2026
18 checks passed
@TheNetherWatcher
TheNetherWatcher deleted the wrann-aux-note-none branch November 1, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants