Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESRF ID23-2 support #651

Merged
merged 3 commits into from
Aug 10, 2023
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/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

Check warning on line 1 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L1

Added line #L1 was not covered by tests

import re

Check warning on line 3 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L3

Added line #L3 was not covered by tests

import h5py

Check warning on line 5 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L5

Added line #L5 was not covered by tests

from dxtbx.format.FormatNXmxEigerFilewriter import FormatNXmxEigerFilewriter

Check warning on line 7 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L7

Added line #L7 was not covered by tests

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

Check warning on line 9 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L9

Added line #L9 was not covered by tests


class FormatNXmxEigerFilewriterESRFID232(FormatNXmxEigerFilewriter):
_cached_file_handle = None

Check warning on line 13 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L12-L13

Added lines #L12 - L13 were not covered by tests

@staticmethod

Check warning on line 15 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L15

Added line #L15 was not covered by tests
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

Check warning on line 24 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L23-L24

Added lines #L23 - L24 were not covered by tests

def __init__(self, image_file, **kwargs):

Check warning on line 26 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L26

Added line #L26 was not covered by tests
"""Initialise the image structure from the given file."""
super().__init__(image_file, **kwargs)

Check warning on line 28 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L28

Added line #L28 was not covered by tests

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

Check warning on line 31 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L30-L31

Added lines #L30 - L31 were not covered by tests

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

Check warning on line 34 in src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriterESRFID232.py#L33-L34

Added lines #L33 - L34 were not covered by tests
Loading