diff --git a/newsfragments/598.misc b/newsfragments/598.misc new file mode 100644 index 000000000..f6df88155 --- /dev/null +++ b/newsfragments/598.misc @@ -0,0 +1 @@ +Stop using deprecated np.float 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..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 @@ -54,7 +53,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"][()]) 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)