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

Metadata descriptors #3123

Open
wants to merge 2 commits into
base: RELEASE_next_minor
Choose a base branch
from

Conversation

CSSFrancis
Copy link
Member

Description of the change

This adds the MetadataAttribute class to hyperspy which maps metadata to an attribute of a class:

Progress of the PR

  • Change implemented (can be split into several points),
  • update developer guide (if appropriate),
  • add an changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • add tests,
  • ready for review.

Minimal example of the bug fix or the new feature

class MySignal2D(Signal2D):
    self.title = AttributeDescriptor("General.title")

    def __init__(self,....): 
        # Initialize the signal etc....


s = MySignal2D(np.ones((2,2,2)))

print(s.title) # ""
 s.title = "test"
print(s.title) # "test"
print(s.metadata.General.title) # "test"

#3122 for reference

@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a3cf218) 80.81% compared to head (3eedc34) 83.83%.
Report is 816 commits behind head on RELEASE_next_major.

Additional details and impacted files
@@                  Coverage Diff                   @@
##           RELEASE_next_major    #3123      +/-   ##
======================================================
+ Coverage               80.81%   83.83%   +3.02%     
======================================================
  Files                     176      201      +25     
  Lines                   24502    33625    +9123     
  Branches                 5456     9037    +3581     
======================================================
+ Hits                    19802    28191    +8389     
- Misses                   3374     3813     +439     
- Partials                 1326     1621     +295     

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

@CSSFrancis
Copy link
Member Author

@jlaehne You might be interested in this as well!

@CSSFrancis CSSFrancis deleted the branch hyperspy:RELEASE_next_minor December 22, 2023 14:03
@CSSFrancis CSSFrancis closed this Dec 22, 2023
@ericpre
Copy link
Member

ericpre commented Dec 22, 2023

Re-opening because this has been closed automatically by mistake!

@ericpre ericpre reopened this Dec 22, 2023
@ericpre ericpre changed the base branch from RELEASE_next_major to RELEASE_next_minor December 22, 2023 16:34
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.

None yet

2 participants