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 MSA signaltype #39

Merged
merged 3 commits into from
Sep 17, 2022
Merged

Fix MSA signaltype #39

merged 3 commits into from
Sep 17, 2022

Conversation

jlaehne
Copy link
Contributor

@jlaehne jlaehne commented Sep 16, 2022

Description of the change

As brought up in #37, the current implementation of the MSA writer does not comply to the format definitions according to
https://the-mas.org/wp-content/uploads/2018/11/emmff_ascii.txt

In particular, HyperSpy signal_types where written to MSA 1:1, even if they deviate from the allowed strings according to the format definition.

This PR correctly converts HyperSpy signal strings to the corresponding MSA ones when writing. On the reading side, the resulting signal_types don't necessarily correspond to the HyperSpy ones. Correct conversion to signal types of HypersSpy has to be done on the HyperSpy/LumiSpy side (e.g. choosing which voltage corresponds to SEM or TEM) as proposed in #37.

Progress of the PR

  • Change implemented (can be split into several points),
  • [n/a] update docstring (if appropriate),
  • [n/a] update user guide (if appropriate),
  • add an changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting changelog entry in the readthedocs doc build of this PR (link in github checks)
  • add tests,
  • ready for review.

Minimal example of the bug fix or the new feature

import hyperspy.api as hs
s = hs.load("rosettasciio/rsciio/tests/msa_files/minimum_metadata.msa")
s.metadata.Signal.signal_type = "EDS_SEM"
s.save("tmp.msa")
s2 = hs.load("tmp.msa")

Note that this example can be useful to update the user guide.

@codecov
Copy link

codecov bot commented Sep 16, 2022

Codecov Report

Base: 82.73% // Head: 82.90% // Increases project coverage by +0.17% 🎉

Coverage data is based on head (440ce8d) compared to base (57fccc4).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 440ce8d differs from pull request most recent head 162a12d. Consider uploading reports for the commit 162a12d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #39      +/-   ##
==========================================
+ Coverage   82.73%   82.90%   +0.17%     
==========================================
  Files          40       40              
  Lines        8032     8042      +10     
  Branches     1857     1860       +3     
==========================================
+ Hits         6645     6667      +22     
+ Misses        920      911       -9     
+ Partials      467      464       -3     
Impacted Files Coverage Δ
rsciio/msa/api.py 80.23% <100.00%> (+8.62%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

Copy link
Member

@ericpre ericpre left a comment

Choose a reason for hiding this comment

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

Should it have a changelog entry?

rsciio/msa/api.py Outdated Show resolved Hide resolved
@ericpre ericpre merged commit d4e47ec into hyperspy:main Sep 17, 2022
@ericpre ericpre added this to the v0.1.0 initial release milestone Sep 17, 2022
@jlaehne jlaehne deleted the fix-msa-signaltype branch September 17, 2022 10:12
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.

2 participants