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

Validation based on hdf tree traversal #333

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Conversation

domna
Copy link
Collaborator

@domna domna commented May 17, 2024

This is a sketch of a hdf tree traversal by the rough ideas I already had in my head I didn't want to forget during my holidays. With the additional functions I added during the development #323 this easily checks for all the elements in the whole tree dynamically. Mainly it misses the actual checking routines for fields and attributes. Generally, it seems it's much more straightforward than the verification in the dict, because we have much less specialities we need to consider. However, it could be that the performance is not as good, because we traverse the hdf each time. But I tried to build a cached recursive function to balance that off.

This can be used as a proper basis for #133.

Development branches:

  1. pynxtools: hdf-based-validation
  2. nexus_definition: test_nxdl_hdf5_validator

Needs care on the following points:

  • Does not take all required fields in entry level
from pynxtools.dataconverter.template import Template  #

from pynxtools.dataconverter import helpers

nxdl_root = None
# nxdl_name =  "NXtest_extended"
nxdl_name = "NXhdf5_validator_2"
# nxdl_name = "NXspm"
if nxdl_root is None:
    nxdl_root, _ = helpers.get_nxdl_root_and_path(nxdl=nxdl_name)

template = Template()
helpers.generate_template_from_nxdl(nxdl_root, template)

print(template)

generate:

{
"/ENTRY[entry]/experiment_result/hdf5_validator_2_intensity": "None",
"/ENTRY[entry]/hdf5_validator_1_program_name": "None",
"/ENTRY[entry]/hdf5_validator_1_required/required_field": "None",
"/ENTRY[entry]/hdf5_validator_2_users_req/required_field": "None"
}

But expecting field "/ENTRY[entry]/hdf5_validator_2_program_name": "None" as well.

  • Add documentation

@coveralls
Copy link

coveralls commented May 17, 2024

Pull Request Test Coverage Report for Build 9517068942

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage remained the same at 96.916%

Files with Coverage Reduction New Missed Lines %
tests/dataconverter/test_nexus_tree.py 1 87.23%
Totals Coverage Status
Change from base Build 9516791059: 0.0%
Covered Lines: 597
Relevant Lines: 616

💛 - Coveralls

@domna domna force-pushed the hdf-based-validation branch from c040e52 to 9eab38c Compare June 7, 2024 15:09
@domna domna self-assigned this Jun 7, 2024
@domna domna mentioned this pull request Jun 10, 2024
13 tasks
@domna domna mentioned this pull request Jun 28, 2024
@domna domna requested review from mkuehbach and RubelMozumder July 18, 2024 13:27
@domna domna requested a review from sanbrock July 18, 2024 13:27
@domna domna removed their assignment Jul 24, 2024
@lukaspie lukaspie mentioned this pull request Aug 14, 2024
2 tasks
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.

3 participants