Skip to content

Commit

Permalink
New file writer image dimensions (cctbx#676)
Browse files Browse the repository at this point in the history
New file writer image dimensions

Reported now as slow, fast i.e. correct rather than historical fast, slow
which we have always had to invert

Fixes cctbx#657

Much more sensible fix suggested by @biochem-fan - checks firmware version
using packaging.version as a sane comparitor. Thanks to @spmeisburger for pointing out errors.

Co-authored-by: Takanori Nakane <nakane.t@gmail.com>
  • Loading branch information
graeme-winter and biochem-fan committed Feb 5, 2024
1 parent 3e5ac9b commit 03e7ee0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions newsfragments/676.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Eiger support: following bug fix in DECTRIS file writer, invert the module
dimensions only for older firmware versions. See

https://media.dectris.com/230203-Release_Notes-DECTRIS_EIGER2.pdf

for reference (Corrected data size orientation)
18 changes: 9 additions & 9 deletions src/dxtbx/format/FormatNXmxEigerFilewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import h5py
import nxmx
from packaging import version

from scitbx.array_family import flex

Expand All @@ -14,7 +15,6 @@


class FormatNXmxEigerFilewriter(FormatNXmx):

_cached_file_handle = None

@staticmethod
Expand Down Expand Up @@ -49,14 +49,14 @@ def _get_nxmx(self, fh: h5py.File):
if nxdetector.underload_value is None:
nxdetector.underload_value = 0

# data_size is reversed - we should probably be more specific in when
# we do this, i.e. check data_size is in a list of known reversed
# values
known_safe = [
(1082, 1035),
]
for module in nxdetector.modules:
if not tuple(module.data_size) in known_safe:
# older firmware versions had the detector dimensions inverted
fw_version_string = (
fh["/entry/instrument/detector/detectorSpecific/eiger_fw_version"][()]
.decode()
.replace("release-", "")
)
if version.parse("2022.1.2") > version.parse(fw_version_string):
for module in nxdetector.modules:
module.data_size = module.data_size[::-1]
return nxmx_obj

Expand Down

0 comments on commit 03e7ee0

Please sign in to comment.