Skip to content

Commit 0e23a49

Browse files
bug-fix: Numpy ValueError when cheking empty list equality
Using the equality operator with an empty list will result in the following error. ValueError: operands could not be broadcast together with shapes (28,) (0,) Using len() and inverting the logic avoids this issue.
1 parent 870d792 commit 0e23a49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wfdb/io/annotation.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -940,10 +940,10 @@ def wr_ann_file(self, write_fs, write_dir=""):
940940
core_bytes = self.calc_core_bytes()
941941

942942
# Mark the end of the special annotation types if needed
943-
if fs_bytes == [] and cl_bytes == []:
944-
end_special_bytes = []
945-
else:
943+
if len(fs_bytes) or len(cl_bytes):
946944
end_special_bytes = [0, 236, 255, 255, 255, 255, 1, 0]
945+
else:
946+
end_special_bytes = []
947947

948948
# Write the file
949949
with open(

0 commit comments

Comments
 (0)