From 1c12797aa1e7a2356343d44f2724565c8ac19854 Mon Sep 17 00:00:00 2001 From: Christian Becke Date: Mon, 24 Apr 2023 18:08:48 +0200 Subject: [PATCH] Add support for Eiger detector at PETRA P13 --- .../format/FormatCBFMiniEigerPetraP13.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/dxtbx/format/FormatCBFMiniEigerPetraP13.py diff --git a/src/dxtbx/format/FormatCBFMiniEigerPetraP13.py b/src/dxtbx/format/FormatCBFMiniEigerPetraP13.py new file mode 100644 index 000000000..d385435a0 --- /dev/null +++ b/src/dxtbx/format/FormatCBFMiniEigerPetraP13.py @@ -0,0 +1,38 @@ +"""An implementation of the CBF image reader for Eiger images""" + + +from __future__ import annotations + +import sys + +from dxtbx.format.FormatCBFMiniEiger import FormatCBFMiniEiger + + +class FormatCBFMiniEigerPetraP13(FormatCBFMiniEiger): + """A class for reading mini CBF format Eiger images, and correctly + constructing a model for the experiment from this. This tuned for Petra P13""" + + @staticmethod + def understand(image_file): + """Check to see if this looks like an Eiger mini CBF format image, + i.e. we can make sense of it.""" + + header = FormatCBFMiniEiger.get_cbf_header(image_file) + + for record in header.split("\n"): + if ( + "# detector" in record.lower() + and "eiger" in record.lower() + and "E-32-0107" in record + ): + return True + + return False + + def _goniometer(self): + return self._goniometer_factory.known_axis((1, 0, 0)) + + +if __name__ == "__main__": + for arg in sys.argv[1:]: + print(FormatCBFMiniEigerPetraP13.understand(arg))