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

wrann ValueError

Open toiflm opened this issue 2 years ago • 1 comments

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)

toiflm avatar Jul 05 '23 06:07 toiflm

another suggestion: if len(fs_bytes) == 0 and len(cl_bytes) == 0

toiflm avatar Nov 29 '23 09:11 toiflm