Repository navigation
Modernize iter_dataframes arguments and source paths - #859
Conversation
3bfb32a to
a7c41b8
Compare
|
Rebased this branch onto main after #858 merged. The combined code passes the full offline suite (1,721 passed, 4 skipped), Ruff, and the strict Sphinx build. CI is restarting on the updated branch. |
tompollard
left a comment
There was a problem hiding this comment.
This closes #856 as agreed: modern argument names, no pn_dir, and documented smoothing, with the DataFrame staying uniform. One docs gap; otherwise it's ready to merge.
What I checked
- The old keywords (
sampto,pn_dir, and the others) now raiseTypeError, and the replacement names work. - Channel names follow the modern policy.
channel_names=["MLII", "nope"]now raisesUnknown channel name(s): ['nope']; available channel names: ['MLII', 'V5'], whilemissing_channels="ignore"returnsMLIIas before.channelstogether withchannel_namesis rejected; onmain,channel_namessilently took precedence. Both changes are in the changelog. - Moving the selector validation into
_normalize_modern_channel_selectionkeepsread_record's behaviour, andread_recordanditer_dataframesnow share it. - The offline suite (1,720 passed, 4 skipped), the network tests for chunks and
physionet://URIs, Ruff and the strict docs build pass. The updated changelog entry renders correctly: I merged this with #858 and #860, rantowncrier build, and built the docs with-W.
Docs gap
The before-and-after argument mapping is only in docs/io.rst. docs/migration.rst, where users look for signature changes, doesn't mention iter_dataframes. It's a breaking change to a function public since 5.10.0, so a row in the function table or a sentence in the reading-arguments section would help: sampfrom/sampto → start/stop, physical=False → kind="digital", ignore_skew=True → signal_alignment="raw", return_res → resolution, and pn_dir → a physionet:// URI. Relatedly, iter_dataframes is still listed among the legacy functions in the automodule :members: line in docs/io.rst (rdsamp, iter_dataframes, wrsamp, ...). Moving it next to read_signals would match its new status.
|
Thanks. The migration guide had a short |
Summary
Update
iter_dataframesto usepath,start,stop,kind,signal_alignment, andresolution. It now follows the same complete path/URI and channel-name selection rules as the other modern readers. The iterator still caches headers, reads one chunk at a time, and yields a uniform DataFrame, which averages channels with multiple samples per frame.The old argument names and
pn_dirare removed from this newer API. The docs show the replacements;physionet://URIs replacepn_dir. Tests cover local and remote records, multi-segment boundaries, skewed aligned/raw reads, multi-frequency smoothing, and named channels.Verification
Closes #856. Related: #852. This branch starts from the same main as the required-layout PR and may need rebasing after that PR merges.