Skip to content

Commit

Permalink
ESRF ID23-2 support (cctbx#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
graeme-winter authored and toastisme committed Jul 11, 2024
1 parent ea8e500 commit 6869e93
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions newsfragments/651.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for Eiger 9M on ESRF ID23-2, which has an undeclared vertical goniometer.
34 changes: 34 additions & 0 deletions src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from __future__ import annotations

import re

import h5py

from dxtbx.format.FormatNXmxEigerFilewriter import FormatNXmxEigerFilewriter

DATA_FILE_RE = re.compile(r"data_\d{6}")


class FormatNXmxEigerFilewriterESRFID232(FormatNXmxEigerFilewriter):
_cached_file_handle = None

@staticmethod
def understand(image_file):
with h5py.File(image_file) as handle:
if "/entry/instrument/detector/detector_number" in handle:
if (
handle["/entry/instrument/detector/detector_number"][()]
== b"E-18-0133"
):
return True
return False

def __init__(self, image_file, **kwargs):
"""Initialise the image structure from the given file."""
super().__init__(image_file, **kwargs)

def _start(self):
super()._start()

def _goniometer(self):
return self._goniometer_factory.known_axis((0, 1, 0))

0 comments on commit 6869e93

Please sign in to comment.