Skip to content

Commit 44ad52b

Browse files
committed
case filebytes[bpi, 1] >> 2 to int
resolve UserWarning: result dtype changed due to the removal of value-based promotion from NumPy. Changed from int64 to uint8.
1 parent 0636c75 commit 44ad52b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wfdb/io/annotation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,7 @@ def proc_ann_bytes(filebytes, sampto):
21622162
update = {"subtype": True, "chan": True, "num": True, "aux_note": True}
21632163
# Get the next label store value - it may indicate additional
21642164
# fields for this annotation, or the values of the next annotation.
2165-
current_label_store = filebytes[bpi, 1] >> 2
2165+
current_label_store = int(filebytes[bpi, 1]) >> 2
21662166

21672167
while current_label_store > 59:
21682168
subtype, chan, num, aux_note, update, bpi = proc_extra_field(
@@ -2176,7 +2176,7 @@ def proc_ann_bytes(filebytes, sampto):
21762176
update,
21772177
)
21782178

2179-
current_label_store = filebytes[bpi, 1] >> 2
2179+
current_label_store = (filebytes[bpi, 1]) >> 2
21802180

21812181
# Set defaults or carry over previous values if necessary
21822182
subtype, chan, num, aux_note = update_extra_fields(
@@ -2236,7 +2236,7 @@ def proc_core_fields(filebytes, bpi):
22362236
bpi = bpi + 3
22372237

22382238
# Not a skip - it is the actual sample number + annotation type store value
2239-
label_store = filebytes[bpi, 1] >> 2
2239+
label_store = (filebytes[bpi, 1]) >> 2
22402240
sample_diff += np.int64(filebytes[bpi, 0]) + 256 * np.int64(
22412241
filebytes[bpi, 1] & 3
22422242
)

0 commit comments

Comments
 (0)