diff --git a/newsfragments/740.bugfix b/newsfragments/740.bugfix new file mode 100644 index 000000000..93337e3d6 --- /dev/null +++ b/newsfragments/740.bugfix @@ -0,0 +1,2 @@ +``FormatMRC``: relax restrictive check on the overloaded MZ header +value, which caused failures to read files where MZ == 1 diff --git a/src/dxtbx/format/FormatMRC.py b/src/dxtbx/format/FormatMRC.py index 4b84858a5..9eefb2fef 100644 --- a/src/dxtbx/format/FormatMRC.py +++ b/src/dxtbx/format/FormatMRC.py @@ -63,9 +63,12 @@ def _unpack_header(header): # For image stacks, NX==MX etc. should always be true. Assert this # to ensure we fail on an MRC file of the wrong type. - assert hd["nx"] == hd["mx"] - assert hd["ny"] == hd["my"] - assert hd["nz"] == hd["mz"] + try: + assert hd["nx"] == hd["mx"] + assert hd["ny"] == hd["my"] + assert (hd["nz"] == hd["mz"]) or (hd["mz"] == 1) + except AssertionError: + raise ValueError("Unexpected data size values in the header") return hd