Skip to content

Modernize iter_dataframes arguments and source paths - #859

Merged
tompollard merged 4 commits into
mainfrom
modern-dataframe-iterator
Dec 2, 2026
Merged

tompollard merged 4 commits into
mainfrom
modern-dataframe-iterator

Conversation

@tompollard

Copy link
Copy Markdown
Member

Summary

Update iter_dataframes to use path, start, stop, kind, signal_alignment, and resolution. 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_dir are removed from this newer API. The docs show the replacements; physionet:// URIs replace pn_dir. Tests cover local and remote records, multi-segment boundaries, skewed aligned/raw reads, multi-frequency smoothing, and named channels.

Verification

  • Offline suite: 1,720 passed, 4 skipped, 23 deselected.
  • Ruff check and format pass.
  • Sphinx HTML build passes with warnings treated as errors.

Closes #856. Related: #852. This branch starts from the same main as the required-layout PR and may need rebasing after that PR merges.

@tompollard

Copy link
Copy Markdown
Member Author

I also corrected this PR's changelog fragment in 3bfb32a, following the release-format issue identified in the reviews on #858 and #860. The Towncrier draft renders and parses as reStructuredText.

@tompollard
tompollard force-pushed the modern-dataframe-iterator branch from 3bfb32a to a7c41b8 Compare December 2, 2026 16:13
@tompollard

Copy link
Copy Markdown
Member Author

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 tompollard left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 raise TypeError, and the replacement names work.
  • Channel names follow the modern policy. channel_names=["MLII", "nope"] now raises Unknown channel name(s): ['nope']; available channel names: ['MLII', 'V5'], while missing_channels="ignore" returns MLII as before. channels together with channel_names is rejected; on main, channel_names silently took precedence. Both changes are in the changelog.
  • Moving the selector validation into _normalize_modern_channel_selection keeps read_record's behaviour, and read_record and iter_dataframes now 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, ran towncrier 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.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks. The migration guide had a short iter_dataframes paragraph, but it left most replacements implicit in the table above. I made the full before-and-after mapping explicit and moved iter_dataframes beside read_signals in the API docs in 94a7d29. The strict Sphinx build passes.

@tompollard
tompollard merged commit 209401d into main Dec 2, 2026
@tompollard
tompollard deleted the modern-dataframe-iterator branch December 2, 2026 16:19
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.

Provide a modern chunked signal reader

1 participant