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

FormatMRC: relax MZ check #740

Merged
merged 3 commits into from
Jul 10, 2024
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
2 changes: 2 additions & 0 deletions newsfragments/740.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``FormatMRC``: relax restrictive check on the overloaded MZ header
value, which caused failures to read files where MZ == 1
9 changes: 6 additions & 3 deletions src/dxtbx/format/FormatMRC.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@

# 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")

Check warning on line 71 in src/dxtbx/format/FormatMRC.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/FormatMRC.py#L70-L71

Added lines #L70 - L71 were not covered by tests

return hd

Expand Down
Loading