From 963b320e5d61b724373ca70631d218b29f0674d3 Mon Sep 17 00:00:00 2001 From: Daniel Paley Date: Tue, 20 Dec 2022 11:42:30 -0800 Subject: [PATCH 1/5] Change all np.float to float np.float has been a deprecated alias for float and is removed as of v1.24: https://numpy.org/doc/stable/release/1.24.0-notes.html#expired-deprecations --- src/dxtbx/format/FormatCBFFull.py | 2 +- src/dxtbx/format/FormatHDF5PAL.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dxtbx/format/FormatCBFFull.py b/src/dxtbx/format/FormatCBFFull.py index 0bb76089f..b2666deff 100644 --- a/src/dxtbx/format/FormatCBFFull.py +++ b/src/dxtbx/format/FormatCBFFull.py @@ -203,7 +203,7 @@ def get_raw_data(self): array_size = mid, fast elif dtype == b"signed 64-bit real IEEE": array_string = cbf.get_realarray_as_string() - self._raw_data = flex.double(np.fromstring(array_string, np.float)) + self._raw_data = flex.double(np.fromstring(array_string, float)) parameters = cbf.get_realarrayparameters_wdims_fs() slow, mid, fast = (parameters[7], parameters[6], parameters[5]) assert slow == 1 # sections not supported diff --git a/src/dxtbx/format/FormatHDF5PAL.py b/src/dxtbx/format/FormatHDF5PAL.py index eac8d1e59..f9b9cca19 100644 --- a/src/dxtbx/format/FormatHDF5PAL.py +++ b/src/dxtbx/format/FormatHDF5PAL.py @@ -54,7 +54,7 @@ def get_raw_data(self, index=None): data = self._h5_handle[self._run]["scan_dat/raymx_data"][index] # return flex.int(int) # this crashes! # return flex.int(data.astype(np.int)) # this doesn't work! (data is read incorrectly) - return flex.double(data.astype(np.float)) + return flex.double(data.astype(float)) def get_num_images(self): return len(self._h5_handle[self._run]["scan_dat/N"][()]) From 16606f44fb0535d7a90d73ac102ce983a6817a9f Mon Sep 17 00:00:00 2001 From: Daniel Paley Date: Tue, 20 Dec 2022 11:44:12 -0800 Subject: [PATCH 2/5] newsfragment --- newsfragments/XXX.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/XXX.misc diff --git a/newsfragments/XXX.misc b/newsfragments/XXX.misc new file mode 100644 index 000000000..f6df88155 --- /dev/null +++ b/newsfragments/XXX.misc @@ -0,0 +1 @@ +Stop using deprecated np.float From 9e6d4a509a4223ff3da0b48843e689a9eefaf162 Mon Sep 17 00:00:00 2001 From: DiamondLightSource-build-server Date: Tue, 20 Dec 2022 19:50:01 +0000 Subject: [PATCH 3/5] Rename newsfragments/XXX.misc to newsfragments/598.misc --- newsfragments/{XXX.misc => 598.misc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename newsfragments/{XXX.misc => 598.misc} (100%) diff --git a/newsfragments/XXX.misc b/newsfragments/598.misc similarity index 100% rename from newsfragments/XXX.misc rename to newsfragments/598.misc From ebd5ed03698db84bcc2c6adc53c789352869eddc Mon Sep 17 00:00:00 2001 From: Daniel Paley Date: Tue, 20 Dec 2022 11:52:09 -0800 Subject: [PATCH 4/5] remove unused import --- src/dxtbx/format/FormatHDF5PAL.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dxtbx/format/FormatHDF5PAL.py b/src/dxtbx/format/FormatHDF5PAL.py index f9b9cca19..299a1f29a 100644 --- a/src/dxtbx/format/FormatHDF5PAL.py +++ b/src/dxtbx/format/FormatHDF5PAL.py @@ -7,7 +7,6 @@ import sys import h5py -import numpy as np from scitbx.array_family import flex From 4718909acbb5a6bcce4e193a235dae33dd49aef3 Mon Sep 17 00:00:00 2001 From: Daniel Paley Date: Tue, 20 Dec 2022 14:11:53 -0800 Subject: [PATCH 5/5] remove one np.bool --- tests/nexus/test_build_dxtbx_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/nexus/test_build_dxtbx_models.py b/tests/nexus/test_build_dxtbx_models.py index 81da55221..8c5ad9862 100644 --- a/tests/nexus/test_build_dxtbx_models.py +++ b/tests/nexus/test_build_dxtbx_models.py @@ -723,6 +723,6 @@ def test_dataset_as_flex_unsupported(): slices = () with h5py.File(" ", "w", **pytest.h5_in_memory) as f: g = f.create_group("/foo") - d = g.create_dataset("bool", data=np.array([0, 1], dtype=np.bool)) + d = g.create_dataset("bool", data=np.array([0, 1], dtype=bool)) with pytest.raises(TypeError, match="Unsupported dtype .*"): dxtbx.nexus._dataset_as_flex(d, slices)