Skip to content

Clarify the multi-segment record and flattening model #746

Done

Description

@tompollard

Problem

rdrecord() combines a multi-segment record by default and returns a Record; m2s=False preserves a MultiRecord whose segments list contains Record objects or None. Empty segments, variable-layout headers, and metadata available from rdheader() require special handling. A flattened record can carry source_segments, but the public contract for these forms is spread across options and attributes.

Decisions to make

  • What should represent an empty segment, its length, and a variable-layout specification?
  • Which signal metadata should be available from a multi-segment header without loading every segment or sample?
  • How should callers request a combined view versus segment-preserving view, and inspect the source segments of a combined result?
  • Can the logical data interface be independent of single- versus multi-segment storage, while header/layout descriptions retain the format-specific distinction?

Related: #402 (segment representation), #441 (multi-record signal metadata), #442 (multi-segment header reads), #376 (signal return API), and the design review on #417.

Activity

  1. tompollard commented on Nov 29, 2026

    @tompollard
    MemberAuthor

    I think rdrecord() should continue to combine segments by default (m2s=True). Most callers want one continuous signal, and changing the default would break existing code.

    The combined Record should make its segment provenance easy to inspect, including each source segment's name and boundaries in the returned view. The documentation should also explain that combining a variable-layout record aligns channels and fills intervals where a channel is absent with missing values. m2s=False remains the way to preserve the separate segments.

    For a future read_record API, I would spell the option out as combine_segments. We should decide its exact return types and provenance contract here before introducing that API; this does not require changing rdrecord's current default.

  2. tompollard commented on Dec 1, 2026

    @tompollard
    MemberAuthor

    Follow-up from #828: we now have SegmentReference for names and lengths in a source header, SourceSegment for ranges in a combined returned view, and SegmentView for ranges and roles in a preserved MultiRecord. These describe different coordinate systems, but we should review whether their shared fields and terminology can converge without confusing source layout with the returned selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions