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

Fix mrc bugs #131

Merged
merged 9 commits into from
Jun 4, 2023
Merged

Fix mrc bugs #131

merged 9 commits into from
Jun 4, 2023

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented Jun 1, 2023

Fix #71, #91, #93, #96, #130 and some of #60.

Currently including #129 to test updating registry from pull request

Progress of the PR

@ericpre
Copy link
Member Author

ericpre commented Jun 1, 2023

pre-commit.ci autofix

@jlaehne
Copy link
Contributor

jlaehne commented Jun 2, 2023

DOes this PR also fix #130?

@@ -188,20 +193,20 @@ def file_reader(filename, lazy=False, mmap_mode=None, endianess="<", **kwds):
if fei_header is None:
# The scale is in Amstrongs, we convert it to nm
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# The scale is in Amstrongs, we convert it to nm
# The scale is in Angstroms, we convert it to nm

:-)

@jlaehne
Copy link
Contributor

jlaehne commented Jun 2, 2023

@ericpre can you rebase to throw out the unrelated changes and ease the review.

@ericpre
Copy link
Member Author

ericpre commented Jun 2, 2023

There is one more that I need to do here is add an option to specify the navigation shape, because in case of 4D-STEM data saved by Velox, the data seems to be saved as a stack even if the MRC2014 specification supports it - this is consistent with the way mrcfile reads the data.

@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Patch coverage: 86.95% and project coverage change: +0.32 🎉

Comparison is base (b9e67c3) 85.01% compared to head (5eb77ab) 85.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   85.01%   85.33%   +0.32%     
==========================================
  Files          73       73              
  Lines        9062     9076      +14     
  Branches     2049     2053       +4     
==========================================
+ Hits         7704     7745      +41     
+ Misses        893      860      -33     
- Partials      465      471       +6     
Impacted Files Coverage Δ
rsciio/mrc/_api.py 74.64% <86.95%> (+53.59%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ericpre
Copy link
Member Author

ericpre commented Jun 2, 2023

DOes this PR also fix #130?

Yes, it does! :)

@ericpre
Copy link
Member Author

ericpre commented Jun 2, 2023

The failure of the "Test Packaging" build is expected because it downloads the test files from the main branch and the file are not there, not until the PR is merged.

@ericpre ericpre linked an issue Jun 2, 2023 that may be closed by this pull request
@ericpre ericpre requested a review from jlaehne June 2, 2023 19:31
@jlaehne
Copy link
Contributor

jlaehne commented Jun 2, 2023

Would it make sense to add the non-FEI test file from #96 to the tests?
(though it seems that the so far not tested parts of the code seem to be related to FEI headers and this extra file might not give any added value)

@ericpre
Copy link
Member Author

ericpre commented Jun 3, 2023

Would it make sense to add the non-FEI test file from #96 to the tests? (though it seems that the so far not tested parts of the code seem to be related to FEI headers and this extra file might not give any added value)

Yes, mrc files generated by Velox seems to use the "non-FEI" files code path, which is covered by the other files. The file provided in #96 are larger and doesn't seem to increase coverage.

@ericpre
Copy link
Member Author

ericpre commented Jun 3, 2023

While I was at it, improve the documentation to close #93! :)

@ericpre ericpre linked an issue Jun 3, 2023 that may be closed by this pull request
@jlaehne
Copy link
Contributor

jlaehne commented Jun 3, 2023

Would it make sense to add the non-FEI test file from #96 to the tests? (though it seems that the so far not tested parts of the code seem to be related to FEI headers and this extra file might not give any added value)

Yes, mrc files generated by Velox seems to use the "non-FEI" files code path, which is covered by the other files. The file provided in #96 are larger and doesn't seem to increase coverage.

Well one of the current test files is 32 MB, so larger than the 4.5 MB one from #96, but I don't know if could replace that one.

docs/supported_formats/mrc.rst Outdated Show resolved Hide resolved
docs/supported_formats/mrc.rst Outdated Show resolved Hide resolved
docs/supported_formats/mrc.rst Outdated Show resolved Hide resolved
docs/supported_formats/mrc.rst Outdated Show resolved Hide resolved
docs/supported_formats/mrcz.rst Outdated Show resolved Hide resolved
docs/supported_formats/mrcz.rst Outdated Show resolved Hide resolved
@ericpre
Copy link
Member Author

ericpre commented Jun 4, 2023

Well one of the current test files is 32 MB, so larger than the 4.5 MB one from #96, but I don't know if could replace that one.

Sorry, there is a typo in my message and anyway I wasn't very clear! What I should have say to explain my reasoning is:

  • the mrc 4D-STEM test file generated by Velox seems to be as small as they can be.
  • the mrc files generated by IMOD could be smaller and it would be good to ask/get a smaller one and add it later.

@ericpre
Copy link
Member Author

ericpre commented Jun 4, 2023

I would suggest to add other type of mrc files (one from the type in #91) in another PR, once we have got smallest possible file.

@jlaehne jlaehne merged commit 5b43a34 into hyperspy:main Jun 4, 2023
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants