Skip to content

Add read_signals as a structured signal reader - #798

Merged
tompollard merged 3 commits into
mainfrom
api/read-signals
Nov 30, 2026
Merged

tompollard merged 3 commits into
mainfrom
api/read-signals

Conversation

@tompollard

@tompollard tompollard commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Rename the structured signal reader to read_signals. It returns the existing SignalRead result with explicit uniform or expanded layout, values, logical metadata, and source segment provenance. The provisional read_signal_values name was available only in 5.10.0 and is removed. Legacy rdsamp keeps its tuple return.

Document read_signals, migrate the tests to it, and add a changelog entry for the planned 5.11.0 release.

Checks

  • Offline pytest suite: 1,218 passed, 4 skipped, 22 deselected
  • Ruff check and format check
  • Sphinx HTML build with warnings treated as errors

Related to #376 and #672.

@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.

Thanks. The wrapper passes every option through, and the signatures and defaults currently match. The offline suite, Ruff and the strict docs build pass locally.

My main concern is the design. read_signal_values came out in 5.10.0 today, and the docs describe it as provisional while the #672 naming is settled. Adding read_signals alongside it leaves two public names for one function, and every docs passage now has to mention both. Removing one later would need a deprecation cycle. Since we removed warn_empty from the new readers for the same reason, could we do the same here: rename read_signal_values to read_signals, and note in the changelog that the old name was available briefly in 5.10.0? If you'd prefer to be cautious, a thin alias that emits DeprecationWarning would also work, but I'd avoid two equal names.

Either way, the full copy of the signature and docstring should go. The copies have already drifted (path is "str or os.PathLike" in read_signals and "str" in read_signal_values), and every future parameter would need adding twice. After a rename, the docs edits also become simpler: one name instead of "read_signals and read_signal_values" in five places.

@tompollard

Copy link
Copy Markdown
Member Author

Agreed. I changed read_signals to be the implementation and removed the duplicate signature and docstring. The docs and main tests now use that name.

I kept read_signal_values as a thin alias with a DeprecationWarning, since it was released in 5.10.0 and 5.11.0 is a minor release. The changelog says it is deprecated, and a test checks both the warning and the result. The full offline suite passes (1,217 passed), as do Ruff and the strict docs build.

@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.

Thanks, this is much cleaner. read_signals is now the single implementation with one docstring, nothing in the package or docs calls the old name (the remaining mentions are the 5.10.0 entries in docs/changes.rst, which should stay), and the suite passes with the package's own DeprecationWarnings treated as errors. The offline suite, Ruff and the strict docs build pass locally.

On reflection, let's remove read_signal_values rather than deprecate it, as we did for warn_empty. It has been public for about a day, the docs marked it provisional, and a deprecated alias would stay in the namespace until the next major release. Could you:

  • delete the alias from record.py and from the exports in wfdb/__init__.py and wfdb/io/__init__.py, so the old name raises the usual AttributeError or ImportError;
  • replace test_deprecated_signal_values_alias with a test that wfdb.read_signal_values no longer exists, keeping the read_signals result checks;
  • change the changelog from "remains as a deprecated alias" to say read_signal_values was renamed to read_signals and was available only in 5.10.0.

@tompollard

Copy link
Copy Markdown
Member Author

Agreed. I removed read_signal_values entirely in 6226522, including both public exports. read_signals is the only name now; the old name raises the usual AttributeError or ImportError. I replaced the alias test with an absence check and kept result tests for physical and digital values in uniform and expanded layouts.

The changelog now says the provisional name was available only in 5.10.0. The full offline suite passes (1,218 passed), as do Ruff and the strict docs build. I updated the PR description to match.

@tompollard
tompollard merged commit af3712c into main Nov 30, 2026
19 checks passed
@tompollard
tompollard deleted the api/read-signals branch November 30, 2026 18:22
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.

1 participant