Repository navigation
Remove pn_dir from modern readers - #853
Conversation
tompollard
left a comment
There was a problem hiding this comment.
This does what #852 proposed for pn_dir. I'd merge it after a docs touch-up.
What I checked
- On PhysioNet,
read_record("physionet://mitdb/1.0.0/100"),read_annotations(..., annotator="atr")andread_header(...)return the same values, names, samples and symbols as thepn_dir="mitdb/1.0.0"legacy calls. The migration table covers custom index servers with a complete HTTP URL. read_header,read_multi_segment_headers,read_record,read_signalsandread_annotationsno longer acceptpn_dir. The legacy readers still accept it with theFutureWarning. Dropping_check_archive_read_argsfrom thesegmentpath is safe, since its only check waspn_dir.- The offline suite (1,684 passed, 4 skipped), the network tests (23 passed), Ruff, the strict docs build and CI all pass.
Docs that still describe pn_dir as accepted everywhere
A few passages read as if any reader still takes pn_dir, which is no longer true for the newer ones:
docs/io.rstaround line 843: "A remote read needs a URI or the legacypn_dirargument. Passing both a URI andpn_dirraisesValueError."docs/io.rstaround line 1003: the note callingpn_dir"a deprecated way to locate PhysioNet records".README.mdline 104: "The olderpn_dirargument still works but is deprecated."
Saying "with the legacy readers (rdrecord, rdann, ...)" in each place would match the migration guide.
Related, possibly for #852 rather than this PR
iter_dataframes still takes pn_dir, and wraps it with warn_deprecated_pn_dir. It was added in 5.10.0, but its signature uses the legacy names throughout (record_name, sampfrom, sampto, physical, return_res, ignore_skew). The docs list it with the legacy functions, but it's the only chunked reader, so users of the newer API have no alternative. It's worth deciding whether it gets a modern signature (path, start, stop, kind, resolution, signal_alignment, no pn_dir) or a modern replacement.
Merge order
This and #854 conflict in read_signals (adjacent signature, docstring and call lines) and in tests/test_read_record.py. Both conflicts are small and mechanical. Whichever merges second needs a rebase.
|
I updated I agree that chunked reading needs a modern entry point. I filed #856 for the signature and layout decision, keeping it separate from this |
tompollard
left a comment
There was a problem hiding this comment.
Thanks, c977c8e fixes all three passages. docs/io.rst and the README now say that pn_dir works only with the legacy readers and that the newer readers need a complete path or URI. Tracking the chunked reader separately in #856 makes sense.
The offline suite (1,684 passed, 4 skipped), Ruff and the strict docs build pass locally. CI is green, so this is ready to merge.
## Summary Use `signal_alignment="aligned" | "raw"` on `read_record` and `read_signals` in place of `ignore_skew`. The default remains aligned; `"raw"` retains the stored skew, equivalent to the old `ignore_skew=True`. Legacy `rdrecord` keeps its existing parameter. This deliberately changes the recently released modern reader signatures so reads and writes use the same words. The migration guide, API docs, and changelog explain the change. The migration guide also notes that newer signatures are still being refined before the next major release. Tests compare aligned and raw results with the legacy reader, reject invalid values and the removed modern keyword, and update the skew write tests to use the new read option. Part of #852. Rebases on `main` after #851 and #853. ## Verification - Offline suite: 1,715 passed, 4 skipped (`bxb` unavailable), 23 network tests deselected - Ruff check and format check: passed - Sphinx HTML build with warnings as errors: passed
Summary
Remove
pn_dirfrom the modern readers:read_header,read_multi_segment_headers,read_record,read_signals, andread_annotations. They now require a complete local path,physionet://URI, or HTTP URL. Legacy readers retainpn_dirand its migration warning.This deliberately changes recently released signatures while the modern API is still being refined. The migration guide and changelog explain the replacement, including custom HTTP index servers. Tests cover rejection of
pn_dirby modern readers and the existing legacy warnings.Part of #852.
Verification
bxbunavailable), 23 network tests deselected