From bb45d6ce88261723931f83e196ba571830f1e974 Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Mon, 25 Mar 2024 18:07:41 +0100 Subject: [PATCH 1/2] fix numpy2 compatibility --- src/fabio/OXDimage.py | 2 +- src/fabio/test/codecs/test_esperantoimage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fabio/OXDimage.py b/src/fabio/OXDimage.py index 80fb02f26..6b5ea2321 100644 --- a/src/fabio/OXDimage.py +++ b/src/fabio/OXDimage.py @@ -482,7 +482,7 @@ def dec_TY5(self, stream): dim2 = self._shape[0] while pos_inp < stream_size and pos_out < array_size: if pos_out % dim2 == 0: - last = 0 + last = numpy.int64(0) else: last = current value = raw[pos_inp] diff --git a/src/fabio/test/codecs/test_esperantoimage.py b/src/fabio/test/codecs/test_esperantoimage.py index 9d70f9d10..c5d9aa5ca 100644 --- a/src/fabio/test/codecs/test_esperantoimage.py +++ b/src/fabio/test/codecs/test_esperantoimage.py @@ -134,7 +134,7 @@ def test_data(self): def test_values(self): esp = fabio.open(UtilsTest.getimage("reference.esperanto.bz2")[:-4]) npy = fabio.open(UtilsTest.getimage("reference.npy.bz2")[:-4]) - self.assertEqual(numpy.alltrue(esp.data == npy.data), True, "Images are the same") + self.assertEqual(numpy.all(esp.data == npy.data), True, "Images are the same") def suite(): From 981a437b9dcb5dc04fa0d24248f78fe60c2ae507 Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Tue, 26 Mar 2024 13:19:29 +0100 Subject: [PATCH 2/2] Update src/fabio/test/codecs/test_esperantoimage.py Co-authored-by: Thomas VINCENT --- src/fabio/test/codecs/test_esperantoimage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fabio/test/codecs/test_esperantoimage.py b/src/fabio/test/codecs/test_esperantoimage.py index c5d9aa5ca..b86c94928 100644 --- a/src/fabio/test/codecs/test_esperantoimage.py +++ b/src/fabio/test/codecs/test_esperantoimage.py @@ -134,7 +134,7 @@ def test_data(self): def test_values(self): esp = fabio.open(UtilsTest.getimage("reference.esperanto.bz2")[:-4]) npy = fabio.open(UtilsTest.getimage("reference.npy.bz2")[:-4]) - self.assertEqual(numpy.all(esp.data == npy.data), True, "Images are the same") + self.assertTrue(numpy.array_equal(esp.data, npy.data), "Images are the same") def suite():