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

One malformed signal in mimic3 matched?

Open covertg opened this issue 1 year ago • 1 comments

Hi,

I've been using wfdb-python to parse numerics from the mimic3 waveforms database at large. I've found just one file that appears to be unreadable by wfdb, from patient p086831. Here's a minimum example (pulling from the online database):

import wfdb
rec_id = "p086831-2130-12-29-18-28n"
# rec_path = "mimic3wdb/1.0/matched/p08/p086831/"
rec_path = "mimic3wdb-matched/1.0/p08/p086831/"
rec = wfdb.rdrecord(rec_id, pn_dir=rec_path)
ValueError                                Traceback (most recent call last)
Cell In[6], line 6
      4 # rec_path = "mimic3wdb/1.0/matched/p08/p086831/"
      5 rec_path = "mimic3wdb-matched/1.0/p08/p086831/"
----> 6 rec = wfdb.rdrecord(rec_id, pn_dir=rec_path)
...
File .../venv/lib/python3.11/site-packages/wfdb/io/_signal.py:2051, in _check_sig_dims(sig, read_len, n_sig, samps_per_frame)
   2049 for ch in range(n_sig):
   2050     if len(sig[ch]) != samps_per_frame[ch] * read_len:
-> 2051         raise ValueError("Samples were not loaded correctly")

ValueError: Samples were not loaded correctly

This also occurs when pulling the respective .hea and .dat files locally and using wfdb from there.

Perhaps this is an issue with the MIMIC file itself, but I wanted to start here, since I'm not sure how to tell. Might this be a MIMIC bug, or is this a wfdb issue?

Thanks in advance--

covertg avatar Jun 26 '23 18:06 covertg