wfdb-python icon indicating copy to clipboard operation
wfdb-python copied to clipboard

Add sig and hea stream parameters to rdrecord, rdheader and rdann

Open Ivorforce opened this issue 1 year ago • 2 comments

… in case the file is not read from disk.

This is needed if, for example, files are streamed using a file upload dialog versus read from the file system. Personally, I ran into this limitation using Dash's Upload widget.

There are some basic ToDos:

  • [ ] Documentation
  • [ ] Unit Tests (?)

However, with this PR the code is starting to get a bit messy. I propose the following changes to make it cleaner again (happy to oblige within the PR if accepted):

  • Deprecate no_file field, instead use a None test against sig_data
  • Since all paths end up with a byte stream anyway, separate concerns between file parsing and stream generation. Parsers get streams from loaders, becoming agnostic to file systems and downloads. (Edit: Addressed in #498)

Let me know what you think.

Ivorforce avatar Jun 27 '24 12:06 Ivorforce

Update: I have added the same cabability to rdann.

rdann seems to have an additional problem right now of simply not working. A simple .astype(np.int32) seems to fix the issue, but may not be what's actually needed. Edit: The astype issue is discussed in #493. I have removed the temporary fix from this PR.)

Ivorforce avatar Jul 01 '24 17:07 Ivorforce

Update 2: I have opened #498. That PR is a more comprehensive and streamlined rewrite, and thus supersedes it, in my opinion.

Ivorforce avatar Jul 04 '24 15:07 Ivorforce