Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using np.float #598

Merged
merged 5 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/598.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop using deprecated np.float
2 changes: 1 addition & 1 deletion src/dxtbx/format/FormatCBFFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/dxtbx/format/FormatHDF5PAL.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys

import h5py
import numpy as np

from scitbx.array_family import flex

Expand Down Expand Up @@ -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"][()])
Expand Down
2 changes: 1 addition & 1 deletion tests/nexus/test_build_dxtbx_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)