From 0636c75f2af52c9c373d6ed38c33650f55f58c6c Mon Sep 17 00:00:00 2001 From: Tom Pollard Date: Wed, 9 Oct 2024 17:22:49 -0400 Subject: [PATCH] cast filebytes to int/int64 NPY_PROMOTION_STATE=weak_and_warn reports that several variables changed from int64 to uint8. --- wfdb/io/annotation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wfdb/io/annotation.py b/wfdb/io/annotation.py index b398fa07..8182b0cf 100644 --- a/wfdb/io/annotation.py +++ b/wfdb/io/annotation.py @@ -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) @@ -2237,7 +2237,9 @@ def proc_core_fields(filebytes, bpi): # 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)) + sample_diff += np.int64(filebytes[bpi, 0]) + 256 * np.int64( + filebytes[bpi, 1] & 3 + ) bpi = bpi + 1 return sample_diff, label_store, bpi