From 3f0cbf7d0cf1563e0d3ad821949b9a2c82a2e5d8 Mon Sep 17 00:00:00 2001 From: Graeme Winter Date: Tue, 15 Oct 2024 09:34:27 +0100 Subject: [PATCH] Support 32 bit in nxs2cbf conversion (#759) Working around issues we fixed elsewhere - but never rolled over to the conversion tool Co-authored-by: @noemifrisina --- newsfragments/759.bugfix | 1 + src/dxtbx/util/dlsnxs2cbf.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/759.bugfix diff --git a/newsfragments/759.bugfix b/newsfragments/759.bugfix new file mode 100644 index 000000000..9dc343a64 --- /dev/null +++ b/newsfragments/759.bugfix @@ -0,0 +1 @@ +``dxtbx.dlsnxs2cbf``: add bit_depth_image explicitly to work around issues with data recorded at 32 bit diff --git a/src/dxtbx/util/dlsnxs2cbf.py b/src/dxtbx/util/dlsnxs2cbf.py index 2d45fcf85..cdb6df8cb 100644 --- a/src/dxtbx/util/dlsnxs2cbf.py +++ b/src/dxtbx/util/dlsnxs2cbf.py @@ -185,7 +185,7 @@ def make_cbf( print(f"Writing images to {template}{'#' * num_digits}.cbf:") for j in tqdm(range(num_images), unit=" images"): header = compute_cbf_header(nxmx_obj, j) - (data,) = dxtbx.nexus.get_raw_data(nxdata, nxdetector, j) + (data,) = dxtbx.nexus.get_raw_data(nxdata, nxdetector, j, bit_depth_readout) if bit_depth_readout: # if 32 bit then it is a signed int, I think if 8, 16 then it is # unsigned with the highest two values assigned as masking values