Add sig and hea stream parameters to rdrecord, rdheader and rdann
… 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
Nonetest 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.
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.)
Update 2: I have opened #498. That PR is a more comprehensive and streamlined rewrite, and thus supersedes it, in my opinion.