From 7f946d6877be52933e9828a6b4d7bfbda3735eb3 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 9 Oct 2024 13:08:46 +0200 Subject: [PATCH] Add NumPy 2 support --- pyproject.toml | 2 +- wfdb/io/_signal.py | 2 ++ wfdb/io/annotation.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0b7822c6..b04cc08c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.7" -numpy = ">=1.10.1,<2.0.0" +numpy = ">=2.0.0" scipy = ">=1.0.0" pandas = ">=1.3.0" SoundFile = ">=0.10.0" diff --git a/wfdb/io/_signal.py b/wfdb/io/_signal.py index 68ca57e4..0171291d 100644 --- a/wfdb/io/_signal.py +++ b/wfdb/io/_signal.py @@ -2312,6 +2312,8 @@ def wr_dat_file( # Non-expanded format always has 1 sample per frame n_sig = d_signal.shape[1] samps_per_frame = [1] * n_sig + + d_signal = d_signal.astype("int64") # Total number of samples per frame (equal to number of signals if # expanded=False, but may be greater for expanded=True) diff --git a/wfdb/io/annotation.py b/wfdb/io/annotation.py index b398fa07..4d451b19 100644 --- a/wfdb/io/annotation.py +++ b/wfdb/io/annotation.py @@ -2237,7 +2237,7 @@ 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 += int(filebytes[bpi, 0]) + 256 * int(filebytes[bpi, 1] & 3) bpi = bpi + 1 return sample_diff, label_store, bpi