diff --git a/newsfragments/787.feature b/newsfragments/787.feature new file mode 100644 index 000000000..243de412e --- /dev/null +++ b/newsfragments/787.feature @@ -0,0 +1 @@ +``FormatROD_Arc``: Support for Rigaku HyPix-Arc 100° and 150° curved detectors diff --git a/src/dxtbx/format/FormatROD.py b/src/dxtbx/format/FormatROD.py index 4bf951fd0..7b5a6e8af 100644 --- a/src/dxtbx/format/FormatROD.py +++ b/src/dxtbx/format/FormatROD.py @@ -20,12 +20,14 @@ import numpy as np +from scitbx import matrix from scitbx.array_family import flex from scitbx.math import r3_rotation_axis_and_angle_as_matrix from dxtbx.ext import uncompress_rod_TY6 from dxtbx.format.Format import Format from dxtbx.model.beam import Probe +from dxtbx.model.detector import Detector class FormatROD(Format): @@ -201,13 +203,13 @@ def _start(self): self._gonio_start_angles = ( np.array(self._bin_header["start_angles_steps"]) - * np.array(self._bin_header["step_to_rad"]) + * np.nan_to_num(np.array(self._bin_header["step_to_rad"])) / np.pi * 180 ) self._gonio_end_angles = ( np.array(self._bin_header["end_angles_steps"]) - * np.array(self._bin_header["step_to_rad"]) + * np.nan_to_num(np.array(self._bin_header["step_to_rad"])) / np.pi * 180 ) @@ -482,6 +484,198 @@ def decode_TY6_oneline(self, linedata, w): return ret +class FormatROD_Arc(FormatROD): + @staticmethod + def understand(image_file): + offset = 256 + general_nbytes = 512 + with FormatROD_Arc.open_file(image_file, "rb") as f: + f.seek(offset + general_nbytes + 548) + detector_type = struct.unpack("