Skip to content

Conversation

@Pradyumn-cloud
Copy link
Contributor

@Pradyumn-cloud Pradyumn-cloud commented Dec 9, 2025

Fix Issue - #108

Add MRC file writing support

  • Implement MRC.write() method
  • Add Grid.export() integration for MRC format
  • Added Test
  • Preserve header information and handle edge cases

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 93.44262% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.20%. Comparing base (394161b) to head (37d03c3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
gridData/mrc.py 92.30% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #147      +/-   ##
==========================================
+ Coverage   87.78%   88.20%   +0.42%     
==========================================
  Files           5        5              
  Lines         753      814      +61     
  Branches       99      107       +8     
==========================================
+ Hits          661      718      +57     
  Misses         56       56              
- Partials       36       40       +4     

☔ 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.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good at first glance but I am not an MRC expert. I'll see if I can get someone else to also have a look.

In the meantime, please also

  • update your branch with the latest changes on master (just did that)
  • add yourself to AUTHORS
  • add an entry to CHANGELOG
  • check your coverage and add tests where necessary

@orbeckst
Copy link
Member

orbeckst commented Dec 9, 2025

@marinegor do you have some experience with MRC files and would you be able to have a very brief look at this PR?

@orbeckst orbeckst requested a review from marinegor December 9, 2025 16:34
@orbeckst orbeckst self-assigned this Dec 9, 2025
Copy link

@marinegor marinegor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR!

I've added couple of comments regarding self.header vs self._mrc_header, and regarding using with open(...).

Also, perhaps it's a good idea to add a small test MRC (say, 4x4x4 with random numbers) file with/without a header that tests things? This way we can actually track regressions if something changes in mrcfile itself, while a roundtrip test won't check that.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor fixes required and please address @marinegor 's comments. That should also help with test coverage.

Did asked changes in changelog and core and added more test
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me a while to get back to the PR. Thank you for addressing all remaining issues and improving the tests. This is good to go and I'll merge.

@orbeckst
Copy link
Member

orbeckst commented Jan 9, 2026

@marinegor could you please have a quick look and confirm that all your concerns have been addressed? Thanks!

@orbeckst
Copy link
Member

@marinegor , to my reading, all your comments have been addressed. I'll wait until tomorrow if you have any comments or want to explicitly approve but I also understand that you're quite busy and might not have the time to come back, in which case I'll dismiss your review and merge.

@orbeckst orbeckst linked an issue Jan 15, 2026 that may be closed by this pull request
@orbeckst orbeckst mentioned this pull request Jan 16, 2026
6 tasks
auto-merge was automatically disabled January 16, 2026 04:15

Head branch was pushed to by a user without write access

@orbeckst orbeckst dismissed marinegor’s stale review January 16, 2026 15:37

Reviewer's comments have been addressed but reviewer has been to busy to re-review.

@orbeckst orbeckst merged commit 30ad179 into MDAnalysis:master Jan 16, 2026
10 checks passed
@orbeckst
Copy link
Member

Thank you for your contribution @Pradyumn-cloud ! 🎉

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.

Add support for writing MRC files

3 participants