Skip to content

Maybe wfdb should not read .{dat,hea,...}, instead it should be possible to directly give file contents to wfdb. #73

Done

Description

@Dubrzr

The fact that wfdb read files for you and that you don't have to open the file is nice, but when your files are not on the local filesystem it is much more complicated to open those files with wfdb.
For example:
Let's say all my files are on Hadoop HDFS (which is actually the case), the only way to access them in python is using a library such as hdfs3 (https://github.com/dask/hdfs3):

with hdfs.open('/user/data/100.dat') as f:
    content = f.read()
# I am now forced by wfdb to write the contents to a temporary file in the local filesystem to then open it with wfdb...

I know it would be very annoying to modify the current implementation of wfdb but I have the feeling it would be better to let the user choose its own way to give .{dat, hea, ...} contents to wfdb.
The way I see this:

  1. You have the wfdb-python library that only takes contents as input
  2. You have helper functions (downloads from physionet and read the contents for you)

Do you see a better solution?

Activity

  1. changed the title [-]Maybe wfdb should not read .{dat,hea,...}, instead it should be possible to directly give wfdb file contents.[/-] [+]Maybe wfdb should not read .{dat,hea,...}, instead it should be possible to directly give file contents to wfdb.[/+] on Sep 26, 2017
  2. self-assigned this
    on Sep 26, 2017
  3. lkjell commented on Dec 8, 2017

    @lkjell

    I might add to this that there is no way to spesify where .hea files to write to. Currently I can change the directory where .dat writes to by modifying the filename attribute of Record.

  4. removed their assignment
    on May 28, 2020
  5. josemarfdc commented on Jul 6, 2021

    @josemarfdc

    For HDFS, one can always use the NFS gateway and mount the required HDFS path as a NFS folder.
    I'm sure there should be something similar for Object data store (AWS S3, GCS Bucket).

    IMO a better solution would be the ability to write to an IO ByteStream instead. This would give users a memory object that could be managed however needed (HDFS, S3, GCP objects, etc).

    If the maintainers agree, I could try and pitch in some dev time.

  6. tompollard commented on Nov 23, 2026

    @tompollard
    Member

    Supported: records and annotations can now be read through fsspec, including from files held in memory with memory:// paths, without writing them to disk. See "Reading From Memory" in https://wfdb.readthedocs.io/en/latest/io.html.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions