Skip to content

Document multi-segment read behavior and provenance - #769

Merged
tompollard merged 2 commits into
mainfrom
document-multisegment-read-contract
Nov 29, 2026
Merged

tompollard merged 2 commits into
mainfrom
document-multisegment-read-contract

Conversation

@tompollard

@tompollard tompollard commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Document the current multi-segment read contract for #746. rdrecord still combines segments by default; m2s=False preserves a MultiRecord. The guide now explains source_segments ranges relative to a selected view, zero-length layout segments, empty segments, channel alignment, and missing values. The rdrecord docstring makes the default and provenance behavior explicit.

Add an integration test across an empty segment and a data segment in a variable-layout recording. It checks both return forms, selected boundaries, aligned channels, missing values, and named segments with no selected channel data. This PR changes no runtime behavior or public API.

Checks

  • Focused multi-segment and compatibility tests: 16 passed.
  • Ruff lint and format checks passed.
  • Sphinx HTML build passed with warnings treated as errors.

@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 for documenting this behavior. Could we clarify what None and source_segments mean for a channel selection? A nonempty segment can have segments[i] is None when it contains none of the requested channels, and its name and range can still appear in the combined record's source_segments.

For example, selecting only ABP from frames 25740–25750 of the recording used in the new example gives seg_name[1] == "3234460_0001" and segments[1] is None. The combined record still has SourceSegment("3234460_0001", 0, 10), with missing values for ABP throughout. I would state that None can mean either a ~ gap or no selected channels, and that source_segments records overlapping time ranges, not necessarily segments that supplied selected signal values.

@tompollard

Copy link
Copy Markdown
Member Author

Agreed. I reproduced the ABP selection and updated the docs and test in dc71a1d. segments[i] is None now explicitly covers both ~ gaps and named segments with no requested channel values. The source_segments wording now describes overlapping time ranges, including segments that supplied no selected values. The new test checks the named segment, its 0–10 range in the combined record, and the all-missing ABP channel. Focused tests (16 passed), Ruff, and the strict docs build pass locally.

@tompollard
tompollard merged commit f6131f7 into main Nov 29, 2026
19 checks passed
@tompollard
tompollard deleted the document-multisegment-read-contract branch November 29, 2026 11:02
tompollard added a commit that referenced this pull request Nov 29, 2026
## Summary

Prepare WFDB-Python 5.8.0 after the merged, additive metadata work in
#767 and #770. This bumps the version to 5.8.0 and collects the two
changelog fragments. #769 also clarified the existing multi-segment read
contract. The legacy `rdrecord`, `rdheader`, and writer behavior remains
unchanged.

- `Record.metadata` provides an immutable snapshot of the current
logical view and reports every loaded signal form.
- `read_multi_segment_headers` reads the main multi-segment header plus
the layout header (or first non-gap data segment header for fixed
layout), without loading samples or all segment headers.

## Checks

- `uv build` produced the 5.8.0 source distribution and wheel.
- Sphinx HTML build passed with warnings treated as errors.
- `git diff --check` passed.
- The feature PRs passed CI before merging; this release PR will run CI
again.
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