Skip to content
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
7 changes: 7 additions & 0 deletions src/nxmx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,13 @@ def bit_depth_readout(self) -> int | None:
return int(self._handle["bit_depth_readout"][()])
return None

@cached_property
def bit_depth_image(self) -> int | None:
"""The number of bits per pixel saved to the image data."""
if "bit_depth_image" in self._handle:
return int(self._handle["bit_depth_image"][()])
return None

@cached_property
def sensor_material(self) -> str:
"""The name of the material a detector sensor is constructed from.
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def nxmx_example():
detector["frame_time"] = 0.1
detector["frame_time"].attrs["units"] = "s"
detector["bit_depth_readout"] = np.array(32)
detector["bit_depth_image"] = np.array(32)

detector_transformations = detector.create_group("transformations")
detector_transformations.attrs["NX_class"] = "NXtransformations"
Expand Down
1 change: 1 addition & 0 deletions tests/test_nxmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def test_nxmx(nxmx_example):
detector.depends_on.path == "/entry/instrument/detector/transformations/det_z"
)
assert detector.bit_depth_readout == 32
assert detector.bit_depth_image == 32
assert detector.beam_center_x == pint.Quantity(2079.79727597266, "pixel")
assert detector.beam_center_y == pint.Quantity(2225.38773853771, "pixel")

Expand Down