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
1 change: 1 addition & 0 deletions newsfragments/851.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for miniCBF images with inverted rotation axis from SSRF beamlines BL18U1, BL19U1, and BL17U1.
42 changes: 42 additions & 0 deletions src/dxtbx/format/FormatCBFMiniEigerReverse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
An implementation of the CBF image reader for Eiger images for beamlines
with a horizontal, but reversed rotation axis.
"""

from __future__ import annotations

import sys

from dxtbx.format.FormatCBFMiniEiger import FormatCBFMiniEiger


class FormatCBFMiniEigerReverse(FormatCBFMiniEiger):
"""A class for reading mini CBF format Eiger images for beamlines with
a horizontal reversed rotation axis."""

@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 and "Eiger" in record:
if "S/N E-32-0111" in record:
# S/N E-32-0111: SSRF BL17U1
return True

return False

def _goniometer(self):
"""Return a model for a simple single-axis goniometer. This should
probably be checked against the image header, though for miniCBF
there are limited options for this."""

return self._goniometer_factory.single_axis_reverse()


if __name__ == "__main__":
for arg in sys.argv[1:]:
print(FormatCBFMiniEigerReverse.understand(arg))
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"""
An implementation of the CBF image reader for Pilatus images, from the Pilatus
6M SN 100 currently on Diamond I04.
An implementation of the CBF image reader for Pilatus images for beamlines
with a horizontal, but reversed rotation axis.
"""

from __future__ import annotations

from dxtbx.format.FormatCBFMiniPilatus import FormatCBFMiniPilatus


class FormatCBFMiniPilatusXXX(FormatCBFMiniPilatus):
"""A class for reading mini CBF format Pilatus images for 6M SN XXX."""
class FormatCBFMiniPilatusReverse(FormatCBFMiniPilatus):
"""A class for reading mini CBF format Pilatus images for beamlines with
a horizontal reversed rotation axis."""

@staticmethod
def understand(image_file):
Expand All @@ -19,12 +20,11 @@ def understand(image_file):
header = FormatCBFMiniPilatus.get_cbf_header(image_file)

for record in header.split("\n"):
if (
"# Detector" in record
and "PILATUS" in record
and "S/N XX-XXX" in header
):
return True
if "# Detector" in record and "PILATUS" in record:
if "S/N XX-XXX" in record or "S/N 60-0123" in record:
# S/N 60-0123: SSRF BL18U1
# S/N XX-XXX: SSRF BL19U1
return True

return False

Expand Down