Skip to content

Commit

Permalink
Check firmware version
Browse files Browse the repository at this point in the history
Much more sensible fix suggested by @biochem-fan - checks firmware version
using packaging.version as a sane comparitor
  • Loading branch information
graeme-winter committed Jan 19, 2024
1 parent fba5dea commit 00acdfc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 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,15 +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),
(4150, 4371),
]
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 = (

Check warning on line 53 in src/dxtbx/format/FormatNXmxEigerFilewriter.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatNXmxEigerFilewriter.py#L53

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

Please sign in to comment.