Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Closed
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/XXX.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bugfix: correctly read DECTRIS Eiger file writer NXmx bit depth
7 changes: 4 additions & 3 deletions src/dxtbx/format/FormatNXmxEigerFilewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def get_raw_data(self, index):
nxmx_obj = self._get_nxmx(self._cached_file_handle)
nxdata = nxmx_obj.entries[0].data[0]
nxdetector = nxmx_obj.entries[0].instruments[0].detectors[0]
raw_data = get_raw_data(nxdata, nxdetector, index)
bit_depth = nxdetector.bit_depth_image
raw_data = get_raw_data(nxdata, nxdetector, index, bit_depth)
if self._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
Expand All @@ -63,7 +64,7 @@ def get_raw_data(self, index):


def get_raw_data(
nxdata: nxmx.NXdata, nxdetector: nxmx.NXdetector, index: int
nxdata: nxmx.NXdata, nxdetector: nxmx.NXdetector, index: int, bit_depth: int,
) -> tuple[flex.float | flex.double | flex.int, ...]:
"""Return the raw data for an NXdetector.

Expand All @@ -85,6 +86,6 @@ def get_raw_data(
all_data = []
sliced_outer = data[index]
for module_slices in get_detector_module_slices(nxdetector):
data_as_flex = _dataset_as_flex(sliced_outer, tuple(module_slices))
data_as_flex = _dataset_as_flex(sliced_outer, tuple(module_slices), bit_depth=bit_depth)
all_data.append(data_as_flex)
return tuple(all_data)