Skip to content

Conversation

@PlethoraChutney
Copy link

Hello! Thank you for MDAnalysis! This PR changes how MRC files are checked before being loaded as a 3D grid. Rather than use the is_volume() method from mrcfile we instead use a simpler shape check.

The reason for this is that mrcfile returns False if the ISPG header field of a 3D MRC file is zero. While this is correct according to the spec, most cryoEM software packages save a 0 in this field for a variety of reasons. Because of this unwritten deviation from spec, most packages also read in files with a 0 space group as 3D Volumes anyway, but GridDataFormats does not.

Despite the fact that this is formally correct, I'm proposing that MDAnalysis should follow the behavior that users likely expect from their experience with other packages.

This PR fails three tests, but on my machine at least the current master branch also fails these same tests.

  • gridData/tests/test_grid.py::TestGrid::test_load_wrong_fileformat[ccp4]
  • gridData/tests/test_grid.py::TestGrid::test_load_wrong_fileformat[plt]
  • gridData/tests/test_grid.py::TestGrid::test_load_wrong_fileformat[dx]

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.70%. Comparing base (abd0feb) to head (f391ee3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #149   +/-   ##
=======================================
  Coverage   87.70%   87.70%           
=======================================
  Files           5        5           
  Lines         748      748           
  Branches       97       97           
=======================================
  Hits          656      656           
  Misses         56       56           
  Partials       36       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant