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 Saving Axes in Metadata #3342

Merged
merged 2 commits into from Mar 26, 2024

Conversation

CSSFrancis
Copy link
Member

@CSSFrancis CSSFrancis commented Mar 26, 2024

Description of the change

This support saving and loading axes in metadata. Currently this occurs when you find_peaks and it would be good to retain this information.

Progress of the PR

  • Change implemented (can be split into several points),
  • 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
import numpy as np
s = hs.signals.Signal1D(np.arange(10))
axis = UniformDataAxis(name="x", units="ly", size=10)
s.metadata.set_item("axis", axis)
s.save("temp.hspy")
hs.load("temp.hspy").metadata

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.56%. Comparing base (9b2ed17) to head (5b01cbe).

Additional details and impacted files
@@                  Coverage Diff                   @@
##           RELEASE_next_patch    #3342      +/-   ##
======================================================
+ Coverage               80.51%   80.56%   +0.04%     
======================================================
  Files                     147      147              
  Lines                   21869    21878       +9     
  Branches                 5146     5147       +1     
======================================================
+ Hits                    17607    17625      +18     
+ Misses                   3044     3036       -8     
+ Partials                 1218     1217       -1     

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

@CSSFrancis CSSFrancis changed the base branch from RELEASE_next_minor to RELEASE_next_patch March 26, 2024 19:38
@ericpre ericpre merged commit 7265401 into hyperspy:RELEASE_next_patch Mar 26, 2024
28 checks passed
@ericpre ericpre linked an issue Mar 26, 2024 that may be closed by this pull request
@ericpre ericpre added this to the v2.0.2 milestone Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saving Axes in metadata Doesn't work with saving
2 participants