diff --git a/wfdb/io/annotation.py b/wfdb/io/annotation.py index b398fa07..6ceb2680 100644 --- a/wfdb/io/annotation.py +++ b/wfdb/io/annotation.py @@ -2162,7 +2162,7 @@ def proc_ann_bytes(filebytes, sampto): update = {"subtype": True, "chan": True, "num": True, "aux_note": True} # Get the next label store value - it may indicate additional # fields for this annotation, or the values of the next annotation. - current_label_store = filebytes[bpi, 1] >> 2 + current_label_store = int(filebytes[bpi, 1]) >> 2 while current_label_store > 59: subtype, chan, num, aux_note, update, bpi = proc_extra_field( @@ -2176,7 +2176,7 @@ def proc_ann_bytes(filebytes, sampto): update, ) - current_label_store = filebytes[bpi, 1] >> 2 + current_label_store = int(filebytes[bpi, 1]) >> 2 # Set defaults or carry over previous values if necessary subtype, chan, num, aux_note = update_extra_fields( @@ -2219,7 +2219,7 @@ def proc_core_fields(filebytes, bpi): # The current byte pair will contain either the actual d_sample + annotation store value, # or 0 + SKIP. - while filebytes[bpi, 1] >> 2 == 59: + while int(filebytes[bpi, 1]) >> 2 == 59: # 4 bytes storing dt skip_diff = ( (int(filebytes[bpi + 1, 0]) << 16) @@ -2236,8 +2236,10 @@ def proc_core_fields(filebytes, bpi): bpi = bpi + 3 # Not a skip - it is the actual sample number + annotation type store value - label_store = filebytes[bpi, 1] >> 2 - sample_diff += int(filebytes[bpi, 0] + 256 * (filebytes[bpi, 1] & 3)) + label_store = int(filebytes[bpi, 1]) >> 2 + sample_diff += np.int64(filebytes[bpi, 0]) + 256 * ( + np.int64(filebytes[bpi, 1]) & 3 + ) bpi = bpi + 1 return sample_diff, label_store, bpi @@ -2322,7 +2324,7 @@ def proc_extra_field( aux_notebytes = filebytes[ bpi + 1 : bpi + 1 + int(np.ceil(aux_notelen / 2.0)), : ].flatten() - if aux_notelen & 1: + if int(aux_notelen) & 1: aux_notebytes = aux_notebytes[:-1] # The aux_note string aux_note.append("".join([chr(char) for char in aux_notebytes]))