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

Nyaml2nxdl migration #1303

Open
wants to merge 97 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
9cd55fb
Better dependency management for dev, standalone, and a Nomad install…
sherjeelshabih Oct 7, 2022
3627be4
Fixes linting
domna Oct 20, 2022
19f0937
Renaming file from yml to yaml
Mar 1, 2023
86bbc9c
passing test: test_link, test_docs, test_nxdl2nyaml_doc_from_nxdl, te…
Mar 2, 2023
4212541
tests in going on
Mar 2, 2023
ab1c4ad
test_xml_parsing is passed.
Mar 2, 2023
8fb3102
All tests are successfully passed.
Mar 2, 2023
efcd793
Setting all the tests, mypy, pydocstyle, and pylint correctly.
Mar 22, 2023
b3db958
Nyaml2nxdl comment preservation (#86)
RubelMozumder Apr 20, 2023
b57695d
Renames to pynxtools (#93)
domna Apr 21, 2023
d413881
Renames to pynxtools (#93)
domna Apr 21, 2023
cb08bb2
Changes for removing old errors related ':' in yaml and xml file. (#96)
RubelMozumder May 8, 2023
53996da
Changes for removing old errors related ':' in yaml and xml file. (#96)
RubelMozumder May 8, 2023
e0e5509
DEBUG: Deleting intermeadiate generated file. (#109)
RubelMozumder May 9, 2023
b44c9c3
DEBUG: Deleting intermeadiate generated file. (#109)
RubelMozumder May 9, 2023
b712dd8
Optionality check in nyam2nxdl (#126)
RubelMozumder Jun 13, 2023
9da44ee
Optionality check in nyam2nxdl (#126)
RubelMozumder Jun 13, 2023
0233d91
adding links to first references of the vocabulary items
sanbrock Jun 15, 2023
a671d15
do not display first reference redundantly if it is the only reference
sanbrock Jun 15, 2023
124b41e
reformatting
sanbrock Jun 15, 2023
8351366
changing to shorter link with tooltip
sanbrock Jun 15, 2023
1af3a42
linting
sanbrock Jun 15, 2023
8c0881d
linting
sanbrock Jun 15, 2023
d5faa6b
supporting unicode char for latex
sanbrock Jun 15, 2023
1138ebf
short tooltip and link
sanbrock Jun 15, 2023
cb92872
adjusted conf.py
sanbrock Jun 15, 2023
c117842
removing pynxtools as dependecy
sanbrock Jun 15, 2023
185f649
linting
sanbrock Jun 15, 2023
5a1de22
linting
sanbrock Jun 15, 2023
286c0c2
imports
sanbrock Jun 15, 2023
6837fb6
Adds pyproject
domna Jun 16, 2023
73d795b
Merge pull request #1276 from FAIRmat-NFDI/origin/python-package
sanbrock Jun 16, 2023
52a21ee
linting
sanbrock Jun 16, 2023
d3d101f
adjusted default location of definitions inside the module
sanbrock Jun 16, 2023
025c078
new characters as Code Camp suggested
sanbrock Jun 16, 2023
adf098e
make new char available for latex
sanbrock Jun 16, 2023
222a3c0
make new char available for latex
sanbrock Jun 16, 2023
7252a49
make new char available for latex
sanbrock Jun 16, 2023
fd4b4a6
collapsing doc_enum-s
sanbrock Jun 16, 2023
90ff26b
missing sphinx dependency
sanbrock Jun 16, 2023
015aa77
removing h5py dependency
sanbrock Jun 21, 2023
f2cd2ac
remove dependencies also from pypi configuration
sanbrock Jun 21, 2023
aabf43b
added sphinx-toolbox
sanbrock Jun 21, 2023
c510dae
collapsing is deactivated for this PR
sanbrock Jun 21, 2023
9240450
Move all of nyaml2nxdl files in a folder
sherjeelshabih Jul 5, 2023
d527d69
Merge branch 'nyaml2nxdl' pulled from https://github.com/FAIRmat-NFDI…
sherjeelshabih Jul 5, 2023
666203a
Moving test to correct folder for nexus definitions repo
sherjeelshabih Jul 5, 2023
bd27ec7
Merge branch 'nyaml2nxdl-tests' into nyaml2nxdl-migration
sherjeelshabih Jul 5, 2023
8a9f956
Merge remote-tracking branch 'nexus_official/link_first_reference' in…
sherjeelshabih Jul 11, 2023
ff05cb5
linting
sanbrock Jun 19, 2023
bf1936a
linting
sanbrock Jun 19, 2023
9c28230
imports
sanbrock Jun 19, 2023
ddaaa69
fixing imports
sanbrock Jun 19, 2023
357a6a8
test case added
sanbrock Jun 19, 2023
948b044
Moved over changes from older nyaml PR
sherjeelshabih Jul 12, 2023
bd2d198
linting
sanbrock Jul 12, 2023
1e959c0
make nxdl command is added to support the reverse covertsion that was…
sanbrock Jul 12, 2023
0f4d723
fixing typos and dependencies
sanbrock Jul 12, 2023
020175f
add again the lost function remove_namespace_from_tag
sanbrock Jul 14, 2023
e036a01
fixing imports
sanbrock Jun 21, 2023
66c20a6
Modification for changes request from 1303 PR.
RubelMozumder Sep 4, 2023
4d3d8f5
changes from Peter and Pete.
RubelMozumder Sep 6, 2023
6df73b8
Change request in nyaml2nxdl_backward_tools.py
RubelMozumder Sep 21, 2023
c51291f
nyaml2nxdl backward tools: fixing requested changes in that file.
RubelMozumder Sep 22, 2023
46c9560
Updating nyaml2nxdl.py with '--do-not-store-nxdl'
RubelMozumder Sep 22, 2023
031c423
Removed unused and not functioned functions ('append_yaml', 'compaire…
RubelMozumder Sep 22, 2023
d702250
Updating nyaml_forward_tools.py.
RubelMozumder Sep 25, 2023
31d1ce3
Improved Makefile from fairmat branch
domna Sep 25, 2023
6ceaebd
Removes unused code
domna Sep 25, 2023
b52cf08
Addresses some review comments in nxdl_utils
domna Sep 25, 2023
a5233c7
Addresses comments in nxdl_utils
domna Sep 25, 2023
6149993
Fixes typo in readme
domna Sep 25, 2023
e56c7d5
Updating nyam2nxdl converter files.
RubelMozumder Sep 25, 2023
b276962
Fix typo in setuptools_scm
domna Sep 25, 2023
8b8d4de
Resolving requested changes.
RubelMozumder Sep 25, 2023
96b146f
Fixing attributes for nxdl and yaml separately.
RubelMozumder Sep 26, 2023
9c49d8a
REsolving PR comments
RubelMozumder Sep 27, 2023
1fa5665
Fixes Makefile pickung up nxdl rules for `make nyaml`
domna Sep 28, 2023
b6761e9
Updating PR comments.
RubelMozumder Sep 28, 2023
a0f6a3f
updating PR comments.
RubelMozumder Sep 28, 2023
9516065
updating PR comments.
RubelMozumder Sep 28, 2023
d315dab
updating PR comments.
RubelMozumder Sep 28, 2023
330975b
Replacing os, and xml from dependencies and add lxml and pathlib as d…
RubelMozumder Oct 4, 2023
cf9b9f0
updating PR comments.
RubelMozumder Oct 4, 2023
86df4ed
Implementing black on nyal2nxdl converter files.
RubelMozumder Oct 4, 2023
55ee9ad
Fixing test.
RubelMozumder Oct 5, 2023
cf7f068
Fixing build errors.
RubelMozumder Oct 5, 2023
ae0bd30
Remove pyproject.toml and adapt makefile
domna Oct 20, 2023
afabe9d
Remove $(DIRS) from nyaml command
domna Oct 25, 2023
31e836d
Updates a warning for using make nxdl
domna Oct 25, 2023
89afa8e
Fix codestyle
domna Oct 25, 2023
56f5191
Build nxdl names from existing variables
domna Oct 25, 2023
e616851
Fixing indentation miss alignment in comments commeing from nxdl to n…
RubelMozumder Oct 28, 2023
ebc61c2
Fixing test for python backward compatibility.
RubelMozumder Nov 3, 2023
8b64f95
Update README.md
sanbrock Nov 8, 2023
124de30
Update README.md
sanbrock Nov 9, 2023
4ea35ef
typos fixed as suggested
sanbrock Nov 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Hidden files
.*
!.github

# Python byte / compiled / optimized
*.py[cod]
Expand All @@ -10,6 +9,22 @@ __pycache__/
build/
makelog.txt

# Unknown
/python/
__github_creds__.txt
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
recursive-include applications/ *.nxdl.xml
recursive-include contributed_definitions/ *.nxdl.xml
recursive-include base_classes/ *.nxdl.xml
include ./ *.xsd
37 changes: 36 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
PYTHON = python3
SPHINX = sphinx-build
BUILD_DIR = "build"
BASE_CLASS_DIR := base_classes
CONTRIB_DIR := contributed_definitions
APPDEF_DIR := applications
NXDL_DIRS := $(BASE_CLASS_DIR) $(CONTRIB_DIR) $(APPDEF_DIR)
NYAML_SUBDIR := nyaml
NYAML_APPENDIX := _parsed

.PHONY: help install style autoformat test clean prepare html pdf impatient-guide all local
NXDL_BC := $(wildcard $(BASE_CLASS_DIR)/*.nxdl.xml)
NXDL_CONTRIB := $(wildcard $(CONTRIB_DIR)/*.nxdl.xml)
NXDL_APPDEF := $(wildcard $(APPDEF_DIR)/*.nxdl.xml)

.PHONY: help install style autoformat test clean prepare html pdf impatient-guide all local nyaml nxdl

help ::
@echo ""
Expand Down Expand Up @@ -49,6 +59,9 @@ test ::

clean ::
$(RM) -rf $(BUILD_DIR)
$(RM) -rf $(BASE_CLASS_DIR)/$(NYAML_SUBDIR)
$(RM) -rf $(APPDEF_DIR)/$(NYAML_SUBDIR)
$(RM) -rf $(CONTRIB_DIR)/$(NYAML_SUBDIR)

prepare ::
$(PYTHON) -m dev_tools manual --prepare --build-root $(BUILD_DIR)
Expand Down Expand Up @@ -83,6 +96,28 @@ all ::
@echo "HTML built: `ls -lAFgh $(BUILD_DIR)/manual/build/html/index.html`"
@echo "PDF built: `ls -lAFgh $(BUILD_DIR)/manual/build/latex/nexus.pdf`"

$(BASE_CLASS_DIR)/%.nxdl.xml : $(BASE_CLASS_DIR)/$(NYAML_SUBDIR)/%.yaml
nyaml2nxdl --input-file $<
mv $(BASE_CLASS_DIR)/$(NYAML_SUBDIR)/$*.nxdl.xml $@

$(CONTRIB_DIR)/%.nxdl.xml : $(CONTRIB_DIR)/$(NYAML_SUBDIR)/%.yaml
nyaml2nxdl --input-file $<
mv $(CONTRIB_DIR)/$(NYAML_SUBDIR)/$*.nxdl.xml $@

$(APPDEF_DIR)/%.nxdl.xml : $(APPDEF_DIR)/$(NYAML_SUBDIR)/%.yaml
nyaml2nxdl --input-file $<
mv $(APPDEF_DIR)/$(NYAML_SUBDIR)/$*.nxdl.xml $@

NXDLS := $(foreach dir,$(NXDL_DIRS),$(wildcard $(dir)/*.nxdl.xml))
PeterC-DLS marked this conversation as resolved.
Show resolved Hide resolved
nyaml : $(DIRS)
PeterC-DLS marked this conversation as resolved.
Show resolved Hide resolved
for file in $(NXDLS); do\
mkdir -p "$${file%/*}/nyaml";\
nyaml2nxdl --input-file $${file};\
FNAME=$${file##*/};\
mv -- "$${file%.nxdl.xml}_parsed.yaml" "$${file%/*}/nyaml/$${FNAME%.nxdl.xml}.yaml";\
done

nxdl: $(NXDL_APPDEF) $(NXDL_CONTRIB) $(NXDL_BC)

# NeXus - Neutron and X-ray Common Data Format
#
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

## NeXus definition developers

Note if this package was not properly installed using pip, it has to be first done by

pip install -e .

After making a change to the NeXus class definitions there are two important checks
to be made before commiting the change:

Expand All @@ -25,6 +29,14 @@ Open the HTML manual in a web brower for visual verification

firefox build/manual/build/html/index.html

Convenient editing of definitions is available in nyaml format. For this, definitions need to be converted first from xml to yaml format by the command

make nyaml

After editing the definitions in nyaml format in the nyaml subdirectories, the following command can be used to update the definitions in nxdl.xml format:

make nxdl

PeterC-DLS marked this conversation as resolved.
Show resolved Hide resolved
### HTML pages with contributor information

To build the html pages that contains contributor information on the sidebar set a github access token to an environment variable called GH_TOKEN.
Expand Down Expand Up @@ -57,4 +69,4 @@ package/ | directory for packaging this content
utils/ | various tools used in the definitions tree
www/ | launch (home) page of NeXus WWW site
xslt/ | various XML stylesheet transformations
dev_tools/ | developer tools for testing and building
dev_tools/ | developer tools for testing and building
96 changes: 79 additions & 17 deletions dev_tools/docs/nxdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..globals.errors import NXDLParseError
from ..globals.nxdl import NXDL_NAMESPACE
from ..globals.urls import REPO_URL
from ..utils import nxdl_utils as pynxtools_nxlib
from ..utils.github import get_file_contributors_via_api
from ..utils.types import PathLike
from .anchor_list import AnchorRegistry
Expand Down Expand Up @@ -129,7 +130,7 @@ def _parse_nxdl_file(self, nxdl_file: Path):
# print official description of this class
self._print("")
self._print("**Description**:\n")
self._print_doc(self._INDENTATION_UNIT, ns, root, required=True)
self._print_doc_enum("", ns, root, required=True)

# print symbol list
node_list = root.xpath("nx:symbols", namespaces=ns)
Expand All @@ -139,7 +140,7 @@ def _parse_nxdl_file(self, nxdl_file: Path):
elif len(node_list) > 1:
raise Exception(f"Invalid symbol table in {nxclass_name}")
else:
self._print_doc(self._INDENTATION_UNIT, ns, node_list[0])
self._print_doc_enum("", ns, node_list[0])
for node in node_list[0].xpath("nx:symbol", namespaces=ns):
doc = self._get_doc_line(ns, node)
self._print(f" **{node.get('name')}**", end="")
Expand Down Expand Up @@ -518,6 +519,32 @@ def _print_doc(self, indent, ns, node, required=False):
self._print(f"{indent}{line}")
self._print()

def long_doc(self, ns, node):
length = 0
line = "documentation"
fnd = False
blocks = self._get_doc_blocks(ns, node)
for block in blocks:
lines = block.splitlines()
length += len(lines)
for single_line in lines:
if len(single_line) > 2 and single_line[0] != "." and not fnd:
fnd = True
line = single_line
return (length, line, blocks)

def _print_doc_enum(self, indent, ns, node, required=False):
collapse_indent = indent
node_list = node.xpath("nx:enumeration", namespaces=ns)
(doclen, line, blocks) = self.long_doc(ns, node)
self._print_doc(
collapse_indent + self._INDENTATION_UNIT, ns, node, required=required
)
if len(node_list) == 1:
self._print_enumeration(
collapse_indent + self._INDENTATION_UNIT, ns, node_list[0]
)

def _print_attribute(self, ns, kind, node, optional, indent, parent_path):
name = node.get("name")
index_name = name
Expand All @@ -526,12 +553,9 @@ def _print_attribute(self, ns, kind, node, optional, indent, parent_path):
)
self._print(f"{indent}.. index:: {index_name} ({kind} attribute)\n")
self._print(
f"{indent}**@{name}**: {optional}{self._format_type(node)}{self._format_units(node)}\n"
f"{indent}**@{name}**: {optional}{self._format_type(node)}{self._format_units(node)} {self.get_first_parent_ref(f'{parent_path}/{name}', 'attribute')}\n"
)
self._print_doc(indent + self._INDENTATION_UNIT, ns, node)
node_list = node.xpath("nx:enumeration", namespaces=ns)
if len(node_list) == 1:
self._print_enumeration(indent + self._INDENTATION_UNIT, ns, node_list[0])
self._print_doc_enum(indent, ns, node)

def _print_if_deprecated(self, ns, node, indent):
deprecated = node.get("deprecated", None)
Expand Down Expand Up @@ -569,17 +593,12 @@ def _print_full_tree(self, ns, parent, name, indent, parent_path):
f"{self._format_type(node)}"
f"{dims}"
f"{self._format_units(node)}"
f" {self.get_first_parent_ref(f'{parent_path}/{name}', 'field')}"
"\n"
)

self._print_if_deprecated(ns, node, indent + self._INDENTATION_UNIT)
self._print_doc(indent + self._INDENTATION_UNIT, ns, node)

node_list = node.xpath("nx:enumeration", namespaces=ns)
if len(node_list) == 1:
self._print_enumeration(
indent + self._INDENTATION_UNIT, ns, node_list[0]
)
self._print_doc_enum(indent, ns, node)

for subnode in node.xpath("nx:attribute", namespaces=ns):
optional = self._get_required_or_optional_text(subnode)
Expand All @@ -605,10 +624,12 @@ def _print_full_tree(self, ns, parent, name, indent, parent_path):
# target = hTarget.replace(".. _", "").replace(":\n", "")
# TODO: https://github.com/nexusformat/definitions/issues/1057
self._print(f"{indent}{hTarget}")
self._print(f"{indent}**{name}**: {optional_text}{typ}\n")
self._print(
f"{indent}**{name}**: {optional_text}{typ} {self.get_first_parent_ref(f'{parent_path}/{name}', 'group')}\n"
)

self._print_if_deprecated(ns, node, indent + self._INDENTATION_UNIT)
self._print_doc(indent + self._INDENTATION_UNIT, ns, node)
self._print_doc_enum(indent, ns, node)

for subnode in node.xpath("nx:attribute", namespaces=ns):
optional = self._get_required_or_optional_text(subnode)
Expand Down Expand Up @@ -639,8 +660,49 @@ def _print_full_tree(self, ns, parent, name, indent, parent_path):
f"(suggested target: ``{node.get('target')}``)"
"\n"
)
self._print_doc(indent + self._INDENTATION_UNIT, ns, node)
self._print_doc_enum(indent, ns, node)

def _print(self, *args, end="\n"):
# TODO: change instances of \t to proper indentation
self._rst_lines.append(" ".join(args) + end)

def get_first_parent_ref(self, path, tag):
spliter = path.find("/", 1)
nx_name = path[1 : spliter]
path = path[spliter :]

try:
parents = pynxtools_nxlib.get_inherited_nodes(path, nx_name)[2]
except FileNotFoundError:
return ""
if len(parents) > 1:
parent = parents[1]
parent_path = parent_display_name = parent.attrib["nxdlpath"]
parent_path_segments = parent_path[1:].split("/")
nxdl_attr = parent.attrib["nxdlbase"]
parent_def_name = nxdl_attr[nxdl_attr.rfind("/") :
nxdl_attr.rfind(".nxdl")
]

# Case where the first parent is a base_class
if parent_path_segments[0] == "":
return ""

# special treatment for NXnote@type
if (
tag == "attribute"
and parent_def_name == "/NXnote"
and parent_path == "/type"
):
return ""

if tag == "attribute":
pos_of_right_slash = parent_path.rfind("/")
parent_path = (
parent_path[:pos_of_right_slash]
+ "@"
+ parent_path[pos_of_right_slash + 1 :]
)
parent_display_name = f"{parent_def_name[1:]}{parent_path}"
return f":ref:`⤆ </{parent_display_name}-{tag}>`"
return ""
68 changes: 68 additions & 0 deletions dev_tools/nyaml2nxdl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# YAML to NXDL converter and NXDL to YAML converter

**NOTE: Please use python3.8 or above to run this converter**

**Tools purpose**: Offer a simple YAML-based schema and a XML-based schema to describe NeXus instances. These can be NeXus application definitions or classes
prjemian marked this conversation as resolved.
Show resolved Hide resolved
such as base or contributed classes. Users either create NeXus instances by writing a YAML file or a XML file which details a hierarchy of data/metadata elements.
The forward (YAML -> NXDL.XML) and backward (NXDL.XML -> YAML) conversions are implemented.

**How the tool works**:
- nyaml2nxdl.py
1. Reads the user-specified NeXus instance, either in YML or XML format.
2. If input is in YAML, creates an instantiated NXDL schema XML tree by walking the dictionary nest.
If input is in XML, creates a YML file walking the dictionary nest.
3. Write the tree into a YAML file or a properly formatted NXDL XML schema file to disk.
4. Optionally, if --append argument is given,
the XML or YAML input file is interpreted as an extension of a base class and the entries contained in it
are appended below a standard NeXus base class.
You need to specify both your input file (with YAML or XML extension) and NeXus class (with no extension).
Both .yaml and .nxdl.xml file of the extended class are printed.

```console
user@box:~$ python nyaml2nxdl.py

Usage: python nyaml2nxdl.py [OPTIONS]

Options:
--input-file TEXT The path to the input data file to read.
--append TEXT Parse xml NeXus file and append to specified base class,
write the base class name with no extension.
--check-consistency Check consistency by generating another version of the input file.
E.g. for input file: NXexample.nxdl.xml the output file
NXexample_consistency.nxdl.xml.
--verbose Additional std output info is printed to help debugging.
--help Show this message and exit.

```

## Documentation

**Rule set**: From transcoding YAML files we need to follow several rules.
* Named NeXus groups, which are instances of NeXus classes especially base or contributed classes. Creating (NXbeam) is a simple example of a request to define a group named according to NeXus default rules. mybeam1(NXbeam) or mybeam2(NXbeam) are examples how to create multiple named instances at the same hierarchy level.
* Members of groups so-called fields or attributes. A simple example of a member is voltage. Here the datatype is implied automatically as the default NeXus NX_CHAR type. By contrast, voltage(NX_FLOAT) can be used to instantiate a member of class which should be of NeXus type NX_FLOAT.
* And attributes of either groups or fields. The mark '\@' have to precede the name of attributes.
* Optionality: For all fields, groups and attributes in `application definitions` are `required` by default, except anything (`recommended` or `optional`) mentioned.
prjemian marked this conversation as resolved.
Show resolved Hide resolved

**Special keywords**: Several keywords can be used as childs of groups, fields, and attributes to specify the members of these. Groups, fields and attributes are nodes of the XML tree.
* **doc**: A human-readable description/docstring
* **exists** Options are recommended, required, [min, 1, max, `infty`] numbers like here 1 can be replaced by any `uint` (unsigned integer), or `infty` to indicate no restriction on how frequently the entry can occur inside the NXDL schema at the same hierarchy level.
* **link** Define links between nodes.
* **units** A statement introducing NeXus-compliant NXDL units arguments, like NX_VOLTAGE
* **dimensions** Details which dimensional arrays to expect
* **enumeration** Python list of strings which are considered as recommended entries to choose from.
* **dim_parameters** `dim` which is a child of `dimension` and the `dim` might have several attributes `ref`,
`incr` including `index` and `value`. So while writing `yaml` file schema definition please following structure:
```
dimensions:
rank: integer value
dim: [[ind_1, val_1], [ind_2, val_2], ...]
dim_parameters:
ref: [ref_value_1, ref_value_2, ...]
PeterC-DLS marked this conversation as resolved.
Show resolved Hide resolved
incr: [incr_value_1, incr_value_2, ...]
```
Keep in mind that length of all the lists must have the **same size**.
**Important Note**: The attributes `ref`, `incr`, `index` are deprecated.

## Next steps

The NOMAD team is currently working to establish a one-to-one mapping between NeXus definitions and the NOMAD MetaInfo(scientific data model in nomad). As soon as this is in place the YAML files will be annotated with further metadata so that they can serve two purposes. On the one hand they can serve as an instance for a schema to create a GUI representation of a NOMAD Oasis ELN schema. On the other hand the YAML to NXDL converter will skip all those pieces of information which are irrelevant from a NeXus perspective.
21 changes: 21 additions & 0 deletions dev_tools/nyaml2nxdl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
# Load paths
"""
# -*- coding: utf-8 -*-
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
Loading