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

add a metadata comparison method #706

Merged
merged 7 commits into from May 17, 2023
Merged

Conversation

KaraMelih
Copy link
Contributor

What is the problem / what does the code in this PR do
Some low-level changes might result in a new metadata and it is not always easy to find what was changed.

Can you briefly describe how it works?

for any context st the method can be called as st.compare_metadata(runid, target, compared_meta)

compared_meta can be file path to the old metadata json, a dictionary, or a tuple with new runid, target pair.

Can you give a minimal working example (or illustrate with a figure)?

current_metadata = st.get_metadata(runid, 'peak_basics')
corrupted_metadata = copy.deepcopy(current_metadata)
corrupted_metadata['lineage']['merged_s2s'][2]['gain_model'] = ['to_pe_model', 'v6', False]
corrupted_metadata.pop('strax_version')
st.compare_metadata(runid, "peak_basics", corrupted_metadata)
[out]
> values_changed
	 in ['lineage']['merged_s2s'][2]['gain_model'][2]
		True -> False
> dictionary_item_removed  ->	root['strax_version']

Please include the following if applicable:

  • Update the docstring(s)
  • Update the documentation
  • Tests to check the (new) code is working as desired.
  • Does it solve one of the open issues on github?

Please make sure that all automated tests have passed before asking for a review (you can save the PR as a draft otherwise).

@coveralls
Copy link

coveralls commented Apr 7, 2023

Coverage Status

Coverage: 91.426% (-0.7%) from 92.143% when pulling 2005b92 on KaraMelih:master into 0bc1754 on AxFoundation:master.

@dachengx dachengx self-requested a review May 3, 2023 13:42
Copy link
Collaborator

@dachengx dachengx left a comment

Choose a reason for hiding this comment

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

Thanks, @KaraMelih . I added a test to this method. I will merge this PR after the test is finished.

@dachengx dachengx merged commit 136a169 into AxFoundation:master May 17, 2023
10 checks passed
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

3 participants