Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read multi-frequency multi-segment records #331

Merged
merged 9 commits into from
May 4, 2022

Commits on May 3, 2022

  1. Avoid keyword arguments to Record.check_field.

    Since commit 21764cf, the optional
    parameter to wfdb.io.record.BaseRecord.check_field is called
    "required_channels", not "channels".  The semantics appear equivalent.
    
    Several callers were still referring to the old name "channels", while
    most callers simply use positional arguments.  Change all callers to
    use positional arguments for consistency.
    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    89cfe76 View commit details
    Browse the repository at this point in the history
  2. multi_to_single: set samps_per_frame attribute.

    When reading a multi-segment record, the samps_per_frame attribute
    must be copied from the layout segment into the resulting flattened
    record.
    
    (Unlike most other signal attributes, samples per frame must be
    uniform for a particular signal.  The layout header must be used to
    determine the correct number of samples per frame for signals that are
    not present in the selected segments.)
    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    5ff3563 View commit details
    Browse the repository at this point in the history
  3. multi_to_single: add expanded argument.

    When reading a multi-segment record, the multi_to_single function is
    used to stitch the segments together into a virtual single-segment
    record.
    
    To enable this to work in expanded (non-smooth-frames) mode, we want
    to combine the 'e_p_signal' or 'e_d_signal' arrays from the individual
    segments, rather than 'p_signal' or 'd_signal'.
    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    6cd18ba View commit details
    Browse the repository at this point in the history
  4. multi_to_single: rearrange for readability.

    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    d330a4a View commit details
    Browse the repository at this point in the history
  5. rdrecord: allow smooth_frames=False for multi-segment records.

    When reading a multi-segment, multi-frequency record, we want to have
    the option of reading each signal at its original sampling frequency,
    which requires using smooth_frames=False.  Previously this simply
    wasn't allowed, either with or without multi-to-single conversion.
    
    To do this, we need to ensure each segment is loaded in the
    appropriate (smooth or non-smooth) mode (which formerly would have
    failed if certain segments *didn't* contain multiple samples per
    frame.)
    
    After loading the segments, we must invoke multi_to_single, if
    desired, in the appropriate mode.
    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    8098338 View commit details
    Browse the repository at this point in the history
  6. Test reading fixed-layout multi-frequency signals.

    This test case uses an excerpt of record mimicdb/041/, which is a
    fixed-layout record with three signals at 500 Hz (four samples per
    frame) and four signals at 125 Hz (one sample per frame).
    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    90b8e3b View commit details
    Browse the repository at this point in the history
  7. Test reading variable-layout signals in expanded format.

    Modify the existing test case test_multi_variable_c to check that we
    can read a single-frequency variable-layout record using
    smooth_frames=False (which should retrieve the same data as
    smooth_frames=True, but represented as a list of arrays rather than a
    single array.)
    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    f1f805b View commit details
    Browse the repository at this point in the history
  8. multi_to_single: reformat error message as f-string.

    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    f2044a9 View commit details
    Browse the repository at this point in the history
  9. test_multi_fixed_d: add comments and use assertEqual.

    Benjamin Moody committed May 3, 2022
    Configuration menu
    Copy the full SHA
    4f06a06 View commit details
    Browse the repository at this point in the history