Skip to content

Testing for generating template from NeXusTree#620

Draft
RubelMozumder wants to merge 2 commits intomasterfrom
TemplateFromNxTree
Draft

Testing for generating template from NeXusTree#620
RubelMozumder wants to merge 2 commits intomasterfrom
TemplateFromNxTree

Conversation

@RubelMozumder
Copy link
Collaborator

In the current implementation how the Template instance is populated, not all the inheritance fields can be resolved specially some fields from inheritance chain are missing. Taking leverage from NeXus tree would be a good option for that.

Beside that, the template only stores the path of the nexus concept path as a plain string. And in the reader plugin, the reader developer somehow needs to check the proper type of the data, and most of the time, the information of the data type or unit type for a field or attribute is noted in reader plugin manually. Which is error prone and needs extra effort. This PR is intended to handle.

  • Generate the template from NeXus tree
  • Each template key should be an object that would carry other information such as data type, unit type, nameType info which will be carry exact information as an nxdl node contains. This method would justify nxdl as a single source of truth.
  • Add the features of template to curate the data fields and attributes according to the nxdl.
  • Do not alter the current interface of the Template but implement the feature(2 & 3) as an extension of the current feature.

Comment on lines +1 to +14
from pynxtools.dataconverter.helpers import generate_template_from_nxdl
from pynxtools.dataconverter.nexus_tree import *
from pynxtools.dataconverter.template import Template

spm_appdef = "NXspm"
spmT = generate_tree_from(spm_appdef)


def add_template_key_from(nx_node,
parent_path = ""):
key = None
unit = None
if nx_node.type == "attribute":
leaf_part = (f"{nx_node.name}[{nx_node.name}]"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Delete this file.

@mkuehbach mkuehbach changed the title Testing fro generating template from NeXusTree Testing for generating template from NeXusTree Sep 30, 2025
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.

1 participant