MIT-LCP / MIT-LCP/wfdb-python

wrann ValueError

Open
#461 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
853
Forks
322
PR merge metrics
No merged PRs in 30d

Description

When saving annotations, I get this error in wrann:

File "C:\Users\######\venv\Lib\site-packages\wfdb\io\annotation.py", line 943, in wr_ann_file
    if fs_bytes == [] and cl_bytes == []:
       ^^^^^^^^^^^^^^
ValueError: operands could not be broadcast together with shapes (28,) (0,)

This error is raised when fs_bytes (or cl_bytes) is a numpy ndarray that is compared to the empty list.
A possible solution may be, to cast the arrays to lists and then compare them:

if list(fs_bytes) == [] and list(cl_bytes) == []:

(WFDB Version: 4.1.2, Python 3.11)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at wfdb/io/annotation.py line 943 in wr_ann_file and reproduce the annotation-saving path described in the report. Check how fs_bytes and cl_bytes are represented before the empty-value comparison; done means saving annotations no longer raises the reported NumPy broadcasting ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.