diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000000000000000000000000000000000..824899ed38b75aa0cc4b67f10029722906970c4b --- /dev/null +++ b/.coveragerc @@ -0,0 +1,17 @@ +[report] +exclude_lines = + pragma: no cover + def __repr__ + if self.debug: + if settings.DEBUG + raise AssertionError + raise NotImplementedError + if 0: + if __name__ == .__main__.: + +[run] +omit = + versioneer.py + src/punx/_version.py + src/punx/github_handler.py + tests/github_handler_test.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..93adf2e1952e201f6ee7ec71a0b91dfbafb0bb3c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +src/punx/_version.py export-subst diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fe86abc6510770ac5c1cf9e3607b519de897b37a --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +*.py[cod] + +# local creds for authenticated access +src/punx/__github_creds__.txt + +# local NXDL source cache (to be packaged with sdist) +#src/punx/cache/* + +# eclipse/PyDev +.pydevproject + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 +__pycache__ + +# Installer logs +pip-log.txt + +# Python logging package output +log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +htmlcov +tests/__pycache__ + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +/.settings +/.idea +/src/punx/data/local diff --git a/.landscape.yml b/.landscape.yml new file mode 100644 index 0000000000000000000000000000000000000000..11e410fa4b423c5cde7a3eb5bbd116347553d48a --- /dev/null +++ b/.landscape.yml @@ -0,0 +1,37 @@ +doc-warnings: true +test-warnings: false +strictness: medium +max-line-length: 120 +autodetect: true +requirements: + - pyRestTable + - PyGitHub>=1.32 + - PyQt + - numpy + - h5py + - lxml + - requests + - coverage + - docopt + - coveralls +ignore-paths: + - docs + - src/punx/cache + - src/punx/data + - src/punx/ignore_now + - versioneer.py + - src/punx/_version.py + - install_NXDL_file_sets.py + - _installer.py +ignore-patterns: + - ^example/doc_.*\.py$ + - (^|/)docs(/|$) +python-targets: + - 2 + - 3 +pylint: + disable: + - unused-argument + - arguments-differ + - protected-access + - cyclic-import diff --git a/.project b/.project new file mode 100644 index 0000000000000000000000000000000000000000..597a2237a0dcc3c69dc448df8269bcef9fd62842 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>punx</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.python.pydev.PyDevBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.python.pydev.pythonNature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + </natures> +</projectDescription> diff --git a/.pydevproject.example b/.pydevproject.example new file mode 100644 index 0000000000000000000000000000000000000000..d65ef90a17a1f5d931957eede59a47b880607f5e --- /dev/null +++ b/.pydevproject.example @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse-pydev version="1.0"?><pydev_project> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Python 3.6 and PyQt5</pydev_property> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.6</pydev_property> +<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> +<path>/${PROJECT_DIR_NAME}/src</path> +</pydev_pathproperty> +</pydev_project> diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000000000000000000000000000000000..247fdc2f746703f6c5d18aa622d8e922c5b0672a --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,2 @@ +conda: + file: environment.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..46d5cc76d712dba03cc513ea600abc37ffd3ca62 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,45 @@ +# :file: .travis.yml +# +# :url: https://travis-ci.org/prjemian/punx +# +# for advice, see: +# https://docs.travis-ci.com/user/customizing-the-build#The-Build-Lifecycle + +language: python +python: + - "2.7" + - "3.5" + - "3.6" + +before_script: + - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - chmod +x miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH=$HOME/miniconda/bin:$PATH + - export PY_ENV=travis-$TRAVIS_PYTHON_VERSION + - conda create -y -n $PY_ENV python=$TRAVIS_PYTHON_VERSION pyqt numpy h5py lxml requests coverage docopt + - source activate $PY_ENV + - which pip + - which python + - which conda + - python --version + - pip install pyRestTable + - pip install "PyGitHub>=1.32" + - pip install coveralls + - which coveralls + - conda list + +# command to run tests +script: + - # python ./src/punx/main.py -h + - # python ./src/punx/main.py update --force + - which coverage + - coverage run tests/ + +after_success: + - coverage report + - which coveralls + - coveralls + - source deactivate + - conda env remove -y -n $PY_ENV + \ No newline at end of file diff --git a/CHANGES.rst b/CHANGES.rst new file mode 100644 index 0000000000000000000000000000000000000000..71dc5c0695442b93b0177d2543bcbadcf67f22c9 --- /dev/null +++ b/CHANGES.rst @@ -0,0 +1,31 @@ +.. + This file describes user-visible changes between the versions. + +Change History +############## + +Production +********** + +--none-- + +Development +*********** + +:0.2.0: 2018-07-02 -- first tag after major refactor (#72, #105) +:0.1.9: 2017-07-09 -- last tag before major refactor (#72), no changes here since 2017-03-31 +:0.1.8: 2017-03-12 -- package .json file in the cache file sets +:0.1.7: 2017-03-11 -- NeXus def 3.2 bundled into repo now +:0.1.4: 2016-12-09 -- validation reports sorted by HDF5 address +:0.1.3: 2016-12-07 -- Py2 & Py3: passes all unit tests +:0.1.2: 2016-11-21 -- unit tests added for reports +:0.0.9: 2016-06-29 -- retry failed https requests to GitHub and cleanup a QString +:0.0.8: 2016-06-29 -- refactor update procedure +:0.0.7: 2016-06-27 -- add "report" arguments to "demo" subcommand +:0.0.6: 2016-06-22 -- resolved some UnicodeDecodeError exceptions +:0.0.5: 2016-06-20 -- added subcommand shortcuts and logging +:0.0.4: 2016-06-17 -- work-in-progress to test installation with remote user +:0.0.3: 2016-06-11 -- basic UI established, **demo** command added +:0.0.2: 2016-06-11 -- basic UI established +:0.0.1: 2016-06-10 -- basic functions +:started: 2016-05-20 -- initial project creation diff --git a/MANIFEST.in b/MANIFEST.in index 30927eaf29f09d988e1dfa4815a07423eb98106b..54f02118c20bad522ab37564a125139062ce54c0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,10 +5,5 @@ include src/punx/cache/*/__github_info__.json include src/punx/cache/*/*.xsd include src/punx/cache/*/*/*.xml include src/punx/cache/*/*/*.xsl -include src/qa_qc/*.txt include src/punx/_version.py include versioneer.py - -# Do NOT package the file "__use_source_cache__" with the sdist created from setup.py. -# do NOT include __use_source_cache__ -# Its presence is a boolean to update user or source cache. diff --git a/PKG-INFO b/PKG-INFO deleted file mode 100644 index b48bb3943ee69ec4a85579af42539e83f4b72a79..0000000000000000000000000000000000000000 --- a/PKG-INFO +++ /dev/null @@ -1,78 +0,0 @@ -Metadata-Version: 1.1 -Name: punx -Version: 0.1.9 -Summary: Python Utilities for NeXus -Home-page: http://punx.readthedocs.io -Author: Pete R. Jemian -Author-email: prjemian@gmail.com -License: Creative Commons Attribution 4.0 International Public License (see LICENSE file) -Description: #### - punx - #### - - Python Utilities for NeXus HDF5 files: validation, structure, hierarchy - - * Validation of NeXus NXDL files - * Validation of NeXus HDF5 data files - * Display of NeXus HDF5 data file structure - * Display of NeXus base class hierarchy (stretch goal, graphical output) - - NOTE: project is under initial construction - - :author: Pete R. Jemian - :email: prjemian@gmail.com - :copyright: 2017, Pete R. Jemian - :license: Creative Commons Attribution 4.0 International Public License (see *LICENSE.txt*) - :URL: http://punx.readthedocs.io - :git: https://github.com/prjemian/punx - :PyPI: https://pypi.python.org/pypi/punx/ - :TODO list: https://github.com/prjemian/punx/issues - - :build badges: - - .. see http://shields.io/ for more badge ideas - - .. image:: https://travis-ci.org/prjemian/punx.svg?branch=master - :target: https://travis-ci.org/prjemian/punx - .. image:: https://coveralls.io/repos/github/prjemian/punx/badge.svg?branch=master - :target: https://coveralls.io/github/prjemian/punx?branch=master - - :release badges: - - .. image:: https://img.shields.io/github/tag/prjemian/punx.svg - :target: https://github.com/prjemian/punx/tags - .. image:: https://img.shields.io/github/release/prjemian/punx.svg - :target: https://github.com/prjemian/punx/releases - .. image:: https://img.shields.io/pypi/v/punx.svg - :target: https://pypi.python.org/pypi/punx/ - - :social badges: - - .. image:: http://depsy.org/api/package/pypi/punx/badge.svg - :target: http://depsy.org/package/python/punx - .. image:: https://badges.gitter.im/punx-nexus/Lobby.svg - :target: https://gitter.im/punx-nexus/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge - -Keywords: NeXus,HDF5 -Platform: any -Classifier: Development Status :: 3 - Alpha -Classifier: Environment :: Console -Classifier: Intended Audience :: Science/Research -Classifier: License :: Freely Distributable -Classifier: License :: Public Domain -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Topic :: Scientific/Engineering -Classifier: Topic :: Scientific/Engineering :: Astronomy -Classifier: Topic :: Scientific/Engineering :: Bio-Informatics -Classifier: Topic :: Scientific/Engineering :: Chemistry -Classifier: Topic :: Scientific/Engineering :: Information Analysis -Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator -Classifier: Topic :: Scientific/Engineering :: Mathematics -Classifier: Topic :: Scientific/Engineering :: Physics -Classifier: Topic :: Scientific/Engineering :: Visualization -Classifier: Topic :: Software Development -Classifier: Topic :: Utilities diff --git a/README.rst b/README.rst index 17e901d14188bf6329788b77bc1911a7fd337019..fd0ac4b6a998c7c70b3f6dca49b5c62a5eb0a870 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ NOTE: project is under initial construction :author: Pete R. Jemian :email: prjemian@gmail.com -:copyright: 2017, Pete R. Jemian +:copyright: 2017-2018, Pete R. Jemian :license: Creative Commons Attribution 4.0 International Public License (see *LICENSE.txt*) :URL: http://punx.readthedocs.io :git: https://github.com/prjemian/punx @@ -26,8 +26,13 @@ NOTE: project is under initial construction .. image:: https://travis-ci.org/prjemian/punx.svg?branch=master :target: https://travis-ci.org/prjemian/punx + :alt: Unit Testing .. image:: https://coveralls.io/repos/github/prjemian/punx/badge.svg?branch=master :target: https://coveralls.io/github/prjemian/punx?branch=master + :alt: Code Coverage + .. image:: https://landscape.io/github/prjemian/punx/master/landscape.svg?style=plastic + :target: https://landscape.io/github/prjemian/punx/master + :alt: Code Health :release badges: @@ -42,5 +47,7 @@ NOTE: project is under initial construction .. image:: http://depsy.org/api/package/pypi/punx/badge.svg :target: http://depsy.org/package/python/punx + :alt: Depsy (impact) .. image:: https://badges.gitter.im/punx-nexus/Lobby.svg :target: https://gitter.im/punx-nexus/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge + :alt: gitter (chat) diff --git a/_starter_.py b/_starter_.py new file mode 100755 index 0000000000000000000000000000000000000000..c7522a0d68707f8a2d0ec7d6e5511529d2b554d2 --- /dev/null +++ b/_starter_.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import sys, os +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) + +# developer use +# if len(sys.argv) == 1: +# sys.argv.append("demo") +# sys.argv.append("conf") +# sys.argv.append("valid") +# sys.argv.append("src/punx/data/33837rear_1D_1.75_16.5_NXcanSAS_v3.h5") +# # sys.argv.append("C:/Users/Pete/Downloads/1998spheres.h5") +# # sys.argv.append("src/punx/cache/v3.3/applications/NXcanSAS.nxdl.xml") +# sys.argv.append("tree") +# sys.argv.append("src/punx/data/gov_5.h5") +# # sys.argv.append("src/punx/data/compression.h5") +# # sys.argv.append("src/punx/data/writer_1_3.hdf5") +# # sys.argv.append("src/punx/data/prj_test.nexus.hdf5") + + +from punx import main +print(main.__file__) +main.main() diff --git a/check_data.sh b/check_data.sh new file mode 100644 index 0000000000000000000000000000000000000000..87eda013e30420843a8df2ee6e2f8678c4e188d5 --- /dev/null +++ b/check_data.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# file: check_data.sh +# test that punx program can process all the files in the data directory + +DATA_DIR=src/punx/data + +for f in `ls -1 ${DATA_DIR}`; do + echo src/punx/data/$f + ./_starter_.py tree ${DATA_DIR}/$f + ./_starter_.py validate ${DATA_DIR}/$f +done diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..1d13287fa4c16aa59c3b26a086eeddf861da9d08 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,178 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes doctest gettext + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + touch $(BUILDDIR)/html/.nojekyll + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/punx.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/punx.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/punx" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/punx" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +#linkcheck: +# $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck +# @echo +# @echo "Link check complete; look for any errors in the above output " \ +# "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000000000000000000000000000000000000..9ac8515ef5fc6a12bcc8da5cce36d52f4539a73f --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,243 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source +set I18NSPHINXOPTS=%SPHINXOPTS% source +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^<target^>` where ^<target^> is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + echo '' > %BUILDDIR%/html/.nojekyll + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\punx.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\punx.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/docs/source/_static/.gitkeep b/docs/source/_static/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/docs/source/changes.rst b/docs/source/changes.rst new file mode 100644 index 0000000000000000000000000000000000000000..125c5ff2ca58339b56c0ffaa2c899b84743f23a5 --- /dev/null +++ b/docs/source/changes.rst @@ -0,0 +1,7 @@ +.. + CHANGES + ======= + + title provided in CHANGES.rst file + +.. include:: ../../CHANGES.rst diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000000000000000000000000000000000000..26eb7e668d55982a9867a3fb0428a4048aaf53cd --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,242 @@ +# -*- coding: utf-8 -*- +# +# punx documentation build configuration file, created by +# sphinx-quickstart on Tue Feb 18 21:05:31 2014. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath(os.path.join('..', '..', 'src'))) +import punx + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx.ext.viewcode', + 'sphinx.ext.inheritance_diagram', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = punx.__package_name__ +copyright = punx.__copyright__ + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +versioneer_version = punx.__version__.split('+') +version = versioneer_version[0] +# The full version, including alpha/beta/rc tags. +#release = punx.__release__ +#release = version +if len(versioneer_version) == 2: + release = versioneer_version[1] +else: + release = '' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'classic' +#html_theme = 'sphinxdoc' +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'punxdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', + punx.__package_name__+'.tex', + punx.__package_name__+u' Documentation', + punx.__author__, + 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst new file mode 100644 index 0000000000000000000000000000000000000000..8b92ecda6684b3da5688d13e70f7dcd5aa9bc52f --- /dev/null +++ b/docs/source/configuration.rst @@ -0,0 +1,85 @@ +.. _config: +.. index:: configuration + +User interface: subcommand: **configuration** +############################################# + +The *configuration* subcommand shows the internal configuration +of the ``punx`` program. It shows a table with the available +*NXDL file sets*. + +:: + + console> punx configuration + Locally-available versions of NeXus definitions (NXDL files) + ============= ======= ====== =================== ======= ========================================== + NXDL file set type cache date & time commit path + ============= ======= ====== =================== ======= ========================================== + a4fd52d commit source 2016-11-19 01:07:45 a4fd52d C:\source_path\punx\cache\a4fd52d + v2018.5 release source 2018-05-15 16:34:19 a3045fd C:\source_path\punx\src\punx\cache\v2018.5 + v3.3 release source 2017-07-12 17:41:13 9285af9 C:\source_path\punx\src\punx\cache\v3.3 + 9eab commit user 2016-10-19 17:58:51 9eab281 C:\user_path\AppData\Roaming\punx\9eab + master branch user 2018-05-16 02:07:48 2dc081e C:\user_path\AppData\Roaming\punx\master + ============= ======= ====== =================== ======= ========================================== + + default NXDL file set: master + + +An NXDL file set is the complete set of NXDL (XML) files that +provide a version of the NeXus standard, including the XML Schema +files that provide all the default and basic structures of the NXDL +files. + +Above, the user cache has a version of the GitHub *master* branch ( +the master branch contains the latest +revisions by the developers on that date). + +.. index:: NXDL file set + +An NXDL file set is *referenced* by one of the GitHub identifiers: + +========= ========== ========================================== +identifier example description +========= ========== ========================================== +commit 9eab SHA-1 hash tag [#]_ that identifies a specific commit to the repository +branch master name of a branch [#]_ in the repository +tag Schema-3.4 name of a tag [#]_ in the repository +release v2018.5 name of a repository release [#]_ +========= ========== ========================================== + +.. [#] commit (hash): A commit is a snapshot of the GitHub repository. + A SHA-1 hash code is the unique identifier of a commit. + It is a 40-character sequence of hexadecimals. + It may be shortened to just the first characters which identify + it uniquely in the repository. Three or four characters *may* be + unique (1:16^3 or 1:16^4) while + seven characters are almost certain (1:16^7) to be a unique reference. + + For example. the commit `9eab` may also be identified + as `9eab281`, or by its full SHA-1 has + `9eab2816e19440f8601fdf81ee972e330319c28f` + (https://github.com/nexusformat/definitions/commit/9eab281). + All point to the same commit on 2016-10-19 17:58:51. +.. [#] branch: https://help.github.com/articles/about-branches/ +.. [#] tag: a user-provided text name for a commit +.. [#] release: https://help.github.com/articles/about-releases/ + + +.. index:: + !ref + NXDL file set, ref + +When a *ref* (a reference to a specific NXDL file set identifier) +is not provided, the default NXDL file set will be chosen as the one +with the most recent date & time. That date & time is provided by +GitHub as the time the changes were to committed to the repository. + +.. index:: + source cache + user cache + cache, source + cache, user + +NXDL file sets may be found in the *source cache* (as distributed +with the program) or in the *user cache* as maintained by the ``punx`` +:ref:`update` subcommand. The full path to the file set is provided. diff --git a/docs/source/contents.rst b/docs/source/contents.rst new file mode 100644 index 0000000000000000000000000000000000000000..0af3185bc84242cab6b5ea1b8e21e616b22e244f --- /dev/null +++ b/docs/source/contents.rst @@ -0,0 +1,43 @@ +Contents +######## + +.. toctree:: + :maxdepth: 2 + :glob: + + overview + install + changes + license + source_code/* + +.. + .. toctree:: + :hidden: + + source_code/* + +Source Code ++++++++++++ + +.. autosummary:: + :nosignatures: + + ~punx.main + ~punx.validate + ~punx.h5tree + ~punx.nxdltree + ~punx.nxdl_manager + ~punx.nxdl_schema + ~punx.schema_manager + ~punx.cache_manager + ~punx.github_handler + + +Indices and tables +++++++++++++++++++ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/source/data_file_validation.rst b/docs/source/data_file_validation.rst new file mode 100644 index 0000000000000000000000000000000000000000..e7bad84907f4f68b1539e66dcbc7de84ae3d2c73 --- /dev/null +++ b/docs/source/data_file_validation.rst @@ -0,0 +1,95 @@ +.. _data_file_validation: + +.. |defs| replace:: *NeXus definitions* +.. |NXdata| replace:: **NXdata** +.. |NXentry| replace:: **NXentry** +.. |NXsubentry| replace:: **NXsubentry** + +Data File Validation +#################### + +NeXus HDF5 data files can have significant structure and variation. +It can be a challenge to determine that a given file is compliant +with any of the rules specified in the |defs| +(here, we refer to the the applicable NXDL files +and NeXus XML Schema in aggregate as the |defs|). +Additionally, there are various releases and version of the NeXus standard. + +The first test for any file to be considered a NeXus data file is +whether or not the file is a valid HDF5 file. If the file is not HDF5, +it is not a valid NeXus HDF5 data file. + +General +******* + +In general, validation of data files proceeds through several steps: + +#. Is file HDF5? +#. Does file contain one or more |NXentry| [#nxentry]_ groups? +#. Test the |defs| against the file +#. Does the file define a default plot in each |NXdata| group? (recommended but no longer required) +#. Does the file define a path to the default plot? (recommended but no longer required) +#. Is the file a NeXus HDF5 data file? + +Is file HDF5? +============= + +This is a simple test and is handled by the *h5py* package. + +Test |defs| against the data file +================================= + +The |defs| provide specifications for what should be found in a NeXus data file +and where it should be found. Some itmes are optional and some items may be repeated. + +In NeXus data files, the structure is defined by adding `NX_class` attributes to each +of the groups. This structure must match what is defined in the NXDL file for that group. + +Groups must be one of the defined base classes +(or contributed definitions intended for use as a base class, but this is rare) + +Test each |NXentry| group agains the |defs| +=========================================== + +In a NeXus data file, there are one more more |NXentry| groups. Validation proceeds +by walking through each of the groups that define a `NX_class` attribute using the +matching base class (or contributed definition). + +NeXus application definitions are a special case of |NXentry| (or |NXsubentry|) group. +If a group's `NX_class` attribute has the value `NXentry` or `NXsubentry`, that group must +contain a `definition` field. The value of this `definition` field gives the name of the +application definition to which this group (and all its subgroups) must comply. +It is recommended to use `NXsubentry` to contain an application definition. + +Base classes are the building blocks of the NeXus structure. +Application definitions differ from |NXentry| and |NXsubentry| in one important aspect: +content specified in an application definition is *required*, by default. In base classes, +content is *optional* by default. +Contributed definitions include propositions from the community for NeXus base classes +or application definitions, as well as other NXDL files for long-term archival by NeXus. +Consider the contributed definitions as either *candidates* for inclusion in the NeXus standard +or a special case not for general use. + + +.. [#nxentry] http://download.nexusformat.org/doc/html/classes/base_classes/NXentry.html + +Details +******* + +--tba-- + +Parsing the XML Schema +====================== + +The XML Schema defines the constructs of the NXDL language, the various enumerations, +and the default values when the constructs are used in base classes or application definitions. + +Parsing the NXDL files +====================== + +--tba-- + +Application Definitions +======================= + +--tba-- diff --git a/docs/source/demo.rst b/docs/source/demo.rst new file mode 100644 index 0000000000000000000000000000000000000000..c46c7fba949479c097ff379f7da95a24d1ea23fa --- /dev/null +++ b/docs/source/demo.rst @@ -0,0 +1,56 @@ +.. _demo: +.. index:: demo + +User interface: subcommand: **demo** +#################################### + +The *demo* subcommand is useful to +demonstrate HDF5 file validation +and to verify correct program operation. +It uses an example NeXus HDF5 data file supplied +with the *punx* software, the *writer_1_3.hdf5* +example from the NeXus manual. + +.. rubric:: command line help + +.. code-block:: console + + console> punx demo -h + punx demo -h + usage: punx demo [-h] + + optional arguments: + -h, --help show this help message and exit + + + +Examples +++++++++ + +One example of how to use **punx** is shown in the *demo* mode. +This can be used directly after installing the python package. + +Type this command ...:: + + punx demo + +... and this output will appear on the console, +showing a validation of *writer_1_3.hdf5*, an example +NeXus HDF5 data file from the NeXus documentation. + +.. literalinclude:: demo.txt + :language: console + :linenos: + +Problems when running the demo +------------------------------ + +Sometimes, problems happen when running the demo. +In this section are some common problems encountered and +what was done to resolve them. + + +Cannot reach GitHub +~~~~~~~~~~~~~~~~~~~ + +See :ref:`github_api_rate_limit_exceeded` diff --git a/docs/source/demo.txt b/docs/source/demo.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba3ff485ac3a5db489f950fdb40a252487cfd4f0 --- /dev/null +++ b/docs/source/demo.txt @@ -0,0 +1,88 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\main.py + +!!! WARNING: this program is not ready for distribution. + + +console> punx validate C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5 +data file: C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5 +NeXus definitions (branch): master, dated 2018-05-16 02:07:48, sha=2dc081ee4265eebf80a953080a2ed275c1799a21 + +findings +============================ ====== ==================================== ============================================= +address status test comments +============================ ====== ==================================== ============================================= +/ TODO NeXus base class NXroot: more validations needed +/ OK known NXDL NXroot: recognized NXDL specification +/ OK NeXus base class NXroot: known NeXus base class +/ OK NeXus default plot found by v3: /Scan/data/counts +/Scan TODO NeXus base class NXentry: more validations needed +/Scan OK group in base class not defined: NXroot/Scan +/Scan OK known NXDL NXentry: recognized NXDL specification +/Scan OK NeXus base class NXentry: known NeXus base class +/Scan OK NXDL group in data file found: in /Scan/data +/Scan NOTE validItemName relaxed pattern: [A-Za-z_][\w_]* +/Scan@NX_class OK validItemName pattern: NX.+ +/Scan@NX_class OK attribute value recognized NXDL base class: NXentry +/Scan@NX_class OK known attribute known: NXentry@NX_class +/Scan/data TODO NeXus base class NXdata: more validations needed +/Scan/data OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data OK group in base class defined: NXentry/data +/Scan/data OK known NXDL NXdata: recognized NXDL specification +/Scan/data OK NeXus base class NXdata: known NeXus base class +/Scan/data@NX_class OK validItemName pattern: NX.+ +/Scan/data@NX_class OK attribute value recognized NXDL base class: NXdata +/Scan/data@NX_class OK known attribute known: NXdata@NX_class +/Scan/data@axes TODO attribute value implement +/Scan/data@axes OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data@axes OK known attribute known: NXdata@axes +/Scan/data@signal OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data@signal OK valid name @signal=counts strict pattern: [a-z_][a-z0-9_]* +/Scan/data@signal OK attribute value found: @signal=counts +/Scan/data@signal OK known attribute known: NXdata@signal +/Scan/data@signal OK value of @signal found: /Scan/data/counts +/Scan/data@signal OK NeXus default plot v3, NXdata@signal correct default plot setup in /NXentry/NXdata +/Scan/data@two_theta_indices TODO attribute value implement +/Scan/data@two_theta_indices OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data@two_theta_indices OK known attribute unknown: NXdata@two_theta_indices +/Scan/data/counts OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data/counts OK field in base class not defined: NXdata/counts +/Scan/data/counts@units TODO attribute value implement +/Scan/data/counts@units OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data/two_theta OK validItemName strict pattern: [a-z_][a-z0-9_]* +/Scan/data/two_theta OK field in base class not defined: NXdata/two_theta +/Scan/data/two_theta@units TODO attribute value implement +/Scan/data/two_theta@units OK validItemName strict pattern: [a-z_][a-z0-9_]* +============================ ====== ==================================== ============================================= + + +summary statistics +======== ===== =========================================================== ========= +status count description (value) +======== ===== =========================================================== ========= +OK 33 meets NeXus specification 100 +NOTE 1 does not meet NeXus specification, but acceptable 75 +WARN 0 does not meet NeXus specification, not generally acceptable 25 +ERROR 0 violates NeXus specification -10000000 +TODO 7 validation not implemented yet 0 +UNUSED 0 optional NeXus item not used in data file 0 +COMMENT 0 comment from the punx source code 0 +OPTIONAL 38 allowed by NeXus specification, not identified 99 + -- +TOTAL 79 +======== ===== =========================================================== ========= + +<finding>=99.125000 of 72 items reviewed + +console> punx tree C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5 +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5 : NeXus data file + Scan:NXentry + @NX_class = NXentry + data:NXdata + @NX_class = NXdata + @signal = counts + @axes = two_theta + @two_theta_indices = 0 + counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321] + @units = counts + two_theta:NX_FLOAT64[31] = [17.92608, 17.92591, 17.92575, '...', 17.92108] + @units = degrees diff --git a/docs/source/graphics/base_class_hierarchy.dot b/docs/source/graphics/base_class_hierarchy.dot new file mode 100644 index 0000000000000000000000000000000000000000..5eca0d816eccae139f8c7540e0a70b4ec9f70d04 --- /dev/null +++ b/docs/source/graphics/base_class_hierarchy.dot @@ -0,0 +1,134 @@ +digraph G { + #concentrate=true; + rankdir=LR; + NXentry [shape=box,color=red]; + NXdata [shape=box,color=red]; + NXaperture -> NXgeometry [weight=4]; + NXaperture -> NXnote [weight=1]; + NXbeam -> NXdata [weight=2]; + NXbeam_stop -> NXgeometry [weight=1]; + NXbending_magnet -> NXdata [weight=1]; + NXbending_magnet -> NXgeometry [weight=1]; + NXcapillary -> NXdata [weight=2]; + NXcollection -> NXlog [weight=2]; + NXcollection -> NXpositioner [weight=2]; + NXcollimator -> NXgeometry [weight=3]; + NXcollimator -> NXlog [weight=1]; + NXcollimator -> NXpinhole [weight=1]; + NXcollimator -> NXslit [weight=1]; + NXcrystal -> NXdata [weight=2]; + NXcrystal -> NXgeometry [weight=3]; + NXcrystal -> NXlog [weight=1]; + NXcrystal -> NXshape [weight=1]; + NXdetector -> NXcharacterization [weight=1]; + NXdetector -> NXcollection [weight=2]; + NXdetector -> NXdata [weight=1]; + NXdetector -> NXdetector_module [weight=2]; + NXdetector -> NXgeometry [weight=3]; + NXdetector -> NXnote [weight=2]; + NXdetector -> NXtransformations [weight=2]; + NXdisk_chopper -> NXgeometry [weight=1]; + NXentry -> NXcharacterization [weight=1]; + NXentry -> NXcollection [weight=5]; + NXentry -> NXdata [weight=133,shape=box,style=filled,color=red]; + NXentry -> NXevent_data [weight=1]; + NXentry -> NXinstrument [weight=36]; + NXentry -> NXmonitor [weight=20]; + NXentry -> NXnote [weight=5]; + NXentry -> NXparameters [weight=1]; + NXentry -> NXprocess [weight=6]; + NXentry -> NXsample [weight=33]; + NXentry -> NXsubentry [weight=1]; + NXentry -> NXuser [weight=7]; + NXenvironment -> NXgeometry [weight=1]; + NXenvironment -> NXnote [weight=1]; + NXenvironment -> NXsensor [weight=1]; + NXfermi_chopper -> NXgeometry [weight=1]; + NXfilter -> NXdata [weight=1]; + NXfilter -> NXgeometry [weight=1]; + NXfilter -> NXlog [weight=1]; + NXfilter -> NXsensor [weight=1]; + NXfresnel_zone_plate -> NXtransformations [weight=1]; + NXgeometry -> NXorientation [weight=7]; + NXgeometry -> NXshape [weight=9]; + NXgeometry -> NXtranslation [weight=7]; + NXgrating -> NXdata [weight=1]; + NXgrating -> NXshape [weight=1]; + NXgrating -> NXtransformations [weight=1]; + NXguide -> NXdata [weight=1]; + NXguide -> NXgeometry [weight=1]; + NXinsertion_device -> NXdata [weight=1]; + NXinsertion_device -> NXgeometry [weight=1]; + NXinstrument -> NXaperture [weight=3]; + NXinstrument -> NXattenuator [weight=5]; + NXinstrument -> NXbeam [weight=1]; + NXinstrument -> NXbeam_stop [weight=1]; + NXinstrument -> NXbending_magnet [weight=1]; + NXinstrument -> NXcapillary [weight=1]; + NXinstrument -> NXcollection [weight=1]; + NXinstrument -> NXcollimator [weight=4]; + NXinstrument -> NXcrystal [weight=6]; + NXinstrument -> NXdetector [weight=34]; + NXinstrument -> NXdetector_group [weight=1]; + NXinstrument -> NXdisk_chopper [weight=4]; + NXinstrument -> NXevent_data [weight=1]; + NXinstrument -> NXfermi_chopper [weight=4]; + NXinstrument -> NXfilter [weight=1]; + NXinstrument -> NXflipper [weight=1]; + NXinstrument -> NXguide [weight=1]; + NXinstrument -> NXinsertion_device [weight=1]; + NXinstrument -> NXmirror [weight=1]; + NXinstrument -> NXmoderator [weight=3]; + NXinstrument -> NXmonochromator [weight=9]; + NXinstrument -> NXpolarizer [weight=3]; + NXinstrument -> NXpositioner [weight=1]; + NXinstrument -> NXsource [weight=21]; + NXinstrument -> NXvelocity_selector [weight=1]; + NXinstrument -> NXxraylens [weight=1]; + NXmirror -> NXdata [weight=2]; + NXmirror -> NXgeometry [weight=1]; + NXmirror -> NXshape [weight=1]; + NXmoderator -> NXdata [weight=1]; + NXmoderator -> NXgeometry [weight=1]; + NXmoderator -> NXlog [weight=1]; + NXmonitor -> NXgeometry [weight=1]; + NXmonitor -> NXlog [weight=1]; + NXmonochromator -> NXcrystal [weight=1]; + NXmonochromator -> NXdata [weight=1]; + NXmonochromator -> NXgeometry [weight=1]; + NXmonochromator -> NXgrating [weight=1]; + NXmonochromator -> NXvelocity_selector [weight=1]; + NXorientation -> NXgeometry [weight=1]; + NXprocess -> NXcollection [weight=1]; + NXprocess -> NXnote [weight=2]; + NXprocess -> NXparameters [weight=6]; + NXroot -> NXentry [weight=1]; + NXsample -> NXbeam [weight=2]; + NXsample -> NXdata [weight=1]; + NXsample -> NXenvironment [weight=2]; + NXsample -> NXgeometry [weight=1]; + NXsample -> NXlog [weight=3]; + NXsample -> NXorientation [weight=1]; + NXsample -> NXpositioner [weight=1]; + NXsample -> NXtransformations [weight=1]; + NXsample -> NXtranslation [weight=1]; + NXsensor -> NXgeometry [weight=1]; + NXsensor -> NXlog [weight=3]; + NXsensor -> NXorientation [weight=1]; + NXsource -> NXdata [weight=4]; + NXsource -> NXgeometry [weight=1]; + NXsource -> NXnote [weight=1]; + NXsubentry -> NXcharacterization [weight=1]; + NXsubentry -> NXcollection [weight=1]; + NXsubentry -> NXdata [weight=1]; + NXsubentry -> NXinstrument [weight=1]; + NXsubentry -> NXmonitor [weight=1]; + NXsubentry -> NXnote [weight=3]; + NXsubentry -> NXparameters [weight=1]; + NXsubentry -> NXprocess [weight=1]; + NXsubentry -> NXsample [weight=1]; + NXsubentry -> NXuser [weight=1]; + NXtranslation -> NXgeometry [weight=1]; + NXvelocity_selector -> NXgeometry [weight=1]; + NXxraylens -> NXnote [weight=1]; +} diff --git a/docs/source/graphics/base_class_hierarchy.png b/docs/source/graphics/base_class_hierarchy.png new file mode 100644 index 0000000000000000000000000000000000000000..ba114986bc414ca34f9d41832d95f30d66aa6e76 Binary files /dev/null and b/docs/source/graphics/base_class_hierarchy.png differ diff --git a/docs/source/hierarchy.rst b/docs/source/hierarchy.rst new file mode 100644 index 0000000000000000000000000000000000000000..4e4cb37469c6de0a278d71e33e5a4d56645128b6 --- /dev/null +++ b/docs/source/hierarchy.rst @@ -0,0 +1,35 @@ +.. _hierarchy: +.. index:: hierarchy + +User interface: subcommand: **hierarchy** +######################################### + +-tba- + +.. + show NeXus base class hierarchy + + .. tip:: This command only prints a line referring to the + on-line documentation. See that directly here: + :ref:`NeXus base class hierarchy <fig.base.class.hierarchy>` + + This figure was generated by an anlysis of the NeXus NXDL definitions + from the GitHub repository. + + + View the :ref:`NeXus base class hierarchy <fig.base.class.hierarchy>` + + + .. rubric:: command line help + + .. code-block:: console + + console> punx hierarchy -h + punx hierarchy -h + usage: punx hierarchy [-h] something + + positional arguments: + something something help + + optional arguments: + -h, --help show this help message and exit diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..9b0fa00ddad8de6d4c89c23f919f36fce74087df --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,40 @@ +#### +punx +#### + +Python Utilities for NeXus HDF5 files: validation, structure, hierarchy + +* Validation of NeXus NXDL files +* Validation of NeXus HDF5 data files +* Display of NeXus HDF5 data file tree structure +* Display of NeXus base class hierarchy (stretch goal, graphical output) + +NOTE: project is under initial construction + +:author: Pete R. Jemian +:email: prjemian@gmail.com +:copyright: 2017-2018, Pete R. Jemian +:license: Creative Commons Attribution 4.0 International Public License (see *LICENSE.txt*) +:URL: http://punx.readthedocs.io +:git: https://github.com/prjemian/punx +:PyPI: https://pypi.python.org/pypi/punx +:TODO list: https://github.com/prjemian/punx/issues + +:version: |version| +:release: |release| +:published: |today| + +Use these steps to :ref:`install <install>` and try the :ref:`demo <demo>`: + +.. code-block:: console + :linenos: + + pip install punx + punx demo + + +.. toctree:: + :maxdepth: 2 + :hidden: + + contents diff --git a/docs/source/install.rst b/docs/source/install.rst new file mode 100644 index 0000000000000000000000000000000000000000..bcf1fbd476e856a3c4569ce7b63dc284c4a6a766 --- /dev/null +++ b/docs/source/install.rst @@ -0,0 +1,90 @@ +.. _install: +.. index:: install + +Installation +############ + +Released versions of punx are available on `PyPI +<https://pypi.python.org/pypi/punx>`_. + +If you have ``pip`` installed, then you can install:: + + $ pip install punx + +The latest development versions of punx can be downloaded from the +GitHub repository listed above:: + + $ cd /some/directory + $ git clone http://github.com/prjemian/punx.git + +To install in the standard Python location:: + + $ cd punx + $ pip install . + # -or- + $ python setup.py install + +To install in user's home directory:: + + $ python setup.py install --user + +To install in an alternate location:: + + $ python setup.py install --prefix=/path/to/installation/dir + +Updating +******** + +:pip: If you have installed previously with *pip*:: + + $ pip install -U --no-deps punx + +:git: assuming you have cloned as shown above:: + + $ cd /some/directory/punx + $ git pull + $ pip install -U --no-deps . + + +Required Packages +***************** + +It may be necessary to install some prerequisite packages in your python installation. +If you are using an Anaconda python distribution, it is advised to install these +pre-requisites using *conda* rather than *pip*. The pre-requisites include: + +* h5py +* lxml +* numpy +* Qt and PyQt (either v4 or v5) +* requests +* PyGithub + +See your distribution's documentation for how to install these. With Anaconda, use:: + + conda install h5py lxml numpy Qt=5 PyQt=5 requests + pip install PyGitHub pyRestTable + +============ =================================== +Package URL +============ =================================== +h5py http://www.h5py.org +lxml http://lxml.de +numpy http://numpy.scipy.org +PyGithub https://github.com/PyGithub/PyGithub +PyQt4 https://riverbankcomputing.com/software/pyqt/intro +requests http://docs.python-requests.org +============ =================================== + +Optional Packages +***************** + +============ =================================== +Package URL +============ =================================== +pyRestTable http://pyresttable.readthedocs.io +============ =================================== + +The *pyRestTable* package is used for various reports in the punx application. + If using the punx package as a library and developing your own custom + reporting, this package is not required. diff --git a/docs/source/license.rst b/docs/source/license.rst new file mode 100644 index 0000000000000000000000000000000000000000..bcd42a66ad2915338fb7f4f16bdb262f540ba2b0 --- /dev/null +++ b/docs/source/license.rst @@ -0,0 +1,5 @@ +License +======= + +.. literalinclude:: ../../src/punx/LICENSE.txt + :language: text diff --git a/docs/source/nxdl_file_validation.rst b/docs/source/nxdl_file_validation.rst new file mode 100644 index 0000000000000000000000000000000000000000..287ce15ea988431d26bf1181aac98ab63e8be03d --- /dev/null +++ b/docs/source/nxdl_file_validation.rst @@ -0,0 +1,16 @@ +.. _nxdl_file_validation: + +==================== +NXDL File Validation +==================== + +NXDL files must adhere to the specifications of the NeXus XML Schema, as +defined in `nxdl.xsd` and `nxdlTypes.xsd`. + +.. caution:: TODO: citation needed + +Any NXDL file may be validated using the Linux command line tool ``xmllint``. +Such as:: + + user@host ~ $ xmllint --noout --schema nxdl.xsd base_classes/NXentry.nxdl.xml + base_classes/NXentry.nxdl.xml validates diff --git a/docs/source/overview.rst b/docs/source/overview.rst new file mode 100644 index 0000000000000000000000000000000000000000..9eed023d074d70abd639cba02e3d9137cd2bda13 --- /dev/null +++ b/docs/source/overview.rst @@ -0,0 +1,96 @@ +Project Overview +################ + +The **punx** program package is easy to use and has several useful modules. +The first module to try is :ref:`demo <demo>`, which validates +and prints the structure of a NeXus HDF5 data file from the NeXus documentation. + +command line help +***************** + +.. code-block:: console + + console> punx -h + usage: punx [-h] [-v] + {configuration,demonstrate,structure,tree,update,validate} ... + + Python Utilities for NeXus HDF5 files version: 0.2.0+9.g31fd4b4.dirty URL: + http://punx.readthedocs.io + + optional arguments: + -h, --help show this help message and exit + -v, --version show program's version number and exit + + subcommand: + valid subcommands + + {configuration,demonstrate,structure,tree,update,validate} + configuration show configuration details of punx + demonstrate demonstrate HDF5 file validation + structure (deprecated) use ``tree`` + tree show tree structure of HDF5 or NXDL file + update update the local cache of NeXus definitions + validate validate a NeXus file + + Note: It is only necessary to use the first two (or more) characters of any + subcommand, enough that the abbreviation is unique. Such as: ``demonstrate`` + can be abbreviated to ``demo`` or even ``de``. + +Subcommands +*********** + +.. toctree:: + :hidden: + + config + demo + hierarchy + tree + update + validate + +**punx** uses a subcommand structure to provide several different modules under one +identifiable program. These are invoked using commands of the form:: + + punx <subcommand> <other parameters> + +where *<subcommand>* is chosen from this table: + +============================= ==================================================== +subcommand brief description +============================= ==================================================== +:ref:`configuration <config>` show internal punx configuration +:ref:`demonstrate <demo>` demonstrate HDF5 file validation +:ref:`hierarchy <hierarchy>` show NeXus base class hierarchy (not implemented yet) +:ref:`structure <tree>` (deprecated) use :ref:`tree` +:ref:`tree <tree>` show tree structure of HDF5 or NXDL file +:ref:`update <update>` update the local cache of NeXus definitions +:ref:`validate <validate>` validate a NeXus file +============================= ==================================================== + +and the *<other parameters>* are desribed by the help for each subcommand:: + + punx <subcommand> -h + +Example [#]_ :: + + console> punx val -h + usage: punx validate [-h] [--report REPORT] infile + + positional arguments: + infile HDF5 or NXDL file name + + optional arguments: + -h, --help show this help message and exit + --report REPORT select which validation findings to report, choices: + COMMENT,ERROR,NOTE,OK,OPTIONAL,TODO,UNUSED,WARN + + +.. [#] tip: Subcommands may be shortened. + + It is only necessary to use the first two (or more) characters of any + subcommand, enough that the short version remains unique and could not be + misinterpreted as another subcommand. The program imposes a minimum limit + of at least 2-characters. + + Such as: ``demonstrate`` can be abbreviated to ``demo`` or even ``de``. diff --git a/docs/source/source_code/cache_manager.rst b/docs/source/source_code/cache_manager.rst new file mode 100644 index 0000000000000000000000000000000000000000..466e28f7b0833fbf5ca3af462b034467759f4312 --- /dev/null +++ b/docs/source/source_code/cache_manager.rst @@ -0,0 +1,19 @@ +Cache : :mod:`cache_manager` +############################ + +.. index:: NeXus definitions + +Hierarchy: + + +* :mod:`punx.nxdl_manager` +* :mod:`punx.schema_manager` +* :mod:`punx.cache_manager` +* :mod:`punx.github_handler` + +source code documentation +************************* + +.. automodule:: punx.cache_manager + :members: + :synopsis: manages the NXDL cache directories of this project diff --git a/docs/source/source_code/finding.rst b/docs/source/source_code/finding.rst new file mode 100644 index 0000000000000000000000000000000000000000..d69419ca193a8f81c9d23133cda9d7e446a9df61 --- /dev/null +++ b/docs/source/source_code/finding.rst @@ -0,0 +1,12 @@ +Findings : :mod:`finding` +######################### + +Each validation test of an object in the NeXus data file should produce a *finding*. + +source code documentation +************************* + +.. automodule:: punx.finding + :members: + :synopsis: document each item during validation + diff --git a/docs/source/source_code/github_handler.rst b/docs/source/source_code/github_handler.rst new file mode 100644 index 0000000000000000000000000000000000000000..e4370677f1590bd5766c3e46ae2fb5e590e38868 --- /dev/null +++ b/docs/source/source_code/github_handler.rst @@ -0,0 +1,21 @@ +GitHub : :mod:`github_handler` +############################## + +The :mod:`github_handler` module handles all communications +with the NeXus GitHub repository. + + +If the user has provided +GitHub credentials (username and password) in a +`__github_creds__.txt` file in the source code directory, +then the access will be through +the Github Basic Authentication interface. This is helpful since +the GitHub API Rate Limit allows for only a few downloads +through the API per hour if using unauthenticated access. + +source code documentation +************************* + +.. automodule:: punx.github_handler + :members: + :synopsis: manages the communications with GitHub diff --git a/docs/source/source_code/h5tree.rst b/docs/source/source_code/h5tree.rst new file mode 100644 index 0000000000000000000000000000000000000000..97b03081c9692cfe39acbec8557f8c077edd3582 --- /dev/null +++ b/docs/source/source_code/h5tree.rst @@ -0,0 +1,75 @@ +.. _h5tree: + +HDF5 Data File Tree Structure : :mod:`h5tree` +############################################# + +Print the tree structure of any HDF5 file. + +Note: The *tree* subcommand replaces the now-legacy *structure* subcommand and + also [replaces](https://github.com/prjemian/spec2nexus/issues/70) + the `h5toText` program from the + [`spec2nexus`](https://github.com/prjemian/spec2nexus) project. + +.. index:: examples; h5tree + +How to use **h5tree** +********************* + +Print the HDF5 tree of a file:: + + $ punx tree path/to/file/hdf5/file.hdf5 + + +the help message: + +.. code-block:: text + :linenos: + + [linux,512]$ punx tree -h + usage: punx tree [-h] [-a] [-m MAX_ARRAY_ITEMS] infile + + positional arguments: + infile HDF5 or NXDL file name + + optional arguments: + -h, --help show this help message and exit + -a Do not print attributes of HDF5 file structure + -m MAX_ARRAY_ITEMS, --max_array_items MAX_ARRAY_ITEMS + maximum number of array items to be shown + + +Example +******* + +Here's an example from a test data file +(**writer_1_3.h5** from the NeXus documentation [#]_): + +.. code-block:: text + :linenos: + + [linux,512]$ punx tree data/writer_1_3.hdf5 + data/writer_1_3.hdf5 : NeXus data file + Scan:NXentry + @NX_class = NXentry + data:NXdata + @NX_class = NXdata + @signal = counts + @axes = two_theta + @two_theta_indices = [0] + counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321] + @units = counts + two_theta:NX_FLOAT64[31] = [17.926079999999999, 17.925909999999998, 17.925750000000001, '...', 17.92108] + @units = degrees + +.. [#] writer_1_3 from NeXus: + http://download.nexusformat.org/doc/html/examples/h5py/writer_1_3.html + +---- + +source code documentation +************************* + +.. automodule:: punx.h5tree + :members: + :synopsis: Command line tool to print the structure of any HDF5 file + diff --git a/docs/source/source_code/ignore/analyze.rst-ignore b/docs/source/source_code/ignore/analyze.rst-ignore new file mode 100644 index 0000000000000000000000000000000000000000..0f12251a8ff1e172e61b5f8fa8e539ef979a3ff2 --- /dev/null +++ b/docs/source/source_code/ignore/analyze.rst-ignore @@ -0,0 +1,43 @@ + +Analysis : :mod:`analyze` +################################## + +First off, load ALL the NXDL classes, +count the number of times each base class has +any group element (shows hierarchy), +and prepare a directed graph of the base class hierarchy +using graphviz. + +This graph could possibly restore a visualization of +the NeXus base class hierarchy. + +.. compound:: + + .. _fig.base.class.hierarchy: + + .. figure:: ../graphics/base_class_hierarchy.png + :alt: fig.main_window + :width: 50% + + NeXus base class hierarchy. Red indicates + required components. All others are optional. + +Output [#]_ from the :func:`punx.analyze.base_class_hierarchy` +function is used as input +to the ``dot`` program (from the ``graphviz`` package [#]_) +to generate the image file:: + + dot -Tpng base_class_hierarchy.dot -o base_class_hierarchy.png + +.. [#] :download:`base_class_hierarchy.dot <../graphics/base_class_hierarchy.dot>` +.. [#] GraphViz: URL here + +---- + +source code documentation +************************* + +.. automodule:: punx.analyze + :members: + :synopsis: Perform various analyses on the NXDL files + diff --git a/docs/source/source_code/ignore/cache.rst-ignore b/docs/source/source_code/ignore/cache.rst-ignore new file mode 100644 index 0000000000000000000000000000000000000000..22260f9ad72bfb95fa6a2b236653017c3ba82cc7 --- /dev/null +++ b/docs/source/source_code/ignore/cache.rst-ignore @@ -0,0 +1,53 @@ +Cache : :mod:`cache` +#################### + +.. index:: NeXus definitions + +The :mod:`punx.cache` module maintains a local copy of the NeXus +*definitions* (NXDL files and XML Schema) +for use in validating NeXus data files. + +.. index: file ``punx.ini`` + +Additionally, the module maintains a ``punx.ini`` file that +documents the current cached version of the definitions, and other +useful information. This file is maintained using the +``PyQt4.QtCore.QSettings`` class. [#]_ + +There are two distinct cache directories: + +.. index: source cache + +:source cache: + The *source cache* is provided from the installation + source of the **punx** package. It is stored in a subdirectory + of the Python source code. It is provided as a the latest released version + of the NXDL files. + The user may install additional sets of the NeXus definitions (NXDL files) + in the *user cache* and select from any of these for use by punx. + + The *source cache* is updated only by the developer, in preparation + of a source code release. + +.. index: user cache + +:user cache: + The *user cache* is stored in a subdirectory within the user's home + directory. The user may request to update the cache, when network + access to GitHub is available, and the code will check for newer + versions of the NeXus definitions and update the *user cache* as + necessary using method :meth:`punx.cache.update_NXDL_Cache`. + + .. tip:: To determine if the cache should be updated, + the code compares the current GitHub commit hash and + date/time stamp with the *user cache*. + +.. [#] QtCore.QSettings: http://doc.qt.io/qt-4.8/qsettings.html + +source code documentation +************************* + +.. automodule:: punx.cache + :members: + :synopsis: maintain the local cache of NeXus NXDL and XML Schema files + diff --git a/docs/source/source_code/ignore/nxdl_rules.rst-ignore b/docs/source/source_code/ignore/nxdl_rules.rst-ignore new file mode 100644 index 0000000000000000000000000000000000000000..b325db0c466083f50807fe2ca907de840c2079a3 --- /dev/null +++ b/docs/source/source_code/ignore/nxdl_rules.rst-ignore @@ -0,0 +1,19 @@ +NXDL Rules: The XML Schema files : :mod:`nxdl_rules` +######################################################### + +The NXDL is defined by a set of rules expressed in XML Schema. +These rules defined the elements of the NXDL, such as fields and groups. +In addition, the XML Schema provides useful default information +for each structural component, such as how many times an element +can be used in a given context or whether validation should ignore +structure that deviates from the specifications defined by NXDL files. + +---- + +source code documentation +************************* + +.. automodule:: punx.nxdl_rules + :members: + :synopsis: Interpret the NXDL rules (nxdl.xsd & nxdlTypes.xsd) into useful Python components + diff --git a/docs/source/source_code/ignore/nxdlstructure.rst-ignore b/docs/source/source_code/ignore/nxdlstructure.rst-ignore new file mode 100644 index 0000000000000000000000000000000000000000..b17475d66cca51c8e91b3d5db1171086b37afea1 --- /dev/null +++ b/docs/source/source_code/ignore/nxdlstructure.rst-ignore @@ -0,0 +1,15 @@ +NXDL File Structure : :mod:`nxdlstructure` +########################################################### + +Print the structure of a NeXus NXDL definition language file + + +---- + +source code documentation +************************* + +.. automodule:: punx.nxdlstructure + :members: + :synopsis: Load and/or document the structure of a NeXus NXDL class specification + diff --git a/docs/source/source_code/ignore/settings.rst-ignore b/docs/source/source_code/ignore/settings.rst-ignore new file mode 100644 index 0000000000000000000000000000000000000000..c7a91ce58b4e8b5dc5161bb9a50735e9fd277ce4 --- /dev/null +++ b/docs/source/source_code/ignore/settings.rst-ignore @@ -0,0 +1,11 @@ +Settings : :mod:`settings` +############################### + + +source code settings +******************** + +.. automodule:: punx.settings + :members: + :synopsis: manage the settings file for this application + diff --git a/docs/source/source_code/main.rst b/docs/source/source_code/main.rst new file mode 100644 index 0000000000000000000000000000000000000000..a0de6b0f226ff0e86dbf7bf0b059e838b324637b --- /dev/null +++ b/docs/source/source_code/main.rst @@ -0,0 +1,12 @@ +User interface : :mod:`main` +############################ + +Provides the user interface(s) to the punx program. + +source code settings +******************** + +.. automodule:: punx.main + :members: + :synopsis: manage the application's user interface + diff --git a/docs/source/source_code/nxdl_manager.rst b/docs/source/source_code/nxdl_manager.rst new file mode 100644 index 0000000000000000000000000000000000000000..7536634b78875d2ff31c9897dc06c8092d737537 --- /dev/null +++ b/docs/source/source_code/nxdl_manager.rst @@ -0,0 +1,10 @@ +NXDL Manager : :mod:`nxdl_manager` +################################## + + +source code documentation +************************* + +.. automodule:: punx.nxdl_manager + :members: + :synopsis: Load and/or document the structure of a NeXus NXDL class specification diff --git a/docs/source/source_code/nxdl_schema.rst b/docs/source/source_code/nxdl_schema.rst new file mode 100644 index 0000000000000000000000000000000000000000..c169f4e0c489dc170b329271369207998381f3fe --- /dev/null +++ b/docs/source/source_code/nxdl_schema.rst @@ -0,0 +1,14 @@ +NXDL Rules: The XML Schema files : :mod:`nxdl_schema` +##################################################### + +Read the NeXus XML Schema + +---- + +source code documentation +************************* + +.. automodule:: punx.nxdl_schema + :members: + :synopsis: Read the NeXus XML Schema + diff --git a/docs/source/source_code/nxdltree.rst b/docs/source/source_code/nxdltree.rst new file mode 100644 index 0000000000000000000000000000000000000000..937598a9ee23da61ff9bc4131aa5544ae41d51cc --- /dev/null +++ b/docs/source/source_code/nxdltree.rst @@ -0,0 +1,18 @@ +.. _nxdltree: + +NXDL Definition File Tree Structure : :mod:`nxdltree` +##################################################### + +Describe the tree structure of a NeXus Definition Language NXDL XML file. + +Note: The *tree* subcommand replaces the now-legacy *structure* subcommand. + +---- + +source code documentation +************************* + +.. automodule:: punx.nxdltree + :members: + :synopsis: Describe the tree structure of a NXDL XML file + diff --git a/docs/source/source_code/schema_manager.rst b/docs/source/source_code/schema_manager.rst new file mode 100644 index 0000000000000000000000000000000000000000..65ec63eed6d9b512a6b78fdb250da55f1b03012e --- /dev/null +++ b/docs/source/source_code/schema_manager.rst @@ -0,0 +1,13 @@ +Manage the XML Schema files : :mod:`schema_manager` +################################################### + +-tba- + +-------- + +source code documentation +************************* + +.. automodule:: punx.schema_manager + :members: + :synopsis: manages the XML Schema of this project diff --git a/docs/source/source_code/validate.rst b/docs/source/source_code/validate.rst new file mode 100644 index 0000000000000000000000000000000000000000..b1141f60277fd2a22dad3015d9b1d22a79163f59 --- /dev/null +++ b/docs/source/source_code/validate.rst @@ -0,0 +1,79 @@ +.. _source.validate: + +Validation : :mod:`validate` +############################ + +.. index:: validation +.. index:: severity + +The process of validation compares each item in an HDF5 data file +and compares it with the NeXus standards to check that the item is valid +within that standard. Each test is assigned a *finding* result, a +:class:`~punx.finding.Severity` object, with values and meanings +as shown in the table below. + +======= ========= ========================================================== +value color meaning +======= ========= ========================================================== +OK green meets NeXus specification +NOTE palegreen does not meet NeXus specification, but acceptable +WARN yellow does not meet NeXus specification, not generally acceptable +ERROR red violates NeXus specification +TODO blue validation not implemented yet +UNUSED grey optional NeXus item not used in data file +COMMENT grey comment from the *punx* source code +======= ========= ========================================================== + +Items marked with the WARN *severity* status are as noted in either the +NeXus manual [#]_, the NXDL language specification [#]_, or +the NeXus Definition Language (NXDL) files [#]_. + +The *color* is a suggestion for use in a GUI. + +Numerical values are associated with each finding value. +The sum of these values is averaged to produce a numerical +indication of the validation of the file against the NeXus standard. +An average of 100 indicates that the file meets the NeXus +specification for every validation test applied. +An average that is less than zero indicates that the +file contains content that is not valid with the NeXus standard. + + +NeXus HDF5 Data Files +--------------------- + +NeXus data files are HDF5 [#]_ and are validated against the suite of NXDL files +using tools provided by this package. The strategy is to compare the structure +of the HDF file with the structure of the NXDL file(s) as specified by the +``NX_class`` attributes of the various HDF groups in the data file. + +NeXus NXDL Definition Language Files +------------------------------------ + +NXDL files are XML and are validated against the XML Schema file: ``nxdl.xsd``. +See the GitHub repository [#]_ for this file. + +.. [#] NeXus manual: + http://download.nexusformat.org/doc/html/user_manual.html + +.. [#] NXDL Language: + http://download.nexusformat.org/doc/html/nxdl.html + +.. [#] NeXus Class Definitions (NXDL files): + http://download.nexusformat.org/doc/html/classes/index.html + +.. [#] HDF5: + https://support.hdfgroup.org/HDF5/ + +.. [#] NeXus GitHub Definitions repository: + https://github.com/nexusformat/definitions + +---- + +source code documentation +************************* + +.. automodule:: punx.validate + :members: + :synopsis: validate NeXus NXDL and HDF5 data files + diff --git a/docs/source/tree.rst b/docs/source/tree.rst new file mode 100644 index 0000000000000000000000000000000000000000..2571ff5d1d4d8f80eab1d6a88fb2ca13129c0c1e --- /dev/null +++ b/docs/source/tree.rst @@ -0,0 +1,30 @@ +.. _structure: +.. _tree: +.. index:: tree + +User interface: subcommand: **tree** +#################################### + +show tree structure of HDF5 or NXDL file + +.. rubric:: command line help + +.. code-block:: console + + console> punx tree -h + usage: punx tree [-h] [-a] [-m MAX_ARRAY_ITEMS] infile + + positional arguments: + infile HDF5 or NXDL file name + + optional arguments: + -h, --help show this help message and exit + -a Do not print attributes of HDF5 file structure + -m MAX_ARRAY_ITEMS, --max_array_items MAX_ARRAY_ITEMS + maximum number of array items to be shown + + +Examples +++++++++ + +--tba-- diff --git a/docs/source/update.rst b/docs/source/update.rst new file mode 100644 index 0000000000000000000000000000000000000000..cccfbbb072cb737b69d1071185a818706811d40f --- /dev/null +++ b/docs/source/update.rst @@ -0,0 +1,114 @@ +.. _update: +.. index:: update + +User interface: subcommand: **update** +###################################### + +**punx** keeps a local copy of the NeXus definition files. +The originals of these files are located on GitHub. + ++.. caution:: The update process is being refactored, this may not work correctly now + +To *update* the local cache of NeXus definitions, run: + +.. code-block:: console + + console> punx update + + INFO: get repo info: https://api.github.com/repos/nexusformat/definitions/commits + INFO: git sha: 8eb46e229f900d1e77e37c4b6ee6e0405efe099c + INFO: git iso8601: 2016-06-17T18:05:28Z + INFO: not updating NeXus definitions files + +This shows the current cache was up to date. Here's an example +when the source cache needed to be updated: + +.. code-block:: console + + console> punx update + + INFO: get repo info: https://api.github.com/repos/nexusformat/definitions/commits + INFO: git sha: 8eb46e229f900d1e77e37c4b6ee6e0405efe099c + INFO: git iso8601: 2016-06-17T18:05:28Z + INFO: updating NeXus definitions files + INFO: download: https://github.com/nexusformat/definitions/archive/master.zip + INFO: extract ZIP to: C:/Users/Pete/Documents/eclipse/punx/src/punx/cache + + +.. rubric:: command line help + +.. code-block:: console + + console> punx update -h + punx update -h + usage: punx update [-h] [-f] + + optional arguments: + -h, --help show this help message and exit + -f, --force force update (if GitHub available) + + +Examples +******** + +--tba-- + + +Problems +******** + +.. _github_api_rate_limit_exceeded: + +GitHub API rate limit exceeded +============================== + +A common problem happens when updating the NXDL definitions from GitHub. +Here's what it looks like:: + + $ python ./src/punx/main.py update --force + + ('INFO:', 'get repo info: https://api.github.com/repos/nexusformat/definitions/commits') + + Traceback (most recent call last): + + File "./src/punx/main.py", line 416, in <module> + + main() + + File "./src/punx/main.py", line 412, in main + + args.func(args) + + File "./src/punx/main.py", line 170, in func_update + + cache.update_NXDL_Cache(force_update=args.force) + + File "/home/travis/build/prjemian/punx/src/punx/cache.py", line 257, in update_NXDL_Cache + + info = __get_github_info__() # check with GitHub first + + File "/home/travis/build/prjemian/punx/src/punx/cache.py", line 246, in __get_github_info__ + + punx.GITHUB_NXDL_REPOSITORY) + + File "/home/travis/build/prjemian/punx/src/punx/cache.py", line 228, in githubMasterInfo + + raise punx.CannotUpdateFromGithubNow(msg) + + punx.CannotUpdateFromGithubNow: API rate limit exceeded for nn.nn.nn.nn. + (But here's the good news: Authenticated requests get a higher rate limit. + Check out the documentation for more details.) + +GitHub imposes a limit on the number of unauthenticated downloads per hour [#]_. +You can check your rate limit status [#]_. Mostly, this means try again later. + + +.. [#] "The rate limit allows you to make up to 60 requests per hour, + associated with your IP address", + https://developer.github.com/v3/#rate-limiting +.. [#] Status of GitHub API Rate Limit: https://developer.github.com/v3/rate_limit/ + +A GitHub issue has been raised to resolve this for the **punx** project. [#]_ + +.. [#] *update: cannot download NXDL files from GitHub #64,* + https://github.com/prjemian/punx/issues/64 diff --git a/docs/source/validate.rst b/docs/source/validate.rst new file mode 100644 index 0000000000000000000000000000000000000000..e4fe439237740cf9c77cf5c1698cf0cd256030a0 --- /dev/null +++ b/docs/source/validate.rst @@ -0,0 +1,63 @@ +.. _validate: +.. index:: validate, validation + +Validation +########## + +.. toctree:: + :hidden: + + data_file_validation + nxdl_file_validation + +*Validation* is the process of comparing an object with a standard. +An important aspect of validation is the report of each aspect tested and whether +or not it complies with the standard. This is a useful and necessary step when +composing NeXus HDF5 data files or software that will read NeXus data files and when +building NeXus Definition Language (NXDL) files. + +In NeXus, three basic types of object can be validated: + +* :ref:`HDF5 data files <data_file_validation>` must comply with the specifications set forth in the + applicable NeXus base classes, application definitions, and contributed definitions. +* :ref:`NeXus NXDL files <nxdl_file_validation>` must comply with the + XML Schema files `nxdl.xsd` and `nxdlTypes.xsd`. +* **XML Schema files** must comply with the rules defined by the WWW3 consortium. + TODO: citation needed. + +User interface: subcommand: **validate** +**************************************** + +validate a NeXus file + +.. rubric:: command line help + +.. code-block:: console + :linenos: + + usage: punx validate [-h] [--report REPORT] [-l [LOGFILE]] [-i INTEREST] + infile + + positional arguments: + infile HDF5 or NXDL file name + + optional arguments: + -h, --help show this help message and exit + --report REPORT select which validation findings to report, choices: + COMMENT,ERROR,NOTE,OK,TODO,UNUSED,WARN + -l [LOGFILE], --logfile [LOGFILE] + log output to file (default: no log file) + -i INTEREST, --interest INTEREST + logging interest level (1 - 50), default=1 (Level 1) + +The **REPORT** findings are as presented in the table above for each validation step. + +The logging **INTEREST** levels are for output from the program, + +.. + For now, refer to the source code documentation: :ref:`source.validate`. + +Examples +======== + +--tba-- diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000000000000000000000000000000000000..df4dcea56d48f338bc632f00cbbb7915489f3c49 --- /dev/null +++ b/environment.yml @@ -0,0 +1,15 @@ +name: punx +dependencies: + - h5py + - lxml + - numpy + - python=2.7.* + - pyqt + - requests + - sip + - sphinx + - pip: + - versioneer + - pyRestTable + - PyGithub + - sphinx_rtd_theme diff --git a/local_coverage.sh b/local_coverage.sh new file mode 100644 index 0000000000000000000000000000000000000000..381b19341fe8327952c680b66843b0b73bf6120f --- /dev/null +++ b/local_coverage.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# file: local_coverage.sh + +coverage run tests +coverage html +coverage report diff --git a/pypi.bat b/pypi.bat new file mode 100644 index 0000000000000000000000000000000000000000..0473fd274366a09d1974a622141d41e8c277319f --- /dev/null +++ b/pypi.bat @@ -0,0 +1,16 @@ +# refactor and use twine now + +# see: https://pypi.org/project/twine/ + +# refactor the ~/.pypirc file +# see: https://docs.python.org/3/distutils/packageindex.html#the-pypirc-file + +conda install twine + +# remove build and dist directories (or replace wild cards with appropriate version) + +python setup.py sdist bdist_wheel + +twine upload --repository-url https://test.pypi.org/legacy/ dist/* + +twine upload dist/* diff --git a/setup.cfg b/setup.cfg index 5003d6ce7bcb63a22986dc968654542cd7cde087..fd7df8c45686c4dea1a36b944a8e98852b7d23ed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,20 +2,19 @@ description-file = README.rst [bdist_wheel] -universal = 1 +universal=1 [egg_info] tag_build = -tag_date = 0 +tag_date = false [aliases] release = egg_info -RDb '' [versioneer] -vcs = git +VCS = git style = pep440 versionfile_source = src/punx/_version.py versionfile_build = punx/_version.py -tag_prefix = -parentdir_prefix = punx- - +tag_prefix = +parentdir_prefix = punx- diff --git a/setup.py b/setup.py index a1b8a58e7ddaa92ed2d1c2aeca202cbc68133cca..80ef4c11030808e6569eb52c1b7b6977634be6c5 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,8 @@ import punx verbose=1 -long_description = open('README.rst', 'r').read() +README = os.path.join(os.path.dirname(__file__), 'README.rst') +long_description = open(README, 'r').read() setup ( @@ -41,7 +42,7 @@ setup ( platforms = 'any', install_requires = punx.__install_requires__, package_dir = {'': 'src'}, - packages = ['punx', ], + packages = ['punx', 'punx/validations', ], #packages=find_packages(), package_data = { 'punx': [ diff --git a/src/punx.egg-info/PKG-INFO b/src/punx.egg-info/PKG-INFO deleted file mode 100644 index b48bb3943ee69ec4a85579af42539e83f4b72a79..0000000000000000000000000000000000000000 --- a/src/punx.egg-info/PKG-INFO +++ /dev/null @@ -1,78 +0,0 @@ -Metadata-Version: 1.1 -Name: punx -Version: 0.1.9 -Summary: Python Utilities for NeXus -Home-page: http://punx.readthedocs.io -Author: Pete R. Jemian -Author-email: prjemian@gmail.com -License: Creative Commons Attribution 4.0 International Public License (see LICENSE file) -Description: #### - punx - #### - - Python Utilities for NeXus HDF5 files: validation, structure, hierarchy - - * Validation of NeXus NXDL files - * Validation of NeXus HDF5 data files - * Display of NeXus HDF5 data file structure - * Display of NeXus base class hierarchy (stretch goal, graphical output) - - NOTE: project is under initial construction - - :author: Pete R. Jemian - :email: prjemian@gmail.com - :copyright: 2017, Pete R. Jemian - :license: Creative Commons Attribution 4.0 International Public License (see *LICENSE.txt*) - :URL: http://punx.readthedocs.io - :git: https://github.com/prjemian/punx - :PyPI: https://pypi.python.org/pypi/punx/ - :TODO list: https://github.com/prjemian/punx/issues - - :build badges: - - .. see http://shields.io/ for more badge ideas - - .. image:: https://travis-ci.org/prjemian/punx.svg?branch=master - :target: https://travis-ci.org/prjemian/punx - .. image:: https://coveralls.io/repos/github/prjemian/punx/badge.svg?branch=master - :target: https://coveralls.io/github/prjemian/punx?branch=master - - :release badges: - - .. image:: https://img.shields.io/github/tag/prjemian/punx.svg - :target: https://github.com/prjemian/punx/tags - .. image:: https://img.shields.io/github/release/prjemian/punx.svg - :target: https://github.com/prjemian/punx/releases - .. image:: https://img.shields.io/pypi/v/punx.svg - :target: https://pypi.python.org/pypi/punx/ - - :social badges: - - .. image:: http://depsy.org/api/package/pypi/punx/badge.svg - :target: http://depsy.org/package/python/punx - .. image:: https://badges.gitter.im/punx-nexus/Lobby.svg - :target: https://gitter.im/punx-nexus/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge - -Keywords: NeXus,HDF5 -Platform: any -Classifier: Development Status :: 3 - Alpha -Classifier: Environment :: Console -Classifier: Intended Audience :: Science/Research -Classifier: License :: Freely Distributable -Classifier: License :: Public Domain -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Topic :: Scientific/Engineering -Classifier: Topic :: Scientific/Engineering :: Astronomy -Classifier: Topic :: Scientific/Engineering :: Bio-Informatics -Classifier: Topic :: Scientific/Engineering :: Chemistry -Classifier: Topic :: Scientific/Engineering :: Information Analysis -Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator -Classifier: Topic :: Scientific/Engineering :: Mathematics -Classifier: Topic :: Scientific/Engineering :: Physics -Classifier: Topic :: Scientific/Engineering :: Visualization -Classifier: Topic :: Software Development -Classifier: Topic :: Utilities diff --git a/src/punx.egg-info/SOURCES.txt b/src/punx.egg-info/SOURCES.txt deleted file mode 100644 index 124afe5093e313e7fe15fd34ad03a41eacd82158..0000000000000000000000000000000000000000 --- a/src/punx.egg-info/SOURCES.txt +++ /dev/null @@ -1,138 +0,0 @@ -MANIFEST.in -README.rst -setup.cfg -setup.py -versioneer.py -src/punx/LICENSE.txt -src/punx/__init__.py -src/punx/_version.py -src/punx/analyze.py -src/punx/cache.py -src/punx/cache_manager.py -src/punx/dev_main.py -src/punx/finding.py -src/punx/github_handler.py -src/punx/h5structure.py -src/punx/logs.py -src/punx/main.py -src/punx/nxdl_manager.py -src/punx/nxdl_rules.py -src/punx/nxdl_schema.py -src/punx/nxdlstructure.py -src/punx/schema_manager.py -src/punx/settings.py -src/punx/singletons.py -src/punx/validate.py -src/punx.egg-info/PKG-INFO -src/punx.egg-info/SOURCES.txt -src/punx.egg-info/dependency_links.txt -src/punx.egg-info/entry_points.txt -src/punx.egg-info/requires.txt -src/punx.egg-info/top_level.txt -src/punx/cache/v3.2/__github_info__.json -src/punx/cache/v3.2/nxdl.xsd -src/punx/cache/v3.2/nxdlTypes.xsd -src/punx/cache/v3.2/applications/NXarchive.nxdl.xml -src/punx/cache/v3.2/applications/NXarpes.nxdl.xml -src/punx/cache/v3.2/applications/NXcanSAS.nxdl.xml -src/punx/cache/v3.2/applications/NXdirecttof.nxdl.xml -src/punx/cache/v3.2/applications/NXfluo.nxdl.xml -src/punx/cache/v3.2/applications/NXindirecttof.nxdl.xml -src/punx/cache/v3.2/applications/NXiqproc.nxdl.xml -src/punx/cache/v3.2/applications/NXlauetof.nxdl.xml -src/punx/cache/v3.2/applications/NXmonopd.nxdl.xml -src/punx/cache/v3.2/applications/NXmx.nxdl.xml -src/punx/cache/v3.2/applications/NXrefscan.nxdl.xml -src/punx/cache/v3.2/applications/NXreftof.nxdl.xml -src/punx/cache/v3.2/applications/NXsas.nxdl.xml -src/punx/cache/v3.2/applications/NXsastof.nxdl.xml -src/punx/cache/v3.2/applications/NXscan.nxdl.xml -src/punx/cache/v3.2/applications/NXspe.nxdl.xml -src/punx/cache/v3.2/applications/NXsqom.nxdl.xml -src/punx/cache/v3.2/applications/NXstxm.nxdl.xml -src/punx/cache/v3.2/applications/NXtas.nxdl.xml -src/punx/cache/v3.2/applications/NXtofnpd.nxdl.xml -src/punx/cache/v3.2/applications/NXtofraw.nxdl.xml -src/punx/cache/v3.2/applications/NXtofsingle.nxdl.xml -src/punx/cache/v3.2/applications/NXtomo.nxdl.xml -src/punx/cache/v3.2/applications/NXtomophase.nxdl.xml -src/punx/cache/v3.2/applications/NXtomoproc.nxdl.xml -src/punx/cache/v3.2/applications/NXxas.nxdl.xml -src/punx/cache/v3.2/applications/NXxasproc.nxdl.xml -src/punx/cache/v3.2/applications/NXxbase.nxdl.xml -src/punx/cache/v3.2/applications/NXxeuler.nxdl.xml -src/punx/cache/v3.2/applications/NXxkappa.nxdl.xml -src/punx/cache/v3.2/applications/NXxlaue.nxdl.xml -src/punx/cache/v3.2/applications/NXxlaueplate.nxdl.xml -src/punx/cache/v3.2/applications/NXxnb.nxdl.xml -src/punx/cache/v3.2/applications/NXxrot.nxdl.xml -src/punx/cache/v3.2/applications/nxdlformat.xsl -src/punx/cache/v3.2/base_classes/NXaperture.nxdl.xml -src/punx/cache/v3.2/base_classes/NXattenuator.nxdl.xml -src/punx/cache/v3.2/base_classes/NXbeam.nxdl.xml -src/punx/cache/v3.2/base_classes/NXbeam_stop.nxdl.xml -src/punx/cache/v3.2/base_classes/NXbending_magnet.nxdl.xml -src/punx/cache/v3.2/base_classes/NXcapillary.nxdl.xml -src/punx/cache/v3.2/base_classes/NXcharacterization.nxdl.xml -src/punx/cache/v3.2/base_classes/NXcite.nxdl.xml -src/punx/cache/v3.2/base_classes/NXcollection.nxdl.xml -src/punx/cache/v3.2/base_classes/NXcollimator.nxdl.xml -src/punx/cache/v3.2/base_classes/NXcrystal.nxdl.xml -src/punx/cache/v3.2/base_classes/NXdata.nxdl.xml -src/punx/cache/v3.2/base_classes/NXdetector.nxdl.xml -src/punx/cache/v3.2/base_classes/NXdetector_group.nxdl.xml -src/punx/cache/v3.2/base_classes/NXdetector_module.nxdl.xml -src/punx/cache/v3.2/base_classes/NXdisk_chopper.nxdl.xml -src/punx/cache/v3.2/base_classes/NXentry.nxdl.xml -src/punx/cache/v3.2/base_classes/NXenvironment.nxdl.xml -src/punx/cache/v3.2/base_classes/NXevent_data.nxdl.xml -src/punx/cache/v3.2/base_classes/NXfermi_chopper.nxdl.xml -src/punx/cache/v3.2/base_classes/NXfilter.nxdl.xml -src/punx/cache/v3.2/base_classes/NXflipper.nxdl.xml -src/punx/cache/v3.2/base_classes/NXfresnel_zone_plate.nxdl.xml -src/punx/cache/v3.2/base_classes/NXgeometry.nxdl.xml -src/punx/cache/v3.2/base_classes/NXgrating.nxdl.xml -src/punx/cache/v3.2/base_classes/NXguide.nxdl.xml -src/punx/cache/v3.2/base_classes/NXinsertion_device.nxdl.xml -src/punx/cache/v3.2/base_classes/NXinstrument.nxdl.xml -src/punx/cache/v3.2/base_classes/NXlog.nxdl.xml -src/punx/cache/v3.2/base_classes/NXmirror.nxdl.xml -src/punx/cache/v3.2/base_classes/NXmoderator.nxdl.xml -src/punx/cache/v3.2/base_classes/NXmonitor.nxdl.xml -src/punx/cache/v3.2/base_classes/NXmonochromator.nxdl.xml -src/punx/cache/v3.2/base_classes/NXnote.nxdl.xml -src/punx/cache/v3.2/base_classes/NXobject.nxdl.xml -src/punx/cache/v3.2/base_classes/NXorientation.nxdl.xml -src/punx/cache/v3.2/base_classes/NXparameters.nxdl.xml -src/punx/cache/v3.2/base_classes/NXpinhole.nxdl.xml -src/punx/cache/v3.2/base_classes/NXpolarizer.nxdl.xml -src/punx/cache/v3.2/base_classes/NXpositioner.nxdl.xml -src/punx/cache/v3.2/base_classes/NXprocess.nxdl.xml -src/punx/cache/v3.2/base_classes/NXroot.nxdl.xml -src/punx/cache/v3.2/base_classes/NXsample.nxdl.xml -src/punx/cache/v3.2/base_classes/NXsample_component.nxdl.xml -src/punx/cache/v3.2/base_classes/NXsensor.nxdl.xml -src/punx/cache/v3.2/base_classes/NXshape.nxdl.xml -src/punx/cache/v3.2/base_classes/NXslit.nxdl.xml -src/punx/cache/v3.2/base_classes/NXsource.nxdl.xml -src/punx/cache/v3.2/base_classes/NXsubentry.nxdl.xml -src/punx/cache/v3.2/base_classes/NXtransformations.nxdl.xml -src/punx/cache/v3.2/base_classes/NXtranslation.nxdl.xml -src/punx/cache/v3.2/base_classes/NXuser.nxdl.xml -src/punx/cache/v3.2/base_classes/NXvelocity_selector.nxdl.xml -src/punx/cache/v3.2/base_classes/NXxraylens.nxdl.xml -src/punx/cache/v3.2/base_classes/nxdlformat.xsl -src/punx/cache/v3.2/contributed_definitions/NXcontainer.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXelectrostatic_kicker.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXmagnetic_kicker.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXquadrupole_magnet.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXreflections.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXseparator.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXsnsevent.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXsnshisto.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXsolenoid_magnet.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXspecdata.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/NXspin_rotator.nxdl.xml -src/punx/cache/v3.2/contributed_definitions/nxdlformat.xsl -src/punx/data/writer_1_3.hdf5 -src/punx/data/writer_2_1.hdf5 \ No newline at end of file diff --git a/src/punx.egg-info/dependency_links.txt b/src/punx.egg-info/dependency_links.txt deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/src/punx.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/punx.egg-info/entry_points.txt b/src/punx.egg-info/entry_points.txt deleted file mode 100644 index 12e4bcdd5696f5112b3efb738b80441c094e4ad5..0000000000000000000000000000000000000000 --- a/src/punx.egg-info/entry_points.txt +++ /dev/null @@ -1,3 +0,0 @@ -[console_scripts] -punx = punx.main:main - diff --git a/src/punx.egg-info/requires.txt b/src/punx.egg-info/requires.txt deleted file mode 100644 index c7ec085d7a39d7543fcbbbf156df8a488faa714a..0000000000000000000000000000000000000000 --- a/src/punx.egg-info/requires.txt +++ /dev/null @@ -1,6 +0,0 @@ -PyGithub -h5py -lxml -numpy -pyRestTable -requests diff --git a/src/punx.egg-info/top_level.txt b/src/punx.egg-info/top_level.txt deleted file mode 100644 index 1b7e2f67c98be4f09f136641d9bbe51989398fd1..0000000000000000000000000000000000000000 --- a/src/punx.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -punx diff --git a/src/punx/__init__.py b/src/punx/__init__.py index bb413cdc5c522ca844ea57a90d317ea86a50457f..c3dca7c4337707bc23812976de2d7115316ad086 100644 --- a/src/punx/__init__.py +++ b/src/punx/__init__.py @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- -''' +""" Python Utilities for NeXus HDF5 files .. autosummary:: @@ -10,12 +10,12 @@ Python Utilities for NeXus HDF5 files ~SchemaNotFound -''' +""" #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2014-2016, Pete R. Jemian +# :copyright: (c) 2014-2017, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # @@ -30,7 +30,7 @@ if _path not in sys.path: __author__ = 'Pete R. Jemian' __email__ = 'prjemian@gmail.com' -__copyright__ = '2017, Pete R. Jemian' +__copyright__ = '2017-2018, Pete R. Jemian' __package_name__ = 'punx' @@ -57,7 +57,7 @@ __install_requires__ = [ 'requests', # 'PyQt4', # see: http://stackoverflow.com/questions/4628519/is-it-possible-to-require-pyqt-from-setuptools-setup-py - 'PyGithub', + 'PyGithub >= 1.32', ] __classifiers__ = [ #'Development Status :: 5 - Production/Stable', @@ -71,7 +71,8 @@ __classifiers__ = [ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Astronomy', 'Topic :: Scientific/Engineering :: Bio-Informatics', @@ -85,30 +86,6 @@ __classifiers__ = [ 'Topic :: Utilities', ] -GITHUB_NXDL_ORGANIZATION = 'nexusformat' -GITHUB_NXDL_REPOSITORY = 'definitions' -GITHUB_NXDL_BRANCH = 'master' -GLOBAL_INI_GROUP = '___global___' -CACHE_SUBDIR = 'cache' -SOURCE_CACHE_SETTINGS_FILENAME = 'punx.ini' -NXDL_CACHE_SUBDIR = GITHUB_NXDL_REPOSITORY + '-' + GITHUB_NXDL_BRANCH -GITHUB_RETRY_COUNT = 3 - -LOG_MESSAGE = None # a function object, re-define as function to add text to program logs - -# logging level, from logging.__init__.py -CRITICAL = 50 -FATAL = CRITICAL -ERROR = 40 -WARNING = 30 -WARN = WARNING -INFO = 20 -DEBUG = 10 -NOTSET = 0 -# unique to this code -NOISY = 1 -CONSOLE_ONLY = -1 -DEFAULT_LOG_LEVEL = INFO NXDL_XML_NAMESPACE = 'http://definition.nexusformat.org/nxdl/3.1' XMLSCHEMA_NAMESPACE = 'http://www.w3.org/2001/XMLSchema' @@ -116,20 +93,20 @@ NAMESPACE_DICT = {'nx': NXDL_XML_NAMESPACE, 'xs': XMLSCHEMA_NAMESPACE} -class FileNotFound(Exception): - 'custom exception' +class FileNotFound(IOError): + """custom exception""" -class HDF5_Open_Error(Exception): - 'custom exception' +class HDF5_Open_Error(IOError): + """custom exception""" -class SchemaNotFound(Exception): +class SchemaNotFound(IOError): 'custom exception' -class InvalidNxdlFile(Exception): - 'custom exception' +class InvalidNxdlFile(ValueError): + """custom exception""" -class CannotUpdateFromGithubNow(Exception): - 'custom exception' +class CannotUpdateFromGithubNow(IOError): + """custom exception""" from ._version import get_versions __version__ = get_versions()['version'] diff --git a/src/punx/_version.py b/src/punx/_version.py index 3126d6418f4168d7cfc17e787a73f3ba1ba08fbd..f4c741109cde20b171a3067289ac7f7266c81d01 100644 --- a/src/punx/_version.py +++ b/src/punx/_version.py @@ -1,21 +1,520 @@ -# This file was generated by 'versioneer.py' (0.18) from -# revision-control system data, or from the parent directory name of an -# unpacked source archive. Distribution tarballs contain a pre-generated copy -# of this file. +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. -import json +# This file is released into the public domain. Generated by +# versioneer-0.18 (https://github.com/warner/python-versioneer) -version_json = ''' -{ - "date": "2017-07-09T12:02:41-0500", - "dirty": false, - "error": null, - "full-revisionid": "98d1d285b75bff739bd7a2c2e600c8303c7030d1", - "version": "0.1.9" -} -''' # END VERSION_JSON +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = " (tag: 0.2.3)" + git_full = "b180e5c4387947afacea3dd4b3c992b9b8ce5c40" + git_date = "2018-07-21 09:18:20 -0500" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "pep440" + cfg.tag_prefix = "" + cfg.parentdir_prefix = "punx-" + cfg.versionfile_source = "src/punx/_version.py" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, p.returncode + return stdout, p.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%d" % pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} def get_versions(): - return json.loads(version_json) + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for i in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff --git a/src/punx/cache/a4fd52d/__github_info__.json b/src/punx/cache/a4fd52d/__github_info__.json new file mode 100644 index 0000000000000000000000000000000000000000..f26f26093036b53bbe7b86b99a7b0a5b57d50a49 --- /dev/null +++ b/src/punx/cache/a4fd52d/__github_info__.json @@ -0,0 +1,9 @@ +{ + "# description": "NXDL files downloaded from GitHub repository", + "zip_url": "https://github.com/nexusformat/definitions/archive/a4fd52d.zip", + "# written": "2017-06-10 07:06:11.624000", + "sha": "a4fd52d41618f9f2f1651064ec484d2dcc2bd975", + "last_modified": "2016-11-19 01:07:45", + "ref_type": "commit", + "ref": "a4fd52d" +} \ No newline at end of file diff --git a/src/punx/cache/a4fd52d/applications/NXarchive.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXarchive.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..e57e89fd20f6907b70ac2223943a9b4ec5e2e1c2 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXarchive.nxdl.xml @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXarchive" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + This is a definition for data to be archived by ICAT (http://www.icatproject.org/). + + .. text from the icatproject.org site + + the database (with supporting software) that provides an + interface to all ISIS experimental data and will provide + a mechanism to link all aspects of ISIS research from + proposal through to publication. + </doc> + <group type="NXentry" name="entry"> + <attribute name="index"></attribute> + <field name="title" /> + <field name="experiment_identifier" type="NX_CHAR"> + <doc>unique identifier for the experiment</doc> + </field> + <field name="experiment_description" type="NX_CHAR"> + <doc>Brief description of the experiment and its objectives</doc> + </field> + <field name="collection_identifier" type="NX_CHAR"> + <doc>ID of user or DAQ define group of data files </doc> + </field> + <field name="collection_description" type="NX_CHAR"> + <doc>Brief summary of the collection, including grouping criteria </doc> + </field> + <field name="entry_identifier" type="NX_CHAR"> + <doc>unique identifier for this measurement as provided by the facility</doc> + </field> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="duration" type="NX_FLOAT" units="NX_TIME"> + <doc>TODO: needs documentation</doc> + </field> + <field name="collection_time" type="NX_FLOAT" units="NX_TIME"> + <doc>TODO: needs documentation</doc> + </field> + <field name="run_cycle" type="NX_CHAR"> + <doc>TODO: needs documentation</doc> + </field> + <field name="revision" type="NX_CHAR"> + <doc>revision ID of this file, may be after recalibration, reprocessing etc.</doc> + </field> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXarchive"/> + </enumeration> + </field> + <field name="program" type="NX_CHAR"> + <doc>The program and version used for generating this file</doc> + <attribute name="version"></attribute></field> + <field name="release_date" type="NX_CHAR" units="NX_TIME"> + <doc>when this file is to be released into PD</doc></field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field> + <field name="role" type="NX_CHAR"> + <doc>role of the user</doc></field> + <field name="facility_user_id" type="NX_CHAR"> + <doc>ID of the user in the facility burocracy database</doc> + </field> + </group> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" type="NX_CHAR" > + <!-- TODO: suggest changing from enumeration to suggested list --> + <enumeration> + <item value="Spallation Neutron Source"/> + <item value="Pulsed Reactor Neutron Source"/> + <item value="Reactor Neutron Source"/> + <item value="Synchrotron X-Ray Source"/> + <item value="Pulsed Muon Source"/> + <item value="Rotating Anode X-Ray"/> + <item value="Fixed Tube X-Ray"/> + </enumeration> + </field> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <field name="name" type="NX_CHAR"/> + <field name="description" type="NX_CHAR"> + <doc>Brief description of the instrument</doc> + </field> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="sample_id" type="NX_CHAR"> + <doc>Unique database id of the sample</doc> + </field> + <field name="description" type="NX_CHAR"/> + <field name="type" type="NX_CHAR"> + <enumeration> + <item value="sample"/> + <item value="sample+can"/> + <item value="calibration sample"/> + <item value="normalisation sample"/> + <item value="simulated data"/> + <item value="none"/> + <item value="sample_environment"/> + </enumeration> + </field> + <field name="chemical_formula" type="NX_CHAR"> + <doc>Chemical formula formatted according to CIF conventions</doc> + </field> + <field name="preparation_date" type="NX_CHAR" units="NX_TIME"/> + <field name="situation" type="NX_CHAR"> + <doc> + Description of the environment the sample is in: + air, vacuum, oxidizing atmosphere, dehydrated, etc. + </doc> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"/> + <field name="magnetic_field" type="NX_FLOAT" units="NX_CURRENT"/> + <field name="electric_field" type="NX_FLOAT" units="NX_VOLTAGE"/> + <field name="stress_field" type="NX_FLOAT" units="NX_UNITLESS"/> + <field name="pressure" type="NX_FLOAT" units="NX_PRESSURE"/> + </group> + </group> +</definition> + + + + + + + + + + + + + + + diff --git a/src/punx/cache/a4fd52d/applications/NXarpes.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXarpes.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..9deddd571411fd8d144ea17cbe220a3f47a8c395 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXarpes.nxdl.xml @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2012-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXarpes" extends="NXobject" type="group" + version="1.0" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is an application definition for angular resolved photo electron spectroscopy. + + It has been drawn up with hemispherical electron analysers in mind. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use "entry1", "entry2", ... + for analysis software to locate each entry. + </doc> + </attribute> + <field name="title" type="NX_CHAR"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this file conforms.</doc> + <enumeration> + <item value="NXarpes"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type" type="NX_CHAR"/> + <field name="name" type="NX_CHAR"/> + <field name="probe"> + <enumeration> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="energy" type="NX_NUMBER" units="NX_ENERGY"/> + </group> + <group type="NXdetector" name="analyser"> + <field name="data" type="NX_NUMBER" /> + <field name="lens_mode" type="NX_CHAR"> + <doc>setting for the electron analyser lens</doc> + </field> + <field name="acquisition_mode"> + <enumeration> + <item value="swept"/> + <item value="fixed"/> + </enumeration> + </field> + <field name="entrance_slit_shape"> + <enumeration> + <item value="curved"/> + <item value="straight"/> + </enumeration> + </field> + <field name="entrance_slit_setting" type="NX_NUMBER" units="NX_ANY"> + <doc>dial setting of the entrance slit</doc> + </field> + <field name="entrance_slit_size" units="NX_LENGTH"> + <doc>size of the entrance slit</doc> + </field> + <field name="pass_energy" units="NX_ENERGY"> + <doc>energy of the electrons on the mean path of the analyser</doc> + </field> + <field name="time_per_channel" units="NX_TIME"> + <doc>todo: define more clearly</doc> + </field> + <field name="angles" type="NX_NUMBER" units="NX_ANGLE"> + <doc> + Angular axis of the analyser data + which dimension the axis applies to is defined + using the normal NXdata methods. + </doc> + </field> + <field name="energies" type="NX_NUMBER" units="NX_ENERGY"> + <doc> + Energy axis of the analyser data + which dimension the axis applies to is defined + using the normal NXdata methods. + </doc> + </field> + <field name="sensor_size" type="NX_INT"> + <doc>number of raw active elements in fast and slow pixel dimension direction</doc> + <dimensions rank="2" /> + </field> + <field name="region_origin" type="NX_INT"> + <doc>origin of rectangular region selected for readout</doc> + <dimensions rank="2" /> + </field> + <field name="region_size" type="NX_INT"> + <doc>size of rectangular region selected for readout</doc> + <dimensions rank="2" /> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name" type="NX_CHAR"> + <doc>Descriptive name of sample</doc> + </field> + <field name="temperature" type="NX_NUMBER" units="NX_TEMPERATURE"/> + </group> + <group type="NXdata"/> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXdirecttof.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXdirecttof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1b82eb4136bf2162885d56201d358d2ee8fada33 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXdirecttof.nxdl.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXdirecttof" extends="NXtofraw" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>This is a application definition for raw data from a direct geometry TOF spectrometer</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXdirecttof"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXfermi_chopper" name="fermi_chopper"> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXfluo.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXfluo.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..3831ddee7e4cfbab40a5b6e4b4c77c09191359de --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXfluo.nxdl.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXfluo" extends="NXobject" type="group" + version="1.0" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd " + > + <doc> + This is an application definition for raw data from an X-ray fluorescence experiment + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> + Official NeXus NXDL schema to which this file conforms. + </doc> + <enumeration> + <item value="NXfluo"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="x-ray" /> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" type="NX_FLOAT"></field> + </group> + <group type="NXdetector" name="fluorescence"> + <field name="data" type="NX_INT" axes="energy" signal="1"> + <dimensions rank="1"> + <dim index="1" value="nenergy" /> + </dimensions> + </field> + <field name="energy" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nenergy" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT"></field> + </group> + <group type="NXdata" name="data"> + <link name="energy" + target="/entry/instrument/fluorescence/energy"> + </link> + <link name="data" target="/entry/instrument/fluorescence/data"> + </link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXindirecttof.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXindirecttof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..5f5954771e83e2e5a578f3276a1bd4fa5f7f1fe5 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXindirecttof.nxdl.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXindirecttof" extends="NXtofraw" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>This is a application definition for raw data from a direct geometry TOF spectrometer</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXindirecttof"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXmonochromator" name="analyser"> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>analyzed energy </doc> + <dimensions rank="1"> + <dim index="1" value="nDet" /></dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>polar angle towards sample</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance from sample</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions> + </field> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXiqproc.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXiqproc.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..9e657b93a6e47787111c53a4491aaa4b28c34874 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXiqproc.nxdl.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXiqproc" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>Application definition for any :math:`I(Q)` data.</doc> + <group type="NXentry"> + <attribute name="entry"> + <!-- TODO documentation string needed here --> + </attribute> + <field name="title"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXiqproc"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument from which this data was reduced. </doc></field> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="reduction"> + <field name="program" type="NX_CHAR"></field> + <field name="version" type="NX_CHAR"></field> + <group type="NXparameters" name="input"> + <field name="filenames" type="NX_CHAR"> + <doc>Raw data files used to generate this I(Q)</doc></field> + <doc>Input parameters for the reduction program used</doc></group> + <group type="NXparameters" name="output"> + <doc>Eventual output parameters from the data reduction program used</doc></group></group> + <group type="NXdata"> + <field name="data" type="NX_INT" signal="1"> + <doc> + This is I(Q). The client has to analyse the dimensions + of I(Q). Often, multiple I(Q) for various environment + conditions are measured; that would be the first + dimension. Q can be multidimensional, this accounts for + the further dimensions in the data + </doc> + <dimensions rank="3"> + + <dim index="1" value="NE" /> + <dim index="2" value="NQX" /> + <dim index="3" value="NQY" /> + </dimensions> + </field> + <field name="variable" axis="1"> + <dimensions rank="1"> + <dim index="1" value="NE" /></dimensions> + <attribute name="varied_variable"> + <doc>The real name of the varied variable in the first dim of data, temperature, P, MF etc...</doc></attribute></field> + <field name="qx" axis="2"> + <doc>Values for the first dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NQX" /></dimensions></field> + <field name="qy" axis="3"> + <doc>Values for the second dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NQY" /></dimensions></field> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXlauetof.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXlauetof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c0f6e7eee9d5a103d5a7b8755fc0ac96339cf75d --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXlauetof.nxdl.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXlauetof" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + This is the application definition for a TOF laue diffractometer + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXlauetof"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <doc> + This assumes a planar 2D detector. All angles and distances refer to the center of the + detector. + </doc> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The polar_angle (two theta) where the detector is placed.</doc> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The azimuthal angle where the detector is placed.</doc> + </field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="number of x pixels" /> + <dim index="2" value="number of y pixels" /> + <dim index="3" value="nTOF" /> + </dimensions> + <attribute name="signal" type="NX_POSINT"> + <enumeration> + <item value="1" /> + </enumeration> + </attribute> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + The orientation matrix according to Busing and + Levy conventions. This is not strictly necessary as + the UB can always be derived from the data. But + let us bow to common usage which includes thie + UB nearly always. + </doc> + <dimensions rank="2"> + <dim index="1" value="3" /> + <dim index="2" value="3" /> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT"> + <doc> + The unit cell, a, b, c, alpha, beta, gamma. + Again, not strictly necessary, but normally written. + </doc> + <dimensions rank="1"> + <dim index="1" value="6" /> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> Count to a preset value based on either clock time (timer) or received monitor counts + (monitor). </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT"> + <doc>use these attributes ``primary=1 signal=1``</doc> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXmonopd.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXmonopd.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..18b491b2add60477e30b638788d153a8deca1360 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXmonopd.nxdl.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXmonopd" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + Monochromatic Neutron and X-Ray Powder diffractometer + + Instrument + definition for a powder diffractometer at a monochromatic neutron + or X-ray beam. This is both suited for a powder diffractometer + with a single detector or a powder diffractometer with a position + sensitive detector. + </doc> + <group type="NXentry" name="entry"> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXmonopd"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type"/> + <field name="name"/> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + <item value="electron"/> + </enumeration> + </field> + </group> + <group type="NXcrystal"> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Optimum diffracted wavelength</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + </group> + <group type="NXdetector"> + <field name="polar_angle" type="NX_FLOAT" axis="1"> + <doc>where ndet = number of detectors</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + <field name="data" type="NX_INT" signal="1"> + <doc> + detector signal (usually counts) are already + corrected for detector efficiency + </doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Optional rotation angle for the case when the powder diagram + has been obtained through an omega-2theta scan like from a + traditional single detector powder diffractometer + </doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + </group> + <group type="NXdata"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"> + <doc>Link to polar angle in /NXentry/NXinstrument/NXdetector</doc> + </link> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"> + <doc>Link to data in /NXentry/NXinstrument/NXdetector</doc> + </link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v3.2/applications/NXmx.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXmx.nxdl.xml similarity index 99% rename from src/punx/cache/v3.2/applications/NXmx.nxdl.xml rename to src/punx/cache/a4fd52d/applications/NXmx.nxdl.xml index 67e17dbba23ff090cb3755e2d084f953abee1126..4807c031bc5a892b01dda102873d3b031f76440d 100644 --- a/src/punx/cache/v3.2/applications/NXmx.nxdl.xml +++ b/src/punx/cache/a4fd52d/applications/NXmx.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # - # Copyright (C) 2013-2017 NeXus International Advisory Committee (NIAC) + # Copyright (C) 2013-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/a4fd52d/applications/NXrefscan.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXrefscan.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..491a65b0a751dad16cebfd4d260b1c766f7ccbcb --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXrefscan.nxdl.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXrefscan" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + This is an application definition for a monochromatic scanning reflectometer. + + It does not have the information to calculate the resolution + since it does not have any apertures. + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXrefscan"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + <group type="NXdetector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_FLOAT" units="NX_ANY"> + <doc>Monitor counts for each step</doc> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXreftof.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXreftof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a1898c848e34a1ad61892b7f4a6742f48356923 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXreftof.nxdl.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXreftof" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>This is an application definition for raw data from a TOF reflectometer. </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXreftof"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <field name="name" type="NX_CHAR"></field> + <group type="NXdisk_chopper" name="chopper"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance between chopper and sample</doc> + </field> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="xsize" /> + <dim index="2" value="ysize" /> + <dim index="3" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="3"> + <doc> + Array of time values for each bin in a time-of-flight + measurement + </doc> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="x_pixel_size" type="NX_FLOAT" + units="NX_LENGTH"> + </field> + <field name="y_pixel_size" type="NX_FLOAT" + units="NX_LENGTH"> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT" units="NX_ANY"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_INT"> + <doc>Total integral monitor counts</doc> + </field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <doc>Time channels</doc> + </field> + <field name="data" type="NX_INT" signal="1"> + <doc>Monitor counts in each time channel</doc> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="time_binning" target="/NXentry/NXinstrument/NXdetector/time_binning"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v3.2/applications/NXsas.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXsas.nxdl.xml similarity index 99% rename from src/punx/cache/v3.2/applications/NXsas.nxdl.xml rename to src/punx/cache/a4fd52d/applications/NXsas.nxdl.xml index 845f1ef04709326f88e91a98c593963fac874af1..8a8ae9771bac09801029f82cb94de1264a7cee36 100644 --- a/src/punx/cache/v3.2/applications/NXsas.nxdl.xml +++ b/src/punx/cache/a4fd52d/applications/NXsas.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/v3.2/applications/NXsastof.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXsastof.nxdl.xml similarity index 99% rename from src/punx/cache/v3.2/applications/NXsastof.nxdl.xml rename to src/punx/cache/a4fd52d/applications/NXsastof.nxdl.xml index 6f08e67db756fb43d7e83415f19f80e9b1f2e317..cc7e25d6940b2d3f1f0956f88f8c7d1d816b977a 100644 --- a/src/punx/cache/v3.2/applications/NXsastof.nxdl.xml +++ b/src/punx/cache/a4fd52d/applications/NXsastof.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/a4fd52d/applications/NXscan.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXscan.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..8fcbde12ebc7ff5039fa0edb6dfe8f5300141485 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXscan.nxdl.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXscan" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + Application definition for a generic scan instrument. + + This definition is more an + example then a stringent definition as the content of a given NeXus scan file needs to + differ for different types of scans. This example definition shows a scan like done + on a rotation camera: the sample is rotated and a detector image, the rotation angle + and a monitor value is stored at each step in the scan. In the following, the symbol + ``NP`` is used to represent the number of scan points. These are the rules for + storing scan data in NeXus files which are implemented in this example: + + * Each value varied throughout a scan is stored as an array of + length ``NP`` at its respective location within the NeXus hierarchy. + * For area detectors, ``NP`` is the first dimension, + example for a detector of 256x256: ``data[NP,256,256]`` + * The NXdata group contains links to all variables varied in the scan and the data. + This to give an equivalent to the more familiar classical tabular representation of scans. + + These rules exist for a reason: HDF allows the first dimension of a data set to be + unlimited. This means the data can be appended too. Thus a NeXus file built according + to the rules given above can be used in the following way: + + * At the start of a scan, write all the static information. + * At each scan point, append new data from varied variables + and the detector to the file. + </doc> + <group type="NXentry"> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="definition" type="NX_CHAR"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXscan"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXdetector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="NP" /> + <dim index="2" value="xdim" /> + <dim index="3" value="ydim" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="rotation_angle" type="NX_FLOAT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + <group type="NXmonitor"> + <field name="data" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + </group> + <group type="NXdata"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXspe.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXspe.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a96afe1392e71b52022ebeff94699f8a60d9d7af --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXspe.nxdl.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + name="NXspe" + extends="NXobject" + type="group" + category="application" + version="1.0"> + <doc>NXSPE Inelastic Format. Application definition for NXSPE file format. </doc> + <group type="NXentry"> + <field name="program_name"/> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this file conforms.</doc> + <attribute name="version"/> + <enumeration> + <item value="NXSPE"/> + <item value="NXspe"/> + </enumeration> + </field> + <group type="NXcollection" name="NXSPE_info"> + <field name="fixed_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>The fixed energy used for this file.</doc> + </field> + <field name="ki_over_kf_scaling" type="NX_BOOLEAN"> + <doc>Indicates whether ki/kf scaling has been applied or not.</doc> + </field> + <field name="psi" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Orientation angle as expected in DCS-MSlice</doc> + </field> + </group> + <group type="NXdata" name="data"> + <field name="azimuthal" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="azimuthal_width" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="polar" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="polar_width" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="data" type="NX_NUMBER"/> + <field name="error" type="NX_NUMBER"/> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"/> + </group> + <group type="NXinstrument"> + <field name="name" type="NX_CHAR"/> + <group type="NXfermi_chopper"> + <field name="energy" type="NX_NUMBER" units="NX_ENERGY"/> + </group> + </group> + <group type="NXsample"> + <field name="rotation_angle" type="NX_NUMBER" units="NX_ANGLE"/> + <field name="seblock" type="NX_CHAR"/> + <field name="temperature" type="NX_NUMBER" units="NX_TEMPERATURE"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXsqom.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXsqom.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..523479e5d4d93b73f6fb62be3605e98626669beb --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXsqom.nxdl.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsqom" extends="NXobject" type="group" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" version="1.0b" + > + <doc> + This is the application definition for S(Q,OM) processed data. + + As this kind of data is in + general not on a rectangular grid after data reduction, it is stored as Q,E positions plus their + intensity, table like. It is the task of a possible visualisation program to regrid this data in + a sensible way. + </doc> + <group type="NXentry"> + <attribute name="entry"> </attribute> + <field name="title"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXsqom"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type"/> + <field name="name"/> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + <item value="electron"/> + </enumeration> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument from which this data was reduced. </doc> + </field> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="reduction"> + <field name="program" type="NX_CHAR"/> + <field name="version" type="NX_CHAR"/> + <group type="NXparameters" name="input"> + <field name="filenames" type="NX_CHAR"> + <doc>Raw data files used to generate this I(Q)</doc> + </field> + <doc>Input parameters for the reduction program used</doc> + </group> + <group type="NXparameters" name="output"> + <doc>Eventual output parameters from the data reduction program used</doc> + </group> + </group> + <group type="NXdata"> + <field name="data" type="NX_INT" signal="1"> + <doc> This is the intensity for each point in QE </doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="qx" axis="1" units="NX_WAVENUMBER"> + <doc>Positions for the first dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="qy" axis="1" units="NX_WAVENUMBER"> + <doc>Positions for the the second dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="qz" axis="1" units="NX_WAVENUMBER"> + <doc>Positions for the the third dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="en" axis="1" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Values for the energy transfer for each point</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXstxm.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXstxm.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..24d40cad974a6ffde9c2bd7c1393b2dbafab697e --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXstxm.nxdl.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition name="NXstxm" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.1" + > + <symbols> + <doc>These symbols will be used below to coordinate the shapes of the datasets.</doc> + <symbol name="numP"><doc>total number of scan points</doc></symbol> + <symbol name="numE"><doc>number of photon energies scanned</doc></symbol> + <symbol name="numY"><doc>number of pixels in Y direction</doc></symbol> + <symbol name="numX"><doc>number of pixels in X direction</doc></symbol> + </symbols> + <doc> + Application definition for a STXM instrument. + + The interferometer + position measurements, monochromator photon energy values and + detector measurements are all treated as NXdetectors and stored + within the NXinstrument group as lists of values stored in + chronological order. The NXdata group then holds another version + of the data in a regular 3D array (NumE by NumY by NumX, for a + total of NumP points in a sample image stack type scan). The former + data values should be stored with a minimum loss of precision, while + the latter values can be simplified and/or approximated in order to + fit the constraints of a regular 3D array. 'Line scans' and 'point spectra' + are just sample_image scan types with reduced dimensions in the same way + as single images have reduced E dimensions compared to image 'stacks'. + </doc> + <group type="NXentry"> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="definition" type="NX_CHAR" minOccurs="1" maxOccurs="1"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXstxm"/> + </enumeration> + </field> + <group type="NXinstrument" minOccurs="1" maxOccurs="1"> + <group type="NXsource" minOccurs="1" maxOccurs="1"> + <field name="type" minOccurs="1" maxOccurs="1"/> + <field name="name" minOccurs="1" maxOccurs="1"/> + <field name="probe" minOccurs="1" maxOccurs="1"/> + </group> + <group type="NXmonochromator" name="monochromator" minOccurs="1" maxOccurs="1"> + <field name="energy" minOccurs="1" maxOccurs="1"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" minOccurs="1"> + <field name="data" type="NX_NUMBER"> + <dimensions> + <doc> Detector data should be presented with the first dimension corresponding to the + scan point and subsequent dimensions corresponding to the output of the detector. + Detectors that provide more than one value per scan point should have + a data array of rank 1+d, where d is the dimensions of the array provided per + scan point. For example, an area detector should have an NXdetector data array + of 3 dimensions, with the first being the set of scan points and the latter + two being the x- and y- extent of the detector </doc> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample_x" minOccurs="0" maxOccurs="1"> + <doc> Measurements of the sample position from the x-axis interferometer.</doc> + <field name="data" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample_y" minOccurs="0" maxOccurs="1"> + <doc> Measurements of the sample position from the y-axis interferometer.</doc> + <field name="data" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample_z" minOccurs="0" maxOccurs="1"> + <doc> Measurements of the sample position from the z-axis interferometer.</doc> + <field name="data" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="rotation_angle" type="NX_FLOAT" /> + </group> + <group type="NXdata"> + <field name="stxm_scan_type" minOccurs="1" maxOccurs="1"> + <doc> Label for typical scan types as a convenience for humans. + Each label corresponds to a specific set of axes being scanned + to produce a data array of shape: + + * sample point spectrum: (photon_energy,) + * sample line spectrum: (photon_energy, sample_y/sample_x) + * sample image: (sample_y, sample_x) + * sample image stack: (photon_energy, sample_y, sample_x) + * sample focus: (zoneplate_z, sample_y/sample_x) + * osa image: (osa_y, osa_x) + * osa focus: (zoneplate_z, osa_y/osa_x) + * detector image: (detector_y, detector_x) + + The "generic scan" string is to be used when none of the + other choices are appropriate. + </doc> + <enumeration> + <item value="sample point spectrum"/> + <item value="sample line spectrum"/> + <item value="sample image"/> + <item value="sample image stack"/> + <item value="sample focus"/> + <item value="osa image"/> + <item value="osa focus"/> + <item value="detector image"/> + <item value="generic scan"/> + </enumeration> + </field> + <field name="data" type="NX_NUMBER" signal="1"> + <doc> Detectors that provide more than one value per scan point should be summarised + to a single value per scan point for this array in order to simplify plotting. + + Note that 'Line scans' and focus type scans measure along one spatial dimension + but are not restricted to being parallel to the X or Y axes. Such scans + should therefore use a single dimension for the positions along the spatial + line. The 'sample_x' and 'sample_y' fields should then contain lists of the + x- and y-positions and should both have the 'axis' attribute pointing to the same dimension.</doc> + </field> + <field name="energy" type="NX_FLOAT" minOccurs="1" maxOccurs="1"> + <doc> List of photon energies of the X-ray beam. If scanned through multiple values, + then an 'axis' attribute will be required to link the field to the appropriate data array dimension.</doc> + <dimensions rank="1"> + <dim index="1" value="NumE" /> + </dimensions> + </field> + <field name="sample_y" type="NX_FLOAT" minOccurs="1" maxOccurs="1"> + <doc> List of Y positions on the sample. If scanned through multiple values, + then an 'axis' attribute will be required to link the field to the appropriate data array dimension.</doc> + <dimensions rank="1"> + <dim index="1" value="NumY" /> + </dimensions> + </field> + <field name="sample_x" type="NX_FLOAT" minOccurs="1" maxOccurs="1"> + <doc> List of X positions on the sample. If scanned through multiple values, + then an 'axis' attribute will be required to link the field to the appropriate data array dimension.</doc> + <dimensions rank="1"> + <dim index="1" value="NumX" /> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control" minOccurs="0" maxOccurs="1"> + <field name="data" type="NX_FLOAT"> + <doc> Values to use to normalise for time-variations in photon flux. Typically, the synchrotron storage ring + electron beam current is used as a proxy for the X-ray beam intensity. Array must have same shape as the + NXdata groups.</doc> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtas.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtas.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..6a75c1e676ae1f76e17bcf905df7458d66ab8618 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtas.nxdl.xml @@ -0,0 +1,184 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtas" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + This is an application definition for a triple axis spectrometer. + + It is for the trademark scan of the TAS, the Q-E scan. + For your alignment scans use the rules in :ref:`NXscan`. + </doc> + <group type="NXentry" name="entry"> + <field name="title" type="NX_CHAR" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtas"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + </enumeration> + </field> + </group> + <group type="NXcrystal" name="monochromator"> + <field name="ei" type="NX_FLOAT" units="NX_ENERGY" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXcrystal" name="analyser"> + <field name="ef" type="NX_FLOAT" units="NX_ENERGY" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdetector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="qh" type="NX_FLOAT" units="NX_DIMENSIONLESS" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="qk" type="NX_FLOAT" units="NX_DIMENSIONLESS" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="ql" type="NX_FLOAT" units="NX_DIMENSIONLESS" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="en" type="NX_FLOAT" units="NX_ENERGY" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="sgu" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="sgl" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <dimensions rank="1"> + <dim index="1" value="9"/> + </dimensions> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + <dimensions rank="1"> + <dim index="1" value="np"></dim></dimensions> + </field> + </group> + <group type="NXdata"> + <doc>One of the ei,ef,qh,qk,ql,en should get a primary=1 attribute to denote the main scan axis</doc> + <link name="ei" target="/NXentry/NXinstrument/monochromator:NXcrystal/ei"/> + <link name="ef" target="/NXentry/NXinstrument/analyzer:NXcrystal/ef"/> + <link name="en" target="/NXentry/NXsample/en"/> + <link name="qh" target="/NXentry/NXsample/qh"/> + <link name="qk" target="/NXentry/NXsample/qk"/> + <link name="ql" target="/NXentry/NXsample/ql"/> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtofnpd.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtofnpd.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c8560880aea9398aa53f18941048d80eb39f04ab --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtofnpd.nxdl.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtofnpd" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>This is a application definition for raw data from a TOF neutron powder diffractometer</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtofnpd"></item> + </enumeration> + </field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flight path before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field></group> + <group type="NXinstrument"> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="2"> + <dim index="1" value="ndet" /><dim index="2" value="ntimechan" /> + </dimensions> + </field> + <field name="detector_number" type="NX_INT" axis="2"> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions></field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance to sample for each detector</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>azimuthal angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="detector_number" target="/NXentry/NXinstrument/NXdetector/detector_number"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtofraw.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtofraw.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..bef46189c7b707b4d17a6f521cadd7eee449c2aa --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtofraw.nxdl.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtofraw" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>This is an application definition for raw data from a generic TOF instrument</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtofraw"></item> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT"></field> + <field name="run_number" type="NX_INT"></field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flight path before the sample position. This can be determined by a chopper, + by the moderator, or the source itself. In other words: it is the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field></group> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="2"> + <dim index="1" value="ndet" /> + <dim index="2" value="ntimechan" /> + </dimensions> + </field> + <field name="detector_number" type="NX_INT" axis="2"> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance to sample for each detector</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim> + </dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature" type="NX_CHAR"> + <enumeration> + <item value="powder"></item> + <item value="liquid"></item> + <item value="single crystal"></item> + </enumeration></field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + <field name="integral_counts" type="NX_INT" units="NX_UNITLESS"></field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="detector_number" target="/NXentry/NXinstrument/NXdetector/detector_number"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtofsingle.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtofsingle.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4725e8a60bb9f4a01af64aadbef54da361b2779e --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtofsingle.nxdl.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtofsingle" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc>This is a application definition for raw data from a generic TOF instrument</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtofsingle"></item> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT"></field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flight path before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field></group> + <group type="NXinstrument"> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="xsize" /> + <dim index="2" value="ysize" /> + <dim index="3" value="ntimechan" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance to sample for the center of the detector</doc> + <dimensions rank="1"> + <dim index="1" value="1" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>azimuthal angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature" type="NX_CHAR"> + <enumeration> + <item value="powder"></item> + <item value="liquid"></item> + <item value="single crystal"></item> + </enumeration></field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="detector_number" target="/NXentry/NXinstrument/NXdetector/detector_number"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtomo.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtomo.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..049367f4ecc32be078ead513be7ca1b961150dd6 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtomo.nxdl.xml @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtomo" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="2.0" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="nFrames"><doc>number of frames</doc></symbol> + <symbol name="xsize"><doc>number of pixels in X direction</doc></symbol> + <symbol name="ysize"><doc>number of pixels in Y direction</doc></symbol> + </symbols> + + <doc> + This is the application definition for x-ray or neutron tomography raw data. + + In tomography + a number of dark field images are measured, some bright field images and, of course the sample. + In order to distinguish between them images carry a image_key. + </doc> + <group type="NXentry" name="entry"> + <field name="title" minOccurs="0" maxOccurs="1"/> + <field name="start_time" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"/> + <field name="end_time" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtomo"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" minOccurs="0" maxOccurs="1"> + <field name="type" minOccurs="0" maxOccurs="1"/> + <field name="name" minOccurs="0" maxOccurs="1"/> + <field name="probe" minOccurs="0" maxOccurs="1"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="nFrames" /> + <dim index="2" value="xsize" /> + <dim index="3" value="ysize" /> + </dimensions> + </field> + <field name="image_key" type="NX_INT" > + <doc> + In order + to distinguish between sample projectrions, dark and flat + images, a magic number is recorded per frame. + The key is as follows: + + * projection = 0 + * flat field = 1 + * dark field = 2 + * invalid = 3 + </doc> + <dimensions rank="1"> + <dim index="1" value="nFrames" /> + </dimensions> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Distance between detector and sample</doc> + </field> + <field name="x_rotation_axis_pixel_position" type="NX_FLOAT" minOccurs="0" maxOccurs="1"/> + <field name="y_rotation_axis_pixel_position" type="NX_FLOAT" minOccurs="0" maxOccurs="1"/> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + In practice this axis is always aligned along one pixel direction on the detector and usually vertical. + There are experiments with horizontal rotation axes, so this would need to be indicated somehow. + For now the best way for that is an open question. + </doc> + <dimensions rank="1"> + <dim index="1" value="nFrames" /> + </dimensions> + </field> + <field name="x_translation" units="NX_LENGTH" type="NX_FLOAT" minOccurs="0" maxOccurs="1"> + <dimensions rank="1"> + <dim value="nFrames" index="1"/> + </dimensions> + </field> + <field name="y_translation" units="NX_LENGTH" type="NX_FLOAT" minOccurs="0" maxOccurs="1"> + <dimensions rank="1"> + <dim value="nFrames" index="1"/> + </dimensions> + </field> + <field name="z_translation" units="NX_LENGTH" type="NX_FLOAT" minOccurs="0" maxOccurs="1"> + <dimensions rank="1"> + <dim value="nFrames" index="1"/> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control" minOccurs="0" maxOccurs="1"> + <field name="data" type="NX_FLOAT" units="NX_ANY"> + <doc> + Total integral monitor counts for each measured frame. Allows a to correction for + fluctuations in the beam between frames. + </doc> + <dimensions rank="1"> + <dim index="1" value="nFrames" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/detector:NXdetector/data"/> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"/> + <link name="image_key" target="/NXentry/NXinstrument/detector:NXdetector/image_key"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtomophase.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtomophase.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6b87636a10d583cdaf499265037272a00f86a2f --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtomophase.nxdl.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtomophase" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="nBrightFrames"><doc>number of bright frames</doc></symbol> + <symbol name="nDarkFrames"><doc>number of dark frames</doc></symbol> + <symbol name="nSampleFrames"><doc>number of image (sample) frames</doc></symbol> + <symbol name="nPhase"><doc>number of phase settings</doc></symbol> + <symbol name="xsize"><doc>number of pixels in X direction</doc></symbol> + <symbol name="ysize"><doc>number of pixels in Y direction</doc></symbol> + </symbols> + + <doc> + This is the application definition for x-ray or neutron tomography raw data with phase contrast variation at each point. + + In tomography first + some dark field images are measured, some bright field images and, of course the sample. In order + to properly sort the order of the images taken, a sequence number is stored with each image. + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtomophase"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXdetector" name="bright_field"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="nBrightFrames" /> + <dim index="2" value="xsize" /> + <dim index="3" value="ysize" /> + </dimensions> + </field> + <field name="sequence_number" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="nBrightFrames" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="dark_field"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="nDarkFrames" /> + <dim index="2" value="xsize" /> + <dim index="3" value="ysize" /> + </dimensions> + </field> + <field name="sequence_number" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="nDarkFrames" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="4"> + <dim index="1" value="nSampleFrames" /> + <dim index="2" value="nPhase" /> + <dim index="3" value="xsize" /> + <dim index="4" value="ysize" /> + </dimensions> + </field> + <field name="sequence_number" type="NX_INT"> + <dimensions rank="2"> + <dim index="1" value="nSampleFrames" /> + <dim index="2" value="nPhase" /> + </dimensions> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance between detector and sample</doc> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <dimensions rank="1"> + <dim index="1" value="nSampleFrames" /> + </dimensions> + </field> + <field name="x_translation" units="NX_LENGTH" type="NX_FLOAT"> + <dimensions rank="1"> + <dim value="nSampleFrames" index="1"/> + </dimensions> + </field> + <field name="y_translation" units="NX_LENGTH" type="NX_FLOAT"> + <dimensions rank="1"> + <dim value="nSampleFrames" index="1"/> + </dimensions> + </field> + <field name="z_translation" units="NX_LENGTH" type="NX_FLOAT"> + <dimensions rank="1"> + <dim value="nSampleFrames" index="1"/> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc> + Total integral monitor counts for each measured frame. Allows a correction for + fluctuations in the beam between frames. + </doc> + <dimensions rank="1"> + <dim index="1" value="nDarkFrames + nBrightFrames + nSampleFrame" /> + <!-- TODO: nPhase? --> + </dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/sample:NXdetector/data"/> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXtomoproc.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXtomoproc.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d622a9611480e63ca98a6bc7310dda1bfbd0f6e4 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXtomoproc.nxdl.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtomoproc" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="nx"><doc>number of voxels in X direction</doc></symbol> + <symbol name="ny"><doc>number of voxels in Y direction</doc></symbol> + <symbol name="nz"><doc>number of voxels in Z direction</doc></symbol> + </symbols> + + <doc>This is an application definition for the final result of a tomography experiment: a 3D construction of some volume of physical properties.</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtomoproc"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="reconstruction"> + <field name="program" type="NX_CHAR"> + <doc>Name of the program used for reconstruction</doc> + </field> + <field name="version" type="NX_CHAR"> + <doc>Version of the program used</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date and time of reconstruction processing.</doc> + </field> + <group type="NXparameters" name="parameters"> + <field name="raw_file" type="NX_CHAR"> + <doc>Original raw data file this data was derived from</doc> + </field> + </group> + </group> + <group type="NXdata" name="data"> + <field name="data" type="NX_INT" signal="1"> + <doc> + This is the reconstructed volume. This can be different + things. Please indicate in the unit attribute what physical + quantity this really is. + </doc> + <dimensions rank="3"> + <dim index="1" value="nx" /> + <dim index="2" value="nx" /> + <dim index="3" value="nz" /> + </dimensions> + <attribute name="transform"></attribute> + <attribute name="offset"></attribute> + <attribute name="scaling"></attribute> + </field> + <field name="x" type="NX_FLOAT" units="NX_ANY" axis="1"> + <doc> + This is an array holding the values to use for the x-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nx" /> + </dimensions> + </field> + <field name="y" type="NX_FLOAT" units="NX_ANY" axis="2"> + <doc> + This is an array holding the values to use for the y-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="ny" /> + </dimensions> + </field> + <field name="z" type="NX_FLOAT" units="NX_ANY" axis="3"> + <doc> + This is an array holding the values to use for the z-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nz" /> + </dimensions> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxas.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxas.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..19b1e6ddf790988c264b6746c8092bee2a5adf1d --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxas.nxdl.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxas" extends="NXobject" type="group" + version="1.0" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd " + > + <doc> + This is an application definition for raw data from an X-ray absorption spectroscopy experiment. + + This is essentially a scan on energy versus incoming/ + absorbed beam. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use "entry1", "entry2", ... + for analysis software to locate each entry. + </doc> + </attribute> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxas"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type"/> + <field name="name"/> + <field name="probe"> + <enumeration> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="energy" axis="1" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="incoming_beam"> + <field name="data" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="absorbed_beam"> + <field name="data" type="NX_INT"> + <doc>mark this field with attribute ``signal=1``</doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="np" /></dimensions></field> + </group> + <group type="NXdata"> + <link name="energy" target="/entry/instrument/monochromator/energy"></link> + <link name="absorbed_beam" target="/entry/instrument/absorbed_beam/data"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxasproc.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxasproc.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..99572c2678a2012d82143f1b74b054d7da235273 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxasproc.nxdl.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxasproc" extends="NXobject" type="group" + version="1.0" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd " + > + <doc> + Processed data from XAS. This is energy versus I(incoming)/I(absorbed). + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use "entry1", "entry2", ... + for analysis software to locate each entry. + </doc> + </attribute> + <field name="title"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxasproc"></item> + </enumeration> + </field> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="XAS_data_reduction"> + <field name="program" type="NX_CHAR"> + <doc>Name of the program used for reconstruction</doc> + </field> + <field name="version" type="NX_CHAR"> + <doc>Version of the program used</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date and time of reconstruction processing.</doc> + </field> + <group type="NXparameters" name="parameters"> + <field name="raw_file" type="NX_CHAR"> + <doc>Original raw data file this data was derived from</doc> + </field> + </group> + </group> + <group type="NXdata"> + <field name="energy" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="data" type="NX_FLOAT"> + <doc> + This is corrected and calibrated I(incoming)/I(absorbed). So it is the absorption. + Expect attribute ``signal=1`` + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxbase.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxbase.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b82a120eb00d3546b96c27401e5e3e984fa8a91 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxbase.nxdl.xml @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxbase" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + This definition covers the common parts of all monochromatic single crystal raw data application definitions. + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxbase"></item> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + <group type="NXdetector" name="detector" maxOccurs="unbounded"> + <field name="data" type="NX_INT" signal="1"> + <doc> + The area detector data, the first dimension is always the + number of scan points, the second and third are the number + of pixels in x and y. The origin is always assumed to be + in the center of the detector. maxOccurs is limited to the + the number of detectors on your instrument. + </doc> + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="number of x pixels" /> + <dim index="3" value="number of y pixels" /> + </dimensions> + <attribute name="signal" type="NX_POSINT"> + <enumeration> + <item value="1" /> + </enumeration> + </attribute> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <doc> + The name of the group is detector if there is only one detector, + if there are several, names have to be detector1, + detector2, ...detectorn.</doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="frame_start_number" type="NX_INT"> + <doc> + This is the start number of the first frame of a scan. In PX one often scans a couple + of frames on a give sample, then does something else, then returns to the same sample + and scans some more frames. Each time with a new data file. + This number helps concatenating such measurements. + </doc> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name" type="NX_CHAR"> + <doc>Descriptive name of sample</doc> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + The orientation matrix according to Busing and + Levy conventions. This is not strictly necessary as + the UB can always be derived from the data. But + let us bow to common usage which includes the + UB nearly always. + </doc> + <dimensions rank="2"> + <dim index="1" value="3" /> + <dim index="2" value="3" /> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT"> + <doc> + The unit cell, a, b, c, alpha, beta, gamma. + Again, not strictly necessary, but normally written. + </doc> + <dimensions rank="1"> + <dim index="1" value="6" /> + </dimensions> + </field> + <field name="temperature" type="NX_FLOAT"> + <doc> + The sample temperature or whatever sensor represents this value best + </doc> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + <field name="x_translation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the X-direction of the laboratory coordinate system</doc> + </field> + <field name="y_translation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the Y-direction of the laboratory coordinate system</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the Z-direction of the laboratory coordinate system</doc> + </field> + + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + </group> + <group type="NXdata"> + <doc> + The name of this group id data if there is only + one detector; if there are several the names will + be data1, data2, data3 and will point + to the corresponding detector groups in the + instrument hierarchy. + </doc> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxeuler.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxeuler.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1118522024d4b6e6fc6a7d1a2dcac18b5013f7bc --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxeuler.nxdl.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxeuler" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw data from a :index:`four-circle diffractometer` with an :index:`eulerian cradle`, extends :ref:`NXxbase` + + It extends :ref:`NXxbase`, so the full definition is the content + of :ref:`NXxbase` plus the data defined here. All four angles are + logged in order to support arbitrary scans in reciprocal space. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxeuler"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + The polar_angle (two theta) where the detector is placed + at each scan point. + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + This is an array holding the sample rotation angle at each + scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="chi" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + This is an array holding the chi angle of the eulerian + cradle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="phi" type="NX_FLOAT" units="NX_ANGLE" signal="1"> + <doc> + This is an array holding the phi rotation of the eulerian + cradle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + <link name="chi" target="/NXentry/NXsample/chi"></link> + <link name="phi" target="/NXentry/NXsample/phi"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxkappa.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxkappa.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..0bc36a8a0c259ebf76672ecf9929c5a8de9ab693 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxkappa.nxdl.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxkappa" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw data from a kappa geometry (CAD4) single crystal diffractometer, extends :ref:`NXxbase` + + This is the application definition for raw data from a kappa geometry + (CAD4) single crystal + diffractometer. It extends :ref:`NXxbase`, so the full definition is + the content of :ref:`NXxbase` plus the + data defined here. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxkappa"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The polar_angle (two theta) at each scan point</doc> + <dimensions rank="1"> + <dim index="1" value="np"/> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + This is an array holding the sample rotation angle at each + scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="kappa" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + This is an array holding the kappa angle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="phi" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + This is an array holding the phi angle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="alpha" type="NX_FLOAT" units="NX_ANGLE"> + <doc>This holds the inclination angle of the kappa arm. </doc> + </field> + </group> + <group type="NXdata" name="name"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + <link name="kappa" target="/NXentry/NXsample/kappa"></link> + <link name="phi" target="/NXentry/NXsample/phi"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxlaue.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxlaue.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..cde3a2268f3d1c0d55f5eb343f47bf320b4f6f47 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxlaue.nxdl.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxlaue" extends="NXxrot" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw data from a single crystal laue camera, extends :ref:`NXxrot` + + This is the application definition for raw data from a single crystal laue + camera. It extends :ref:`NXxrot`. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxlaue"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <group type="NXdata" name="distribution"> + <field name="data"> + <doc>expect ``signal=1 axes="energy"``</doc> + <dimensions rank="1"> + <dim index="1" value="ne" /> + </dimensions> + </field> + <field name="wavelength" units="NX_WAVELENGTH"> + <dimensions rank="1"> + <dim index="1" value="ne" /> + </dimensions> + </field> + <doc> + This is the wavelength distribution of the beam + </doc> + </group> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxlaueplate.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxlaueplate.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa8d8aba93b0e77c7f4ac97686aaf837d6a6e400 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxlaueplate.nxdl.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxlaueplate" extends="NXxlaue" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw data from a single crystal Laue camera, extends :ref:`NXxlaue` + + This is the application definition for raw data from a single crystal Laue + camera with an image plate as a detector. It extends :ref:`NXxlaue`. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxlaueplate"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name ="detector"> + <field name="diameter" units="NX_LENGTH" type="NX_FLOAT"> + <doc>The diameter of a cylindrical detector</doc> + </field> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxnb.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxnb.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a979dc487fa1a95229ee701d42c3f98eae64a078 --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxnb.nxdl.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxnb" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw data from a single crystal diffractometer, extends :ref:`NXxbase` + + This is the application definition for raw data from + a single crystal diffractometer + measuring in normal beam mode. It extends :ref:`NXxbase`, + so the full definition is the content of + :ref:`NXxbase` plus the data defined here. All angles are + logged in order to support arbitrary scans in + reciprocal space. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxnb"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + The polar_angle (gamma) of the detector for each scan point. + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="tilt_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + The angle by which the detector has been tilted out of the + scattering plane. + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1" primary="1"> + <doc> + This is an array holding the sample rotation angle at each + scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + <link name="tilt" target="/NXentry/NXinstrument/NXdetector/tilt"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/NXxrot.nxdl.xml b/src/punx/cache/a4fd52d/applications/NXxrot.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..6f88c764914a0f53296c469a5ae367a16f56a6ac --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/NXxrot.nxdl.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxrot" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw data from a rotation camera, extends :ref:`NXxbase` + + This is the application definition for raw data from a rotation camera. + It extends :ref:`NXxbase`, so the full definition is the content of :ref:`NXxbase` + plus the data defined here. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this file conforms.</doc> + <enumeration> + <item value="NXxrot"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The polar_angle (two theta) where the detector is placed.</doc> + </field> + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc></field> + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc></field> + </group> + <group type="NXattenuator" name="attenuator"> + <field name="attenuator_transmission" type="NX_FLOAT" + units="NX_ANY"> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc>This is an array holding the sample rotation start angle at each scan point</doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle_step" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc>This is an array holding the step made for sample rotation angle at each scan point</doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/applications/nxdlformat.xsl b/src/punx/cache/a4fd52d/applications/nxdlformat.xsl new file mode 100644 index 0000000000000000000000000000000000000000..6f174d8fb514efe8ac5ed543285be3a589b5e17a --- /dev/null +++ b/src/punx/cache/a4fd52d/applications/nxdlformat.xsl @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Stylesheet to provide a condensed view of a NeXus NXDL specification. + (see https://github.com/nexusformat/definitions/issues/181) + + The nxdlformat.xsl stylesheets differ between the directories + because of the rule regarding either /definition/NXentry or + /definition/NXsubentry for application and contributed definitions. + (see https://github.com/nexusformat/definitions/issues/179) + + Modify <xsl:template match="nx:definition">...</xsl:template> + for each directory. + +line breaks are VERY TRICKY here, be careful how you edit! +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" version="1.0"> + + <xsl:output method="text"/> + <xsl:variable name="indent_step" select="' '"/> + + + <xsl:template match="/"> + <xsl:apply-templates select="nx:definition"/> + </xsl:template> + + + <!-- + Modify ONLY this section for each directory: + base_classes/nxdlformat.xsl no rule for NXentry or NXsubentry + applications/nxdlformat.xsl required rule for NXentry or NXsubentry + contributed_definitions/nxdlformat.xsl optional rule for NXentry or NXsubentry + --> + <xsl:template match="nx:definition"> + <xsl:call-template name="showClassName"/> + <xsl:choose> + <xsl:when test="count(nx:group[@type='NXentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:when test="count(nx:group[@type='NXsubentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXsubentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:otherwise><!-- optional rule for NXentry or NXsubentry + --> (base class definition, NXentry or NXsubentry not found)<!-- + --><xsl:text><!-- tricky line break here --> +</xsl:text><xsl:call-template name="startFieldsGroups"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + <!-- +++ From this point on, the code is the same for, +++ --> + <!-- +++ base_classes applications/, and contributed/ +++ --> + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + + <xsl:template match="nx:field"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/>:<xsl:choose> + <xsl:when test="count(@type)"><xsl:value-of select="@type" + /><xsl:apply-templates select="nx:dimensions" + ><xsl:sort select="@name"/></xsl:apply-templates></xsl:when> + <xsl:otherwise>NX_CHAR</xsl:otherwise> + </xsl:choose> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template match="nx:dimensions"><!-- + -->[<xsl:apply-templates select="nx:dim"/>]<!-- + --></xsl:template> + + + <xsl:template match="nx:dim"> + <xsl:choose> + <xsl:when test="position()=1"><xsl:value-of select="@value"/></xsl:when> + <xsl:otherwise>,<xsl:value-of select="@value"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="nx:link"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/><xsl:text + > --> </xsl:text><xsl:value-of select="@target"/><xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:attribute"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/>@<xsl:value-of select="@name"/> + <xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:group"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:if test="count(@name)"><xsl:value-of select="@name"/>:</xsl:if> + <xsl:value-of select="@type"/> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template name="startFieldsGroups"> + <xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:choose> + <!-- Two ways to render. + 1=1: write fields, links, then groups, each sorted alphabetically + 1!=1: order of appearance in NXDL + --> + <xsl:when test="1=1"><!-- write fields, links, then groups --> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise><!-- write in order of appearance in NXDL --> + <xsl:apply-templates select="nx:field|nx:link|nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="showClassName"> + <xsl:value-of select="@name"/> (<xsl:choose> + <xsl:when test="@category='base'">base class</xsl:when> + <xsl:when test="@category='application'">application definition</xsl:when> + <xsl:when test="@category='contributed'">contributed definition</xsl:when> + </xsl:choose><xsl:if test="count(@version)">, version <xsl:value-of + select="@version"/></xsl:if>)<xsl:text><!-- tricky line break here --> +</xsl:text></xsl:template> + +</xsl:stylesheet> + +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> diff --git a/src/punx/cache/a4fd52d/base_classes/NXaperture.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXaperture.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1968799bd9ee629ceb9773bad944930769ff2171 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXaperture.nxdl.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXaperture" + version="1.0" + type="group" extends="NXobject"> + + <doc>A beamline aperture.</doc> + <!-- TODO compare with "screens" in SHADOW --> + + <group type="NXgeometry"> + <doc> + location and shape of aperture + + .. TODO: documentation needs improvement, contributions welcome + + * description of terms is poor and leaves much to interpretation + * Describe what is meant by translation _here_ and ... + * Similar throughout base classes + * Some base classes do this much better + * Such as where is the gap written? + </doc> + </group> + <group type="NXgeometry"> + <doc>location and shape of each blade</doc> + </group> + <field name="material"><!-- TODO Uniformity problem, "type" is used elsewhere for same context --> + <doc>Absorbing material of the aperture</doc> + </field> + <field name="description"> + <doc>Description of aperture</doc> + </field> + <group type="NXnote"><doc>describe an additional information in a note*</doc></group> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXattenuator.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXattenuator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..57c97fc9e5be893b3e96503066bbd23d46e8c54b --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXattenuator.nxdl.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXattenuator" + type="group" + extends="NXobject" + category="base" + version="1.0" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc> + A device that reduces the intensity of a beam by attenuation. + + If uncertain whether to use :ref:`NXfilter` (band-pass filter) + or :ref:`NXattenuator` (reduces beam intensity), then choose + :ref:`NXattenuator`. + </doc> + <!-- + TODO compare with SHADOW definition "screen" + TODO SHADOW: http://ftp.esrf.eu/pub/scisoft/shadow or (older) http://www.nanotech.wisc.edu/shadow + --> + + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance from sample</doc> + </field> + <field name="type"> + <doc>Type or composition of attenuator, e.g. polythene</doc> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of attenuator along beam direction</doc> + </field> + <field name="scattering_cross_section" type="NX_FLOAT" units="NX_CROSS_SECTION"> + <doc>Scattering cross section (coherent+incoherent)</doc> + </field> + <field name="absorption_cross_section" type="NX_FLOAT" units="NX_CROSS_SECTION"> + <doc>Absorption cross section</doc> + </field> + <field name="attenuator_transmission" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc> + The nominal amount of the beam that gets through + (transmitted intensity)/(incident intensity) + </doc> + </field> + <field name="status"> + <doc>In or out or moving of the beam</doc> + <attribute name="time" type="NX_DATE_TIME"> + <doc>time stamp for this observation</doc> + </attribute> + <enumeration> + <item value="in" /> + <item value="out" /> + <item value="moving" /> + </enumeration> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXbeam.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXbeam.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b65fed55d797f05b07cabcfe1a65f0f882b8a516 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXbeam.nxdl.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXbeam" + version="1.0" + type="group" extends="NXobject"> + + <doc> + Properties of the neutron or X-ray beam at a given location. + + It will be referenced + by beamline component groups within the :ref:`NXinstrument` group or by the :ref:`NXsample` group. Note + that variables such as the incident energy could be scalar values or arrays. This group is + especially valuable in storing the results of instrument simulations in which it is useful + to specify the beam profile, time distribution etc. at each beamline component. Otherwise, + its most likely use is in the :ref:`NXsample` group in which it defines the results of the neutron + scattering by the sample, e.g., energy transfer, polarizations. </doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance from sample</doc> + </field> + <field name="incident_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Energy on entering beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="final_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Energy on leaving beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="energy_transfer" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Energy change caused by beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength on entering beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength spread FWHM on entering component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_beam_divergence" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Divergence of beam entering this component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="final_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength on leaving beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_polarization" type="NX_FLOAT" units="NX_ANY"> + <doc>Polarization vector on entering beamline component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="final_polarization" type="NX_FLOAT" units="NX_ANY"> + <doc>Polarization vector on leaving beamline component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="final_wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength spread FWHM of beam leaving this component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="final_beam_divergence" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Divergence FWHM of beam leaving this component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="flux" type="NX_FLOAT" units="NX_FLUX"> + <doc>flux incident on beam plane area</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <group type="NXdata"> + <doc> + Distribution of beam with respect to relevant variable e.g. wavelength. This is mainly + useful for simulations which need to store plottable information at each beamline + component.</doc> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXbeam_stop.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXbeam_stop.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ecc7b65d78390e60962f284b256f805e6e8e712 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXbeam_stop.nxdl.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXbeam_stop" + version="1.0" + type="group" extends="NXobject"> + + <doc> + A device that blocks the beam completely, usually to protect a detector. + + Beamstops and their positions are important for SANS + and SAXS experiments. + </doc> + <group type="NXgeometry"> + <doc>engineering shape, orientation and position of the beam stop.</doc> + </group> + <field name="description"> + <doc>description of beamstop</doc> + <enumeration> + <item value="circular"/> + <item value="rectangular"/> + </enumeration> + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>size of beamstop</doc> + </field> + <field name="x" type="NX_FLOAT" units="NX_LENGTH"> + <doc>x position of the beamstop in relation to the detector</doc> + </field> + <field name="y" type="NX_FLOAT" units="NX_LENGTH"> + <doc>y position of the beamstop in relation to the detector</doc> + </field> + <field name="distance_to_detector" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance of the beamstop to the detector</doc> + </field> + <field name="status"> + <enumeration> + <item value="in"/> + <item value="out"/> + </enumeration> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXbending_magnet.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXbending_magnet.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..673e681c48d37f642b916e9a13c1336f905398af --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXbending_magnet.nxdl.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXbending_magnet" + version="1.0" + type="group" extends="NXobject"> + + <doc>A bending magnet</doc> + <field name="critical_energy" type="NX_FLOAT" units="NX_ENERGY"/> + <field name="bending_radius" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="magnetic_field" type="NX_FLOAT" units="NX_CURRENT"> + <doc>strength of magnetic field of dipole magnets</doc> + </field> + <field name="accepted_photon_beam_divergence" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + An array of four numbers giving X+, X-, Y+ and Y- half divergence + </doc> + </field> + <field name="source_distance_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Distance of source point from particle beam waist in X (horizontal) direction. + </doc> + </field> + <field name="source_distance_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Distance of source point from particle beam waist in Y (vertical) direction. + </doc> + </field> + <field name="divergence_x_plus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in X+ (horizontal outboard) direction. + Note that divergence_x_plus+divergence_x_minus is the total horizontal beam divergence. + </doc> + </field> + <field name="divergence_x_minus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in X- (horizontal inboard) direction. + Note that divergence_x_plus+divergence_x_minus is the total horizontal beam divergence. + </doc> + </field> + <field name="divergence_y_plus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in Y+ (vertical upward) direction. + Note that divergence_y_plus+divergence_y_minus is the total vertical beam divergence. + </doc> + </field> + <field name="divergence_y_minus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in Y- (vertical downward) direction. + Note that divergence_y_plus+divergence_y_minus is the total vertical beam divergence. + </doc> + </field> + <group name="spectrum" type="NXdata"><doc>bending magnet spectrum</doc></group> + <group type="NXgeometry"><doc>"Engineering" position of bending magnet</doc></group> + +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXcapillary.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXcapillary.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe96aa6d93e6a7f0157ffe3a7680951639596827 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXcapillary.nxdl.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcapillary" + version="1.0" + type="group" extends="NXobject"> + + <doc> + A capillary lens to focus the X-ray beam. + + Based on information provided by Gerd Wellenreuther (DESY). + </doc> + <field name="type" type="NX_CHAR"> + <doc>Type of the capillary</doc> + <enumeration> + <item value="single_bounce"/> + <item value="polycapillary"/> + <item value="conical_capillary"/> + </enumeration> + </field> + <field name="manufacturer" type="NX_CHAR"> + <doc> + The manufacturer of the capillary. This is actually important as + it may have an impact on performance. + </doc> + </field> + <field name="maximum_incident_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="accepting_aperture" type="NX_FLOAT" units="NX_ANGLE"></field> + <group type="NXdata" name="gain"> + <doc> + The gain of the capillary as a function of energy + </doc> + </group> + <group type="NXdata" name="transmission"> + <doc> + The transmission of the capillary as a function of energy + </doc> + </group> + <field name="working_distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="focal_size" type="NX_FLOAT" > + <doc> + The focal size in FWHM + </doc> + </field> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXcharacterization.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXcharacterization.nxdl.xml similarity index 97% rename from src/punx/cache/v3.2/base_classes/NXcharacterization.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXcharacterization.nxdl.xml index 76c58ca10803accbb8445b9020ee9c598141f162..08007e9dff08fad469472a02677e704fb13507df 100644 --- a/src/punx/cache/v3.2/base_classes/NXcharacterization.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXcharacterization.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/a4fd52d/base_classes/NXcite.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXcite.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b84a5a6a1dbabd94e638dec93c8f2ffca8e3c6d2 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXcite.nxdl.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXcite" category="base" + extends="NXobject" xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0"> + <doc> + A literature reference + + Definition to include references for example for detectors, + manuals, instruments, acquisition or analysis software used. + + The idea would be to include this in the relevant NeXus object: + :ref:`NXdetector` for detectors, :ref:`NXinstrument` for instruments, etc. + </doc> + <field name="description" type="NX_CHAR"> + <doc> + This should describe the reason for including this reference. + For example: The dataset in this group was normalised using the method + which is described in detail in this reference. + </doc> + </field> + <field name="url" type="NX_CHAR"> + <doc>URL referencing the document or data.</doc> + </field> + <field name="doi" type="NX_CHAR"> + <doc>DOI referencing the document or data.</doc> + </field> + <field name="endnote" type="NX_CHAR"> + <doc>Bibliographic reference data in EndNote format.</doc> + </field> + <field name="bibtex" type="NX_CHAR"> + <doc>Bibliographic reference data in BibTeX format.</doc> + </field> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXcollection.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXcollection.nxdl.xml similarity index 97% rename from src/punx/cache/v3.2/base_classes/NXcollection.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXcollection.nxdl.xml index 339f2cb7f6218f1d6f64aa82dbd6ba8d8b513da0..542db19dc0b22e0423de77f472bb437563dcb6ea 100644 --- a/src/punx/cache/v3.2/base_classes/NXcollection.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXcollection.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/a4fd52d/base_classes/NXcollimator.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXcollimator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..96ad051af9bf5a5f14a6dcfdb0f8069867417174 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXcollimator.nxdl.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcollimator" + version="1.0" + type="group" extends="NXobject"> + + <doc>A beamline collimator.</doc> + <group type="NXgeometry"> + <doc>position, shape and size</doc> + </group> + <field name="type"> + <enumeration> + <item value="Soller"/> + <item value="radial"/> + <item value="oscillating"/> + <item value="honeycomb"></item> + </enumeration> + </field> + <field name="soller_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Angular divergence of Soller collimator</doc> + </field> + <field name="divergence_x" type="NX_FLOAT" units="NX_ANGLE"> + <doc>divergence of collimator in local x direction</doc> + </field> + <field name="divergence_y" type="NX_FLOAT" units="NX_ANGLE"> + <doc>divergence of collimator in local y direction</doc> + </field> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>Frequency of oscillating collimator</doc> + </field> + <group type="NXlog" name="frequency_log"> + <doc>Log of frequency</doc> + </group> + <field name="blade_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>blade thickness</doc> + </field> + <field name="blade_spacing" type="NX_FLOAT" units="NX_LENGTH"> + <doc>blade spacing</doc> + </field> + <field name="absorbing_material"> + <doc>name of absorbing material</doc> + </field> + <field name="transmitting_material"> + <doc>name of transmitting material</doc> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXcrystal.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXcrystal.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..afc8dc76320f4fc172d335ea324d883f72d0dfe9 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXcrystal.nxdl.xml @@ -0,0 +1,296 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcrystal" + version="1.0" + type="group" extends="NXobject" + > + + <symbols> + <doc>These symbols will be used below to coordinate dimensions with the same lengths.</doc> + <symbol name="n_comp"><doc>number of different unit cells to be described</doc></symbol> + <symbol name="i"><doc>number of wavelengths</doc></symbol> + </symbols> + + <doc> + A crystal monochromator or analyzer. + + Permits double bent + monochromator comprised of multiple segments with anisotropic + Gaussian mosaic. + + If curvatures are set to zero or are absent, array + is considered to be flat. + + Scattering vector is perpendicular to surface. Crystal is oriented + parallel to beam incident on crystal before rotation, and lies in + vertical plane. + </doc> + + <group type="NXgeometry"> + <doc>Position of crystal</doc> + </group> + <field name="usage" type="NX_CHAR"> + <doc>How this crystal is used. Choices are in the list.</doc> + <enumeration> + <item value="Bragg"><doc>reflection geometry</doc></item> + <item value="Laue"> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + C, then H, then the other elements in alphabetical order of their symbol. + If carbon is not present, the elements are listed purely in alphabetic + order of their symbol. + This is the *Hill* system used by Chemical Abstracts. + See, for example: + http://www.iucr.org/__data/iucr/cif/standard/cifstd15.html, + http://www.cas.org/training/stneasytips/subinforformula1.html, + or + http://www.indiana.edu/~cheminfo/courses/471cnfs.html. + </doc> + </item> + </enumeration> + </field> + <field name="type"> + <doc> + Type or material of monochromating substance. + Chemical formula can be specified separately. + Use the "reflection" field to indicate the (hkl) orientation. + Use the "d_spacing" field to record the lattice plane spacing. + + This field was changed (2010-11-17) from an enumeration to + a string since common usage showed a wider variety of use + than a simple list. These are the items in the list at + the time of the change: PG (Highly Oriented Pyrolytic Graphite) | + Ge | Si | Cu | Fe3Si | CoFe | Cu2MnAl (Heusler) | Multilayer | + Diamond. + </doc> + </field> + <field name="chemical_formula"> + <!-- copied from NXsample --> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + C, then H, then the other elements in alphabetical order of their symbol. + If carbon is not present, the elements are listed purely in alphabetic + order of their symbol. + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="order_no" type="NX_INT"> + <doc> + A number which describes if this is the first, second,.. + :math:`n^{th}` crystal in a multi crystal monochromator + </doc> + </field> + <field name="cut_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Cut angle of reflecting Bragg plane and plane of crystal surface</doc> + </field> + <field name="space_group"> + <doc>Space group of crystal structure</doc> + </field> + <field name="unit_cell" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell parameters (lengths and angles)</doc> + <dimensions rank="2"> + <dim index="1" value="n_comp"/> + <dim index="2" value="6"/> + </dimensions> + </field> + <!-- NXfilter defines each unit cell parameter separately. Let's be consistent. --> + <field name="unit_cell_a" type="NX_FLOAT" units="NX_LENGTH"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: length of side a</doc> + </field> + <field name="unit_cell_b" type="NX_FLOAT" units="NX_LENGTH"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: length of side b</doc> + </field> + <field name="unit_cell_c" type="NX_FLOAT" units="NX_LENGTH"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: length of side c</doc> + </field> + <field name="unit_cell_alpha" type="NX_FLOAT" units="NX_ANGLE"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: angle alpha</doc> + </field> + <field name="unit_cell_beta" type="NX_FLOAT" units="NX_ANGLE"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: angle beta</doc> + </field> + <field name="unit_cell_gamma" type="NX_FLOAT" units="NX_ANGLE"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: angle gamma</doc> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Volume of the unit cell</doc> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal sample using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="2"><!--3,3--> + <dim index="1" value="3"/> + <dim index="2" value="3"/> + </dimensions> + </field> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Optimum diffracted wavelength</doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="d_spacing" type="NX_FLOAT" units="NX_LENGTH"> + <doc>spacing between crystal planes of the reflection</doc> + </field> + <field name="scattering_vector" type="NX_FLOAT" units="NX_WAVENUMBER"> + <doc>Scattering vector, Q, of nominal reflection</doc> + </field> + <field name="reflection" type="NX_INT" units="NX_UNITLESS"> + <doc>Miller indices (hkl) values of nominal reflection</doc> + <dimensions><dim index="1" value="3"/></dimensions> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of the crystal. (Required for Laue orientations - see "usage" field)</doc> + </field> + <field name="density" type="NX_NUMBER" units="NX_MASS_DENSITY"> + <doc>mass density of the crystal</doc> + </field> + <field name="segment_width" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Horizontal width of individual segment</doc> + </field> + <field name="segment_height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Vertical height of individual segment</doc> + </field> + <field name="segment_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of individual segment</doc> + </field> + <field name="segment_gap" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Typical gap between adjacent segments</doc> + </field> + <field name="segment_columns" type="NX_FLOAT" units="NX_LENGTH"> + <doc>number of segment columns in horizontal direction</doc> + </field> + <field name="segment_rows" type="NX_FLOAT" units="NX_LENGTH"> + <doc>number of segment rows in vertical direction</doc> + </field> + <field name="mosaic_horizontal" type="NX_FLOAT" units="NX_ANGLE"> + <doc>horizontal mosaic Full Width Half Maximum</doc> + </field> + <field name="mosaic_vertical" type="NX_FLOAT" units="NX_ANGLE"> + <doc>vertical mosaic Full Width Half Maximum</doc> + </field> + <field name="curvature_horizontal" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Horizontal curvature of focusing crystal</doc> + </field> + <field name="curvature_vertical" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Vertical curvature of focusing crystal</doc> + </field> + <field name="is_cylindrical" type="NX_BOOLEAN"> + <doc>Is this crystal bent cylindrically?</doc> + </field> + <field name="cylindrical_orientation_angle" type="NX_NUMBER" units="NX_ANGLE"> + <doc>If cylindrical: cylinder orientation angle</doc> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Polar (scattering) angle at which crystal assembly is positioned. + Note: some instrument geometries call this term 2theta. + </doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Azimuthal angle at which crystal assembly is positioned</doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="bragg_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Bragg angle of nominal reflection</doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>average/nominal crystal temperature</doc> + </field> + <field name="temperature_coefficient" type="NX_FLOAT" units="NX_ANY"> + <doc>how lattice parameter changes with temperature</doc> + </field> + <group type="NXlog" name="temperature_log"> + <doc>log file of crystal temperature</doc> + </group> + <group type="NXdata" name="reflectivity"> + <doc>crystal reflectivity versus wavelength</doc> + </group> + <group type="NXdata" name="transmission"> + <doc>crystal transmission versus wavelength</doc> + </group> + <group type="NXshape" name="shape"> + <doc>A NXshape group describing the shape of the crystal arrangement</doc> + </group> + <!-- TODO need more parameters here, such as ... + list from Rainer Gehrke, DESY (some items may already be present) + +Parameters for crystals ++ Field indicating whether it is Bragg or Laue see usage ++ The crystal structure (enumeration, e.g. Zincblende ..) see space_group ++ Lattice constant see unit_cell ++ Miller indices of reflection (h,k,l) see reflection ++ First (or only) element see order_no ++ Second element (if any) see order_no ++ Temperature factor (optional) see temperature_coefficient ++ Asymmetric angle (if applicable) see cut_angle ++ Mosaic angular spread (if applicable) see mosaic_horizontal and mosaic_vertical ++ Thickness (mandatory for Laue, else optional) see thickness + + +Figure for crystals and mirrors (to describe curved surfaces) ++ Field indicating whether concave or convex see curvature_horizontal and curvature_vertical ++ Field indicating whether cylindrical or not see is_cylindrical ++ If cylindrical: cylinder orientation angle see cylindrical_orientation_angle + + +Now come the different surface figures with the necessary parameters: +1. Flat +2. Spherical (spherical radius) +3. Elliptical and hyperbolical (semi-major axis, semi-minor axis, angle of major axis and pole) +4. Toroidal (major radius, minor radius) +5. Parabolical (parabolic parameter a) +6. Conical (cone half aperture) +7. Polynomial (degree of polynom, array with polynom coefficients) + + --> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXdata.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXdata.nxdl.xml similarity index 98% rename from src/punx/cache/v3.2/base_classes/NXdata.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXdata.nxdl.xml index c654e8772512bfaf61226eaed9ff7e90dbf65343..11bd4261e6b86017da3d8f6ab25b6f8877d2a530 100644 --- a/src/punx/cache/v3.2/base_classes/NXdata.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXdata.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -147,7 +147,7 @@ </attribute> <doc> - :ref:`NXdata` describes the plottable data and related dimension scales. + (**required**) :ref:`NXdata` describes the plottable data and related dimension scales. .. index:: plotting @@ -337,11 +337,9 @@ Examples:: - @uncertainties="data_errors" - - @uncertainties="Idev" + @I_uncertainties="Idev" - @uncertainties="dQw", "dQl" + @Q_uncertainties="dQw", "dQl" </doc> </attribute> diff --git a/src/punx/cache/v3.2/base_classes/NXdetector.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXdetector.nxdl.xml similarity index 99% rename from src/punx/cache/v3.2/base_classes/NXdetector.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXdetector.nxdl.xml index f94dd893539efd8c817db59a1919000ae338da81..ff2799bd2aa69873d18f43d16657e00bb5aa0d94 100644 --- a/src/punx/cache/v3.2/base_classes/NXdetector.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXdetector.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/a4fd52d/base_classes/NXdetector_group.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXdetector_group.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..879a8559a7dfcddcf5f7e4873e20c21d909b33cf --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXdetector_group.nxdl.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXdetector_group" + version="1.0" + type="group" extends="NXobject"> + <doc> + Logical grouping of detector elements. + + This class is used to allow a logical + grouping of detector elements (e.g. which tube, bank or group of banks) to be + recorded in the file. As well as allowing you to e.g just select the "left" or + "east" detectors, it may also be useful for determining which elements belong to the + same PSD tube and hence have e.g. the same dead time. + + For example, if we had "bank1" composed + of "tube1", "tube2" and "tube3" then group_names would be the string "bank1, + bank1/tube1, bank1/tube2,bank1/tube3" group_index would be {1,2,3,4} group_parent + would be {-1,1,1,1} + + The mapping array is interpreted as + group 1 is a top level group containing groups 2, 3 and 4 + + A ``group_index`` array in + ``NXdetector`` gives the base group for a detector element. + </doc> + <field name="group_names"> + <doc>Comma separated list of name</doc> + </field> + <field name="group_index" type="NX_INT"> + <doc> + Unique ID for group. A group_index array + in ``NXdetector`` gives the base group for a detector element. + </doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="group_parent" type="NX_INT"> + <doc>Index of group parent in the hierarchy: -1 means no parent (i.e. a top level) group</doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> + <field name="group_type" type="NX_INT"> + <doc>Code number for group type, e.g. bank=1, tube=2 etc.</doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXdetector_module.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXdetector_module.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..509d40e9c837448f36833f08fdfce565c6a68253 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXdetector_module.nxdl.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2013-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXdetector_module" + version="1.0" + type="group" extends="NXobject"> + <doc> + Geometry and logical description of a detector module. + + Many detectors consist of multiple + smaller modules. Sometimes it is important to know the exact position of such + modules. + This is the purpose of this group. It is a child group to NXdetector. + </doc> + <field name="data_origin" type="NX_INT"> + <doc> + A two value field which gives the index of the start of the + modules data in the + main area detector image in the underlying NXdetector module. + </doc> + </field> + <field name="data_size" type="NX_INT"> + <doc> + Two values for the size of the module in pixels in each direction. + </doc> + </field> + + <field name="module_offset" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Offset of the module in regards to the origin of the detector in an + arbitrary direction. + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation + </doc> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the next element in the geometry chain. + </doc> + </attribute> + </field> + <field name="fast_pixel_direction" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Values along the direction of fastest varying pixel direction.The direction + itself is given through the vector attribute + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation + </doc> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the next element in the geometry chain. + </doc> + </attribute> + </field> + <field name="slow_pixel_direction" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Values along the direction of slow varying pixel direction. The direction + itself is given through the vector attribute + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation + </doc> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the next element in the geometry chain. + </doc> + </attribute> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXdisk_chopper.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXdisk_chopper.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..2f210f2a7f0bb1656f6218ae14b406943dbe25c5 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXdisk_chopper.nxdl.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXdisk_chopper" + version="1.0" + type="group" extends="NXobject"> + + <doc> + A device blocking the beam in a temporal periodic pattern. + + TODO: need documentation + </doc> + + <field name="type"> + <doc>Type of the disk-chopper: only one from the enumerated list (match text exactly)</doc> + <enumeration> + <item value="Chopper type single" /> + <item value="contra_rotating_pair" /> + <item value="synchro_pair" /> + </enumeration> + </field> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="slits" type="NX_INT"> + <doc>Number of slits</doc> + </field> + <field name="slit_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>angular opening</doc> + </field> + <field name="pair_separation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>disc spacing in direction of beam</doc> + </field> + <field name="radius" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius to centre of slit</doc> + </field> + <field name="slit_height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>total slit height</doc> + </field> + <field name="phase" type="NX_FLOAT" units="NX_ANGLE"> + <doc>chopper phase angle</doc> + </field> + <field name="ratio" type="NX_INT"> + <doc> + pulse reduction factor of this chopper in relation to other + choppers/fastest pulse in the instrument + </doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Effective distance to the origin</doc> + </field> + <field name="wavelength_range" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>low and high values of wavelength range transmitted</doc> + <dimensions><dim index="1" value="2"/></dimensions> + </field> + <group type="NXgeometry" /> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXentry.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXentry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f798af75dc455d95efd2cd2bf58768c890e376cb --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXentry.nxdl.xml @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXentry" + version="1.0" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` (or :ref:`NXsubentry`) group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + + It is recommended (as of NIAC2014) to use this attribute + to help define the path to the default dataset to be plotted. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> + + <doc> + (**required**) :ref:`NXentry` describes the measurement. + + The top-level NeXus group which contains all the data and associated + information that comprise a single measurement. It is mandatory that there is at least one + group of this type in the NeXus file. + </doc> + + <group type="NXdata" minOccurs="1"> + <doc>The required data group</doc> + </group> + + <attribute name="IDF_Version"> + <!-- as ratified at NIAC2010 --> + <doc>ISIS Muon IDF_Version</doc> + </attribute> + <field name="title"> + <doc>Extended title for entry</doc> + </field> + <field name="experiment_identifier"> + <doc> + Unique identifier for the experiment, + defined by the facility, + possibly linked to the proposals + </doc> + </field> + <field name="experiment_description"> + <doc>Brief summary of the experiment, including key objectives.</doc> + </field> + <group type="NXnote" name="experiment_documentation"> + <doc>Description of the full experiment (document in pdf, latex, ...)</doc> + </group> + <field name="collection_identifier"> + <doc>User or Data Acquisition defined group of NeXus files or NXentry</doc> + </field> + <field name="collection_description"> + <doc>Brief summary of the collection, including grouping criteria.</doc> + </field> + <field name="entry_identifier"> + <doc>unique identifier for the measurement, defined by the facility.</doc> + </field> + <field name="features"> + <doc> + Reserved for furture use by NIAC. + + See https://github.com/nexusformat/definitions/issues/382 + </doc> + </field> + <field name="definition"> + <doc> + (alternate use: see same field in :ref:`NXsubentry` for preferred) + + Official NeXus NXDL schema to which this entry conforms. + + This field is provided so that :ref:`NXentry` can be the overlay position + in a NeXus data file for an application definition and its + set of groups, fields, and attributes. + + *It is advised* to use :ref:`NXsubentry`, instead, as the overlay position. + </doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="definition_local" deprecated="see same field in :ref:`NXsubentry` for preferred use"> + <doc> + Local NXDL schema extended from the entry + specified in the ``definition`` field. + This contains any locally-defined, + additional fields in the entry. + </doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="start_time" type="NX_DATE_TIME"> + <doc>Starting time of measurement</doc> + </field> + <field name="end_time" type="NX_DATE_TIME"> + <doc>Ending time of measurement</doc> + </field> + <field name="duration" type="NX_INT" units="NX_TIME"> + <doc>Duration of measurement</doc> + </field> + <field name="collection_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time transpired actually collecting data i.e. taking out time when collection was + suspended due to e.g. temperature out of range + </doc> + </field> + <field name="run_cycle"> + <doc>Such as "2007-3". Some user facilities organize their beam time into run cycles.</doc> + </field> + <field name="program_name"> + <doc>Name of program used to generate this file</doc> + <attribute name="version"><doc>Program version number</doc></attribute> + <attribute name="configuration"><doc>configuration of the program</doc></attribute> + </field> + <field name="revision"> + <doc> + Revision id of the file due to re-calibration, reprocessing, new analysis, new + instrument definition format, ... + </doc> + <attribute name="comment"/> + </field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flightpath before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group name="notes" type="NXnote"> + <doc>Notes describing entry</doc> + </group> + <group name="thumbnail" type="NXnote"> + <doc> + A small image that is representative of the entry. An example of this is a 640x480 + jpeg image automatically produced by a low resolution plot of the NXdata. + </doc> + <attribute name="type"> + <doc>The mime type should be an ``image/*``</doc> + <enumeration> + <!-- + This is not perfect. + How do we set a default value for the type attribute? + --> + <item value="image/*" /> + </enumeration> + </attribute> + </group> + <group type="NXcharacterization" /><!-- TODO: consider using NXcollection instead, see https://github.com/nexusformat/definitions/issues/177--> + <group type="NXuser" /> + <group type="NXsample" /> + <group type="NXinstrument" /> + <group type="NXcollection" /> + <group type="NXmonitor" /> + <group type="NXparameters" /> + <group type="NXprocess" /> + <group type="NXsubentry" /> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXenvironment.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXenvironment.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca1e7b16edd01f3f122a3e7ec6dcd3b49c0c3d02 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXenvironment.nxdl.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXenvironment" + version="1.0" + type="group" extends="NXobject"> + <doc>Parameters for controlling external conditions</doc> + <field name="name"> + <doc>Apparatus identification code/model number; e.g. OC100 011</doc> + </field> + <field name="short_name"> + <doc>Alternative short name, perhaps for dashboard display like a present Seblock name</doc> + </field> + <field name="type"> + <doc>Type of apparatus. This could be the SE codes in scheduling database; e.g. OC/100</doc> + </field> + <field name="description"> + <doc>Description of the apparatus; e.g. 100mm bore orange cryostat with Roots pump</doc> + </field> + <field name="program"> + <doc>Program controlling the apparatus; e.g. LabView VI name</doc> + </field> + <group name="position" type="NXgeometry"> + <doc>The position and orientation of the apparatus</doc> + </group> + <group type="NXnote"> + <doc>Additional information, LabView logs, digital photographs, etc</doc> + </group> + <group type="NXsensor"/> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXevent_data.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXevent_data.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..255fb99c8c5a681a30767064a4be7a716fe66bcf --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXevent_data.nxdl.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXevent_data" + version="1.0" + type="group" extends="NXobject"> + <doc>Time-of-flight events</doc> + <field name="time_of_flight" type="NX_INT" units="NX_TIME_OF_FLIGHT"> + <doc> + A list of time of flight for each event as it comes in. + This list is for all pulses with information to attach + to a particular pulse located in events_per_pulse. + </doc> + <dimensions rank="1"><dim index="1" value="i"/></dimensions> + </field> + <field name="pixel_number" type="NX_INT" units="NX_DIMENSIONLESS"> + <doc> + There will be extra information in the NXdetector to convert + pixel_number to detector_number. This list is for all pulses with + information to attach to a particular pulse located in events_per_pulse. + </doc> + <dimensions rank="1"><dim index="1" value="i"/></dimensions> + </field> + <field name="pulse_time" type="NX_INT" units="NX_TIME"> + <doc> + The time that each pulse started with respect to the offset + </doc> + <dimensions rank="1"><dim index="1" value="j"/></dimensions> + <attribute name="offset" type="NX_DATE_TIME"> + <doc>ISO8601</doc> + </attribute> + </field> + <field name="events_per_pulse" type="NX_INT" units="NX_DIMENSIONLESS"> + <doc> + This connects the index "i" to the index "j". + The jth element is the number of events in "i" + that occurred during the jth pulse. + </doc> + <dimensions rank="1"><dim index="1" value="j"/></dimensions> + </field> + <field name="pulse_height" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc> + If voltages from the ends of the detector are read out this + is where they go. This list is for all events with information + to attach to a particular pulse height. The information to + attach to a particular pulse is located in events_per_pulse. + </doc> + <dimensions rank="2"><!--i,k?--> + <dim index="1" value="i"/> + <dim index="2" value="k"/> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXfermi_chopper.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXfermi_chopper.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4e5ae4c1bfd0e2c803ad8e453d932f339ad654ea --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXfermi_chopper.nxdl.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXfermi_chopper" + version="1.0" + type="group" extends="NXobject"> + <doc>A Fermi chopper, possibly with curved slits.</doc> + <field name="type"> + <doc>Fermi chopper type</doc> + </field> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="radius" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius of chopper</doc> + </field> + <field name="slit" type="NX_FLOAT" units="NX_LENGTH"> + <doc>width of an individual slit</doc> + </field> + <field name="r_slit" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius of curvature of slits</doc> + </field> + <field name="number" type="NX_INT" units="NX_UNITLESS"> + <doc>number of slits</doc> + </field> + <field name="height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam height</doc> + </field> + <field name="width" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam width</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance</doc> + </field> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <!-- should have units of angstroms or nm or pm --> + <doc>Wavelength transmitted by chopper</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + <group type="NXgeometry"> + <doc>geometry of the fermi chopper</doc> + </group> + <field name="absorbing_material"> + <doc>absorbing material</doc> + </field> + <field name="transmitting_material"> + <doc>transmitting material</doc> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXfilter.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXfilter.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..65effd3a9135ade6b4af1b902fb6451421c01e11 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXfilter.nxdl.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXfilter" + type="group" + extends="NXobject" + category="base" + version="1.0" xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + For band pass beam filters. + + If uncertain whether to use :ref:`NXfilter` (band-pass filter) + or :ref:`NXattenuator` (reduces beam intensity), then use + :ref:`NXattenuator`. + </doc> + <group type="NXgeometry"> + <doc>Geometry of the filter</doc> + </group> + <field name="description"> + <doc> + Composition of the filter. Chemical formula can be specified separately. + + This field was changed (2010-11-17) from an enumeration to + a string since common usage showed a wider variety of use + than a simple list. These are the items in the list at + the time of the change: Beryllium | Pyrolytic Graphite | + Graphite | Sapphire | Silicon | Supermirror. + </doc> + </field> + <field name="status"> + <doc>position with respect to in or out of the beam (choice of only "in" or "out")</doc> + <enumeration> + <item value="in"><doc>in the beam</doc></item> + <item value="out"><doc>out of the beam</doc></item> + </enumeration> + </field> + <group name="transmission" type="NXdata"> + <doc>Wavelength transmission profile of filter</doc> + </group> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>average/nominal filter temperature</doc> + </field> + <group name="temperature_log" type="NXlog"> + <doc>Linked temperature_log for the filter</doc> + </group> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of the filter</doc> + </field> + <field name="density" type="NX_NUMBER" units="NX_MASS_DENSITY"> + <doc>mass density of the filter</doc> + </field> + <field name="chemical_formula"> + <!-- copied from NXsample --> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + + * C, then H, then the other elements in alphabetical order of their symbol. + * If carbon is not present, the elements are listed purely in alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <group name="sensor_type" type="NXsensor"> + <doc>Sensor(s)used to monitor the filter temperature</doc> + </group> + <field name="unit_cell_a" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell lattice parameter: length of side a</doc> + </field> + <field name="unit_cell_b" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell lattice parameter: length of side b</doc> + </field> + <field name="unit_cell_c" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell lattice parameter: length of side c</doc> + </field> + <field name="unit_cell_alpha" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Unit cell lattice parameter: angle alpha</doc> + </field> + <field name="unit_cell_beta" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Unit cell lattice parameter: angle beta</doc> + </field> + <field name="unit_cell_gamma" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Unit cell lattice parameter: angle gamma</doc> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Unit cell</doc> + <dimensions rank="1"><dim index="1" value="n_comp"/></dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal filter using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="3"><!--n_comp,3,3--> + <dim index="1" value="n_comp"/><!-- TODO n_comp is number of different compositions? --> + <dim index="2" value="3"/> + <dim index="3" value="3"/> + </dimensions> + </field> + <field name="m_value" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>m value of supermirror filter</doc> + </field> + <field name="substrate_material"> + <doc>substrate material of supermirror filter</doc> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>substrate thickness of supermirror filter</doc> + </field> + <field name="coating_material"> + <doc>coating material of supermirror filter</doc> + </field> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>substrate roughness (RMS) of supermirror filter</doc> + </field> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>coating roughness (RMS) of supermirror filter</doc> + <dimensions rank="1"><dim index="1" incr="1" value="nsurf"/></dimensions> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXflipper.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXflipper.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b6b6989651cfafc5a1fec09f1bfd49d1139a2fcd --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXflipper.nxdl.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXflipper" + version="1.0" + type="group" extends="NXobject"> + <doc>A spin flipper.</doc> + <field name="type"> + <enumeration> + <item value="coil"/> + <item value="current-sheet"></item> + </enumeration> + </field> + <field name="flip_turns" type="NX_FLOAT" units="NX_PER_LENGTH"> + <doc>Linear density of turns (such as number of turns/cm) in flipping field coils</doc> + </field> + <field name="comp_turns" type="NX_FLOAT" units="NX_PER_LENGTH"> + <doc>Linear density of turns (such as number of turns/cm) in compensating field coils</doc> + </field> + <field name="guide_turns" type="NX_FLOAT" units="NX_PER_LENGTH"> + <doc>Linear density of turns (such as number of turns/cm) in guide field coils</doc> + </field> + <field name="flip_current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Flipping field coil current in "on" state"</doc> + </field> + <field name="comp_current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Compensating field coil current in "on" state"</doc> + </field> + <field name="guide_current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Guide field coil current in "on" state"</doc> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>thickness along path of neutron travel</doc> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXfresnel_zone_plate.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXfresnel_zone_plate.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f2286d995bb02f4d9809265242950050ec7ac429 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXfresnel_zone_plate.nxdl.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXfresnel_zone_plate" type="group" extends="NXobject" + category="base" + version="1.0" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" +> + + <doc>A fresnel zone plate</doc> + <field name="focus_parameters" type="NX_FLOAT"> + <doc> + list of polynomial coefficients describing the focal length of the zone plate, in increasing powers of photon energy, + that describes the focal length of the zone plate (in microns) at an X-ray photon energy (in electron volts). + </doc> + <dimensions rank="1"/> + </field> + <field name="outer_diameter" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="outermost_zone_width" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="central_stop_diameter" type="NX_FLOAT" units="NX_LENGTH"/> + + <field name="fabrication"> + <doc>how the zone plate was manufactured</doc> + <enumeration> + <item value="etched" /> + <item value="plated" /> + <item value="zone doubled" /> + <item value="other" /> + </enumeration> + </field> + <field name="zone_height" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="zone_material"> + <doc>Material of the zones themselves</doc> + </field> + <field name="zone_support_material"> + <doc>Material present between the zones. This is usually only present for the "zone doubled" fabrication process</doc> + </field> + <field name="central_stop_material"/> + <field name="central_stop_thickness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mask_thickness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mask_material"> + <doc>If no mask is present, set mask_thickness to 0 and omit the mask_material field</doc> + </field> + <field name="support_membrane_material"/> + <field name="support_membrane_thickness" type="NX_FLOAT" units="NX_LENGTH"/> + + <group type="NXtransformations"><doc>"Engineering" position of the fresnel zone plate</doc></group> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXgeometry.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXgeometry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..79dcc41ecb9222c71609494fdce959921f6ca282 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXgeometry.nxdl.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXgeometry" + version="1.0" + type="group" extends="NXobject" + deprecated="as decided at 2014 NIAC meeting, convert to use :ref:`NXtransformations`" + > + <doc> + legacy class - recommend to use :ref:`NXtransformations` now + + It is recommended that instances of :ref:`NXgeometry` be converted to + use :ref:`NXtransformations`. + + This is the description for a general position of a component. + It is recommended to name an instance of :ref:`NXgeometry` as "geometry" + to aid in the use of the definition in simulation codes such as McStas. + Also, in HDF, linked items must share the same name. + However, it might not be possible or practical in all situations. + </doc> + <group type="NXshape"> + <doc>shape/size information of component</doc> + </group> + <group type="NXtranslation"> + <doc>translation of component</doc> + </group> + <group type="NXorientation"> + <doc>orientation of component</doc> + </group> + <field name="description"> + <doc> + Optional description/label. Probably only present if we are + an additional reference point for components rather than the + location of a real component. + </doc> + </field> + <field name="component_index" type="NX_INT"> + <doc> + Position of the component along the beam path. The sample is at 0, components upstream + have negative component_index, components downstream have positive + component_index. + </doc> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXgrating.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXgrating.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d9d1b524ae04a545821d78a160aab2e8a4bae699 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXgrating.nxdl.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXgrating" type="group" extends="NXobject" + category="base" + version="1.0" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc>A diffraction grating, as could be used in a soft X-ray monochromator</doc> + <field name="angles" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Blaze or trapezoidal angles, with the angle of the upstream facing edge listed first. Blazed gratings can be identified by the low value of the first-listed angle.</doc> + <dimensions rank="1"> + <dim index="1" value="2" /> + </dimensions> + </field> + <field name="period" type="NX_FLOAT" units="NX_LENGTH"> + <doc>List of polynomial coefficients describing the spatial separation of lines/grooves as a function of position along the grating, in increasing powers of position. Gratings which do not have variable line spacing will only have a single coefficient (constant).</doc> + <dimensions rank="1"/> + </field> + <field name="duty_cycle" type="NX_FLOAT" units="NX_UNITLESS"/> + <field name="depth" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="diffraction_order" type="NX_INT" units="NX_UNITLESS"/> + <field name="deflection_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Angle between the incident beam and the utilised outgoing beam.</doc> + </field> + <field name="interior_atmosphere"> + <enumeration> + <item value="vacuum"/> + <item value="helium"/> + <item value="argon"/> + </enumeration> + </field> + <field name="substrate_material"> + <doc></doc> + </field> + <field name="substrate_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="coating_material"/> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="layer_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc> An array describing the thickness of each layer</doc> + </field> + <group type="NXshape" name="shape"> + <doc>A NXshape group describing the shape of the mirror</doc> + </group> + <group name="figure_data" type="NXdata"> + <doc>Numerical description of the surface figure of the mirror.</doc> + </group> + <group type="NXtransformations"><doc>"Engineering" position of the grating</doc></group> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXguide.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXguide.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1de6194f71cc6440dbfe51b976abf0cc7d9d2270 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXguide.nxdl.xml @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXguide" + version="1.0" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <symbol name="nsurf"><doc>number of reflecting surfaces</doc></symbol> + <symbol name="nwl"><doc>number of wavelengths</doc></symbol> + </symbols> + + <doc> + A neutron optical element to direct the path of the beam. + + :ref:`NXguide` is used by neutron instruments to describe + a guide consists of several mirrors building a shape through which + neutrons can be guided or directed. The simplest such form is box shaped + although elliptical guides are gaining in popularity. + The individual parts of a guide usually have common characteristics + but there are cases where they are different. + For example, a neutron guide might consist of 2 or 4 coated walls or + a supermirror bender with multiple, coated vanes. + + To describe polarizing supermirrors such as used in neutron reflection, + it may be necessary to revise this definition of :ref:`NXguide` + to include :ref:`NXpolarizer` and/or :ref:`NXmirror`. + + When even greater complexity exists in the definition of what + constitutes a *guide*, it has been suggested that :ref:`NXguide` + be redefined as a :ref:`NXcollection` of :ref:`NXmirror` each + having their own :ref:`NXgeometry` describing their location(s). + + For the more general case when describing mirrors, consider using + :ref:`NXmirror`. + + NOTE: The NeXus International Advisory Committee welcomes + comments for revision and improvement of + this definition of :ref:`NXguide`. + + </doc> + + <group type="NXgeometry"> + <doc>TODO: Explain what this NXgeometry group means. What is intended here?</doc> + </group> + <field name="description"> + <doc>A description of this particular instance of ``NXguide``.</doc> + </field> + <field name="incident_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>TODO: documentation needed</doc> + </field> + <group type="NXdata" name="reflectivity"> + <doc>Reflectivity as function of reflecting surface and wavelength</doc> + <attribute name="signal"> + <enumeration> + <item value="data" /> + </enumeration> + </attribute> + <attribute name="axes"> + <enumeration> + <item value="surface wavelength" /> + </enumeration> + </attribute> + <attribute name="surface_indices"> + <enumeration> + <item value="0" /> + </enumeration> + </attribute> + <attribute name="wavelength_indices"> + <enumeration> + <item value="1" /> + </enumeration> + </attribute> + <field name="data" type="NX_NUMBER"> + <doc>reflectivity of each surface as a function of wavelength</doc> + <dimensions rank="2"><!-- was [nsurf,i] --> + <dim index="1" value="nsurf"/> + <dim index="2" value="nwl"/> + </dimensions> + </field> + <field name="surface" type="NX_NUMBER" units="NX_ANY"> + <doc> + List of surfaces. Probably best to use index + numbers but the specification is very loose. + </doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="wavelength" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc>wavelengths at which reflectivity was measured</doc> + <dimensions rank="1"> + <dim index="1" value="nwl"/> + </dimensions> + </field> + </group> + <field name="bend_angle_x" type="NX_FLOAT" units="NX_ANGLE"> + <doc>TODO: documentation needed</doc> + </field> + <field name="bend_angle_y" type="NX_FLOAT" units="NX_ANGLE"> + <doc>TODO: documentation needed</doc> + </field> + <field name="interior_atmosphere"> + <doc><!-- TODO --></doc> + <enumeration> + <item value="vacuum"/> + <item value="helium"/> + <item value="argon"/> + </enumeration> + </field> + <field name="external_material"> + <doc>external material outside substrate</doc> + </field> + <field name="m_value" type="NX_FLOAT"> + <doc> + The ``m`` value for a supermirror, which defines the supermirror + regime in multiples of the critical angle of Nickel. + </doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="substrate_material" type="NX_FLOAT"> + <doc>TODO: documentation needed</doc><!-- Why is this field a "float"? --> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>TODO: documentation needed</doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="coating_material" type="NX_FLOAT"> + <doc>TODO: documentation needed</doc><!-- Why is this field a "float"? --> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>TODO: documentation needed</doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>TODO: documentation needed</doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="number_sections" type="NX_INT" units="NX_UNITLESS"> + <doc> + number of substrate sections (also called ``nsurf`` as an + index in the ``NXguide`` specification) + </doc> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXinsertion_device.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXinsertion_device.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a138d3e287d0547306cdb63a8323deec483d8ca5 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXinsertion_device.nxdl.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXinsertion_device" + version="1.0" + type="group" extends="NXobject"> + <doc>An insertion device, as used in a synchrotron light source.</doc> + <field name="type"> + <enumeration> + <item value="undulator"/> + <item value="wiggler"></item> + </enumeration> + </field> + <field name="gap" type="NX_FLOAT" units="NX_LENGTH"> + <doc>separation between opposing pairs of magnetic poles</doc> + </field> + <field name="taper" type="NX_FLOAT" units="NX_ANGLE"> + <doc>angular of gap difference between upstream and downstream ends of the insertion device</doc> + </field> + <field name="phase" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="poles" type="NX_INT" units="NX_UNITLESS"> + <doc>number of poles</doc> + </field> + <field name="magnetic_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + <field name="k" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>beam displacement parameter</doc> + </field> + <field name="length" type="NX_FLOAT" units="NX_LENGTH"> + <doc>length of insertion device</doc> + </field> + <field name="power" type="NX_FLOAT" units="NX_POWER"> + <doc>total power delivered by insertion device</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy of peak intensity in output spectrum</doc> + </field> + <field name="bandwidth" type="NX_FLOAT" units="NX_ENERGY"> + <doc>bandwidth of peak energy</doc><!-- What are the best units here? --> + </field> + <field name="harmonic" type="NX_INT" units="NX_UNITLESS"> + <doc>harmonic number of peak</doc> + </field> + <group type="NXdata" name="spectrum"> + <doc>spectrum of insertion device</doc> + </group> + <group type="NXgeometry"> + <doc>"Engineering" position of insertion device</doc> + </group> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXinstrument.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXinstrument.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc821163cf3f529e9a1d7895b949fdcda5a6a295 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXinstrument.nxdl.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXinstrument" + version="1.0" + type="group" extends="NXobject"> + <doc> + Collection of the components of the instrument or beamline. + + Template of instrument descriptions comprising various beamline components. + Each component will also be a NeXus group defined by its distance from the + sample. Negative distances represent beamline components that are before the + sample while positive distances represent components that are after the sample. + This device allows the unique identification of beamline components in a way + that is valid for both reactor and pulsed instrumentation. + </doc> + <field name="name"> + <doc>Name of instrument</doc> + <attribute name="short_name"> + <doc>short name for instrument, perhaps the acronym</doc> + </attribute> + </field> + <group type="NXaperture" /> + <group type="NXattenuator" /> + <group type="NXbeam" /> + <group type="NXbeam_stop" /> + <group type="NXbending_magnet" /> + <group type="NXcollimator" /> + <group type="NXcollection" /> + <group type="NXcapillary" /> + <group type="NXcrystal" /> + <group type="NXdetector" /> + <group type="NXdetector_group" /> + <group type="NXdisk_chopper" /> + <group type="NXevent_data" /> + <group type="NXfermi_chopper" /> + <group type="NXfilter" /> + <group type="NXflipper" /> + <group type="NXguide" /> + <group type="NXinsertion_device" /> + <group type="NXmirror" /> + <group type="NXmoderator" /> + <group type="NXmonochromator" /> + <group type="NXpolarizer" /> + <group type="NXpositioner" /> + <group type="NXsource" /> + <group type="NXvelocity_selector" /> + <group type="NXxraylens" /> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXlog.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXlog.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b54a234bf02b4a1fc54a66dd9b0a23f92df9ce04 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXlog.nxdl.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXlog" + version="1.0" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Information recorded as a function of time. + + Description of information that is recorded against time, + such as information monitored during the run. + It contains + the logged values and the times at which they were measured as elapsed time since a starting + time recorded in ISO8601 format. This method of storing logged data helps to distinguish + instances in which a variable is a dimension scale of the data, in which case it is stored + in an :ref:`NXdata` group, and instances in which it is logged during the + run, when it should be stored in an :ref:`NXlog` group. + Note: When using multiple :ref:`NXlog` groups, it is suggested to place + them inside a :ref:`NXcollection` group. In such cases, when + :ref:`NXlog` is used in another class, + :ref:`NXcollection`/:ref:`NXlog` is then constructed. + </doc> + <field name="time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time of logged entry. The times are relative to the "start" attribute + and in the units specified in the "units" attribute. + </doc> + <attribute name="start" type="NX_DATE_TIME" /> + </field> + <field name="value" units="NX_ANY" type="NX_NUMBER"> + <doc>Array of logged value, such as temperature</doc> + </field> + <field name="raw_value" units="NX_ANY" type="NX_NUMBER"> + <doc>Array of raw information, such as thermocouple voltage</doc> + </field> + <field name="description"> + <doc>Description of logged value</doc> + </field> + <field name="average_value" type="NX_FLOAT" units="NX_ANY"/> + <field name="average_value_error" type="NX_FLOAT" units="NX_ANY"> + <doc>estimated uncertainty (often used: standard deviation) of average_value</doc> + </field> + <field name="minimum_value" type="NX_FLOAT" units="NX_ANY"/> + <field name="maximum_value" type="NX_FLOAT" units="NX_ANY"/> + <field name="duration" type="NX_FLOAT" units="NX_ANY"> + <doc>Total time log was taken</doc> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXmirror.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXmirror.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b96c3f596514f60eed0f8081aab652823e0ffcbb --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXmirror.nxdl.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmirror" + version="1.0" + type="group" extends="NXobject"> + <doc>A beamline mirror or supermirror.</doc> + + <group type="NXgeometry"><doc><!-- TODO explain what this group means --></doc> + </group> + <field name="type"> + <enumeration> + <item value="single"><doc>mirror with a single material as a reflecting surface</doc></item> + <item value="multi"><doc>mirror with stacked, multiple layers as a reflecting surface</doc></item> + </enumeration> + </field> + <field name="description"> + <doc>description of this mirror</doc> + </field> + <field name="incident_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc></doc> + </field> + <group type="NXdata" name="reflectivity"> + <!-- + TODO Trac ticket #45 applies here. + https://github.com/nexusformat/definitions/issues/45 + + TODO Solution of ticket #41 will apply here, as well. + https://github.com/nexusformat/definitions/issues/41 + --> + <doc>Reflectivity as function of wavelength</doc> + </group> + <!-- TODO need more documentation throughout --> + <field name="bend_angle_x" type="NX_FLOAT" units="NX_ANGLE"> + <doc></doc> + </field> + <field name="bend_angle_y" type="NX_FLOAT" units="NX_ANGLE"> + <doc></doc> + </field> + <field name="interior_atmosphere"> + <enumeration> + <item value="vacuum"/> + <item value="helium"/> + <item value="argon"/> + </enumeration> + </field> + <field name="external_material"> + <doc>external material outside substrate</doc> + </field> + <field name="m_value" type="NX_FLOAT" units="NX_UNITLESS"> + <doc> + The m value for a supermirror, which defines the supermirror + regime in multiples of the critical angle of Nickel. + </doc> + </field> + <field name="substrate_material"> + <doc></doc> + </field> + <field name="substrate_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="coating_material"> + <doc></doc> + </field> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="even_layer_material"> + <doc></doc> + </field> + <field name="even_layer_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="odd_layer_material"> + <doc></doc> + </field> + <field name="odd_layer_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="layer_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc> An array describing the thickness of each layer</doc> + </field> + <group type="NXshape" name="shape"> + <doc>A NXshape group describing the shape of the mirror</doc> + </group> + <group name="figure_data" type="NXdata"> + <doc>Numerical description of the surface figure of the mirror.</doc> + </group> + <!-- TODO need more parameters here, such as ... + list from Rainer Gehrke, DESY (some items may already be present) + +Parameters for mirrors + Field indicating whether simple or multilayer + Substrate element or compound + Substrate density + In case of multilayer: Even layer material (element or compound) + Even layer density + Odd layer material (element or compound) + Odd layer density + Number of layer pairs + Layer thickness (array) + + +Figure for crystals and mirrors (to describe curved surfaces) + Field indicating whether concave or convex + Field indicating whether cylindrical or not + If cylindrical: cylinder orientation angle + +Now come the different surface figures with the necessary parameters: +1. Flat +2. Spherical (spherical radius) +3. Elliptical and hyperbolical (semi-major axis, semi-minor axis, angle of major axis and pole) +4. Toroidal (major radius, minor radius) +5. Parabolical (parabolic parameter a) +6. Conical (cone half aperture) +7. Polynomial (degree of polynom, array with polynom coefficients) + + --> + +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXmoderator.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXmoderator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..815361e2645239bbe732822cca3e0a1689ba46e1 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXmoderator.nxdl.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmoderator" + version="1.0" + type="group" extends="NXobject"> + <doc>A neutron moderator</doc> + <group type="NXgeometry"> + <doc>"Engineering" position of moderator</doc> + </group> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Effective distance as seen by measuring radiation</doc> + </field> + <field name="type"> + <enumeration> + <item value="H20"/> + <item value="D20"/> + <item value="Liquid H2"/> + <item value="Liquid CH4"/> + <item value="Liquid D2"/> + <item value="Solid D2"/> + <item value="C"/> + <item value="Solid CH4"/> + <item value="Solid H2"/> + </enumeration> + </field> + <field name="poison_depth" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="coupled" type="NX_BOOLEAN"> + <doc>whether the moderator is coupled</doc> + </field> + <field name="coupling_material"> + <doc>The material used for coupling. Usually Cd.</doc> + </field> + <field name="poison_material"> + <enumeration> + <item value="Gd"/> + <item value="Cd"/> + </enumeration> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>average/nominal moderator temperature</doc> + </field> + <group type="NXlog" name="temperature_log"> + <doc>log file of moderator temperature</doc> + </group> + <group type="NXdata" name="pulse_shape"> + <doc>moderator pulse shape</doc> + </group> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXmonitor.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXmonitor.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..37f1a9ebd078ba2f66f0c250ea969f50f98e50e1 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXmonitor.nxdl.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmonitor" + version="1.0" + type="group" extends="NXobject"> + <doc> + A monitor of incident beam data. + + It is similar to the :ref:`NXdata` groups containing + monitor data and its associated dimension scale, e.g. time_of_flight or + wavelength in pulsed neutron instruments. However, it may also include + integrals, or scalar monitor counts, which are often used in both in both + pulsed and steady-state instrumentation. + </doc> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="start_time" type="NX_DATE_TIME"> + <doc>Starting time of measurement</doc> + </field> + <field name="end_time" type="NX_DATE_TIME"> + <doc>Ending time of measurement</doc> + </field> + <field name="preset" type="NX_NUMBER" units="NX_ANY"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance of monitor from sample</doc> + </field> + <field name="range" type="NX_FLOAT" units="NX_ANY"> + <doc>Range (X-axis, Time-of-flight, etc.) over which the integral was calculated</doc> + <dimensions><dim index="1" value="2"/></dimensions> + </field> + <field name="nominal" type="NX_NUMBER" units="NX_ANY"> + <doc>Nominal reading to be used for normalisation purposes.</doc> + </field> + <field name="integral" type="NX_NUMBER" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + <group name="integral_log" type="NXlog"> + <doc>Time variation of monitor counts</doc> + </group> + <field name="type"> + <enumeration> + <item value="Fission Chamber"/> + <item value="Scintillator"/> + </enumeration> + </field> + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME_OF_FLIGHT"> + <doc>Time-of-flight</doc> + <dimensions> + <dim index="1" ref="efficiency"/> + </dimensions> + </field> + <field name="efficiency" type="NX_NUMBER" units="NX_DIMENSIONLESS"> + <doc>Monitor efficiency</doc> + <dimensions><dim index="1" ref="i"/></dimensions> + </field> + <field name="data" type="NX_NUMBER" units="NX_ANY"> + <doc> + Monitor data + </doc> + <dimensions rank="dataRank"> + <doc> + The rank (``dataRank``) of the ``data`` must satisfy + ``1 <= dataRank <= NX_MAXRANK=32``. + At least one ``dim`` must have length ``n``. + </doc> + <dim index="0" value="n"><!-- index="0": cannot know to which dimension this applies a priori --></dim> + </dimensions> + </field> + <field name="sampled_fraction" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>Proportion of incident beam sampled by the monitor (0<x<1)</doc> + </field> + <group type="NXgeometry"> + <doc>Geometry of the monitor</doc> + </group> + <field name="count_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Elapsed actual counting time, can be an array of size ``np`` + when scanning. This is not the difference of the calendar time + but the time the instrument was really counting, without + pauses or times lost due beam unavailability + </doc> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXmonochromator.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXmonochromator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c963efff755dd0ab9fa9186799877fd25925eca --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXmonochromator.nxdl.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmonochromator" + version="1.0" + type="group" extends="NXobject"> + <doc> + A wavelength defining device. + + This is a base class for everything which + selects a wavelength or energy, be it a + monochromator crystal, a velocity selector, + an undulator or whatever. + + The expected units are: + + * wavelength: angstrom + * energy: eV + + </doc> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>wavelength selected</doc> + </field> + <field name="wavelength_error" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>wavelength standard deviation</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + <field name="energy_error" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy standard deviation</doc> + </field> + <group type="NXdata" name="distribution"/> + <group type="NXgeometry" name="geometry"/> + <group type="NXcrystal"><doc>Use as many crystals as necessary to describe</doc></group> + <group type="NXvelocity_selector"/> + <group type="NXgrating"><doc>For diffraction grating based monochromators</doc></group> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXnote.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXnote.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..acdf232f1508bba145eca1e6d9fc72e8cd0962c1 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXnote.nxdl.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXnote" + version="1.0" + type="group" extends="NXobject"> + <doc> + Any additional freeform information not covered by the other base classes. + + This class can be used to store additional information in a + NeXus file e.g. pictures, movies, audio, additional text logs + </doc> + <field name="author"> + <doc>Author or creator of note</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date note created/added</doc> + </field> + <field name="type"> + <doc>Mime content type of note data field e.g. image/jpeg, text/plain, text/html</doc> + </field> + <field name="file_name"> + <doc>Name of original file name if note was read from an external source</doc> + </field> + <field name="description"> + <doc>Title of an image or other details of the note</doc> + </field> + <field name="sequence_index" type="NX_POSINT"> + <doc> + Sequence index of note, for placing a sequence of + multiple **NXnote** groups in an order. Starts with 1. + </doc> + </field> + <field name="data" type="NX_BINARY"> + <doc>Binary note data - if text, line terminator is [CR][LF].</doc> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXobject.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXobject.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b85458e6a58c6cfdc38f9d1f0544fc95d200dfa9 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXobject.nxdl.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXobject" + version="1.0" + type="group"> + <doc> + This is the base object of NeXus + </doc> + <!--attribute name="name"><doc>name of instance</doc></attribute--> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXorientation.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXorientation.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..62ec39aef0f9f4ddcc083b10f8e791c185daabef --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXorientation.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org + +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXorientation" + version="1.0" + type="group" extends="NXobject"> + <doc> + legacy class - recommend to use :ref:`NXtransformations` now + + Description for a general orientation of a component - used by :ref:`NXgeometry` + </doc> + <group type="NXgeometry"> + <doc>Link to another object if we are using relative positioning, else absent</doc> + </group> + <field name="value" type="NX_FLOAT" units="NX_UNITLESS"> + <doc> + The orientation information is stored as direction cosines. The direction cosines will + be between the local coordinate directions and the reference directions (to origin or + relative NXgeometry). Calling the local unit vectors (x',y',z') and the reference unit + vectors (x,y,z) the six numbers will be [x' dot x, x' dot y, x' dot z, y' dot x, y' dot + y, y' dot z] where "dot" is the scalar dot product (cosine of the angle between the unit + vectors). The unit vectors in both the local and reference coordinates are right-handed + and orthonormal. + + The pair of groups NXtranslation and NXorientation together + describe the position of a component. + </doc> + <dimensions><!--numobj,6--> + <dim index="1" value="numobj"/> + <dim index="2" value="6"/> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXparameters.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXparameters.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..06888b8b47b28ced14d31df2d52d12c4012e372e --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXparameters.nxdl.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXparameters" + version="1.0" + type="group" extends="NXobject"> + <doc>Container for parameters, usually used in processing or analysis.</doc> + <field name="term" minOccurs="0" maxOccurs="unbounded" type="NX_CHAR"> + <!-- maxOccurs="unbounded" is intended but is not allowed by current syntax --> + <doc>A parameter (also known as a term) that is used in or results from processing.</doc> + <attribute name="units"/> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXpinhole.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXpinhole.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..528b66d02fb24f4271660bb4941d8bc4ca32ac70 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXpinhole.nxdl.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXpinhole" + version="1.0" + type="group" extends="NXobject"> + <doc> + A simple pinhole. + + For more complex geometries, :ref:`NXaperture` should be used. + </doc> + <field name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the last element in the geometry chain that places + this object in space. + When followed through that chain is supposed to end at an element depending + on "." i.e. the origin of the coordinate system. + If desired the location of the slit can also be described relative to + an NXbeam, which will allow a simple description of a non-centred pinhole. + </doc> + </field> + <field name="diameter" type="NX_NUMBER" units="NX_LENGTH"> + <doc>Size of the circular hole defining the transmitted beam size.</doc> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXpolarizer.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXpolarizer.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..ea0721c5fa900ac37e459dee47ba582012e686b5 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXpolarizer.nxdl.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXpolarizer" + version="1.0" + type="group" extends="NXobject"> + <doc> + A spin polarizer. + </doc> + <field name="type"> + <doc>one of these values: "crystal", "supermirror", "3He"</doc> + </field> + <field name="composition"> + <doc>description of the composition of the polarizing material</doc> + </field> + <field name="reflection" type="NX_INT" units="NX_UNITLESS"> + <doc>[hkl] values of nominal reflection</doc> + <dimensions> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="efficiency" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>polarizing efficiency</doc> + </field> +</definition> + diff --git a/src/punx/cache/v3.2/base_classes/NXpositioner.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXpositioner.nxdl.xml similarity index 98% rename from src/punx/cache/v3.2/base_classes/NXpositioner.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXpositioner.nxdl.xml index 5a2aed06f60e623b5081b6bbbc17f8915ddcb0ea..c3a2759e11d7b10154975122d839e478030dc2d6 100644 --- a/src/punx/cache/v3.2/base_classes/NXpositioner.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXpositioner.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/a4fd52d/base_classes/NXprocess.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXprocess.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..77926c695d45fe1866a848f593e7c898d15778ec --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXprocess.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXprocess" + version="1.0" + type="group" extends="NXobject"> + <doc>Document an event of data processing, reconstruction, or analysis for this data.</doc> + <field name="program" type="NX_CHAR"> + <doc>Name of the program used</doc> + </field> + <field name="sequence_index" type="NX_POSINT"> + <doc> + Sequence index of processing, + for determining the order of multiple **NXprocess** steps. + Starts with 1. + </doc> + </field> + <field name="version" type="NX_CHAR"> + <doc>Version of the program used</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date and time of processing.</doc> + </field> + <group type="NXnote"> + <doc> + The note will contain information about how the data was processed + or anything about the data provenance. + The contents of the note can be anything that the processing code + can understand, or simple text. + + The name will be numbered to allow for ordering of steps. + </doc> + </group> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXroot.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXroot.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b3ee7e0fd6ac6d60db27f82b1fe33f17f26a9811 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXroot.nxdl.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXroot" + version="1.0" + type="group" extends="NXobject"> + <doc>Definition of the root NeXus group.</doc> + <attribute name="NX_class"> + <doc> + The root of any NeXus data file is an ``NXroot`` class + (no other choice is allowed for a valid NeXus data file). + This attribute cements that definition. + </doc> + <enumeration> + <item value="NXroot"></item> + </enumeration> + </attribute> + <attribute name="file_time"> + <doc>Date and time file was originally created</doc> + </attribute> + <attribute name="file_name"> + <doc>File name of original NeXus file</doc> + </attribute> + <attribute name="file_update_time"> + <doc>Date and time of last file change at close</doc> + </attribute> + <attribute name="NeXus_version"> + <doc> + Version of NeXus API used in writing the file. + + Only used when the NAPI has written the file. + Note that this is different from the version of the + base class or application definition version number. + </doc> + </attribute> + <attribute name="HDF_version"> + <doc>Version of HDF (version 4) library used in writing the file</doc> + </attribute> + <attribute name="HDF5_Version"> + <doc> + Version of HDF5 library used in writing the file. + + Note this attribute is spelled with uppercase "V", + different than other version attributes. + </doc> + </attribute> + <attribute name="XML_version"> + <doc>Version of XML support library used in writing the XML file</doc> + </attribute> + <attribute name="h5py_version"> + <doc>Version of h5py Python package used in writing the file</doc> + </attribute> + <attribute name="creator"> + <doc>facility or program where file originated</doc> + </attribute> + <group type="NXentry" minOccurs="1" > + <doc>entries</doc> + </group> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXentry` group contains + the data to be shown by default. + It is needed to resolve ambiguity when + more than one :ref:`NXentry` group exists. + The value is the name of the default :ref:`NXentry` group. + + It is recommended (as of NIAC2014) to use this attribute + to help define the path to the default dataset to be plotted. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXsample.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXsample.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..46e62a5e363ca5350126dae1062fb905f01a3faf --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXsample.nxdl.xml @@ -0,0 +1,335 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsample" + version="1.0" + type="group" extends="NXobject" + > + + <symbols> + <doc>symbolic array lengths to be coordinated between various fields</doc> + <symbol name="n_comp"><doc>number of compositions</doc></symbol> + <symbol name="n_Temp"><doc>number of temperatures</doc></symbol> + <symbol name="n_eField"><doc>number of values in applied electric field</doc></symbol> + <symbol name="n_mField"><doc>number of values in applied magnetic field</doc></symbol> + <symbol name="n_pField"><doc>number of values in applied pressure field</doc></symbol> + <symbol name="n_sField"><doc>number of values in applied stress field</doc></symbol> + </symbols> + + <doc> + Any information on the sample. + + This could include scanned variables that + are associated with one of the data dimensions, e.g. the magnetic field, or + logged data, e.g. monitored temperature vs elapsed time. + </doc> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="chemical_formula"> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + + - C, then H, then the other elements in alphabetical order of their symbol. + - If carbon is not present, the elements are listed purely in alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>Sample temperature. This could be a scanned variable</doc> + <dimensions rank="anyRank"> + <dim index="1" value="n_Temp"/><!-- could be any length --> + </dimensions> + </field> + <field name="electric_field" type="NX_FLOAT" units="NX_VOLTAGE"> + <doc>Applied electric field</doc> + <dimensions> + <dim index="1" value="n_eField"/><!-- could be any length --> + </dimensions> + <attribute name="direction"> + <enumeration> + <item value="x"/> + <item value="y"/> + <item value="z"/> + </enumeration> + </attribute> + </field> + <field name="magnetic_field" type="NX_FLOAT" units="NX_ANY"> + <doc>Applied magnetic field</doc> + <dimensions> + <dim index="1" value="n_mField"/><!-- could be any length --> + </dimensions> + <attribute name="direction"> + <enumeration> + <item value="x"/> + <item value="y"/> + <item value="z"/> + </enumeration> + </attribute> + </field> + <field name="stress_field" type="NX_FLOAT" units="NX_ANY"> + <doc>Applied external stress field</doc> + <dimensions> + <dim index="1" value="n_sField"/><!-- could be any length --> + </dimensions> + <attribute name="direction"> + <enumeration> + <item value="x"/> + <item value="y"/> + <item value="z"/> + </enumeration> + </attribute> + </field> + <field name="pressure" type="NX_FLOAT" units="NX_PRESSURE"> + <doc>Applied pressure</doc> + <dimensions> + <dim index="1" value="n_pField"/><!-- could be any length --> + </dimensions> + </field> + <field name="changer_position" type="NX_INT" units="NX_UNITLESS"> + <doc>Sample changer position</doc> + </field> + <field name="unit_cell" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell parameters (lengths and angles)</doc> + <dimensions rank="2"> + <dim index="1" value="n_comp"/> + <dim index="2" value="6"/> + </dimensions> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Volume of the unit cell</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="sample_orientation" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + This will follow the Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal sample using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="3"> + <dim index="1" value="n_comp"/> + <dim index="2" value="3"/> + <dim index="3" value="3"/> + </dimensions> + </field> + <field name="mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Mass of sample</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc>Density of sample</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="relative_molecular_mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Relative Molecular Mass of sample</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="type"> + <enumeration> + <item value="sample" /> + <item value="sample+can" /> + <item value="can" /> + <item value="calibration sample" /> + <item value="normalisation sample" /> + <item value="simulated data" /> + <item value="none" /> + <item value="sample environment" /> + </enumeration> + </field> + <field name="situation"> + <doc> + The atmosphere will be one of the components, which is where + its details will be stored; the relevant components will be + indicated by the entry in the sample_component member. + </doc> + <enumeration> + <item value="air" /> + <item value="vacuum" /> + <item value="inert atmosphere" /> + <item value="oxidising atmosphere" /> + <item value="reducing atmosphere" /> + <item value="sealed can" /> + <item value="other" /> + </enumeration> + </field> + <field name="description"> + <doc> + Description of the sample + </doc> + </field> + <field name="preparation_date" type="NX_DATE_TIME"> + <doc>Date of preparation of the sample</doc> + </field> + <group name="geometry" type="NXgeometry"> + <doc>The position and orientation of the center of mass of the sample</doc> + </group> + <group type="NXbeam"> + <doc>Details of beam incident on sample - used to calculate sample/beam interaction point</doc> + </group> + <field name="component"> + <doc>Details of the component of the sample and/or can</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="sample_component"> + <doc>Type of component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + <enumeration> + <item value="sample" /> + <item value="can" /> + <item value="atmosphere" /> + <item value="kit" /> + </enumeration> + </field> + <field name="concentration" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc>Concentration of each component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="volume_fraction" type="NX_FLOAT"> + <doc>Volume fraction of each component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="scattering_length_density" type="NX_FLOAT" units="NX_SCATTERING_LENGTH_DENSITY"> + <doc>Scattering length density of each component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="unit_cell_class"> + <doc> + In case it is all we know and we want to record/document it + </doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + <enumeration> + <item value="cubic" /> + <item value="tetragonal" /> + <item value="orthorhombic" /> + <item value="monoclinic" /> + <item value="triclinic" /> + </enumeration> + </field> + <field name="unit_cell_group"> + <doc>Crystallographic point or space group</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="path_length" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Path length through sample/can for simple case when + it does not vary with scattering direction + </doc> + </field> + <field name="path_length_window" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Thickness of a beam entry/exit window on the can (mm) + - assumed same for entry and exit + </doc> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>sample thickness</doc> + </field> + <group name="transmission" type="NXdata"> + <doc>As a function of Wavelength</doc> + </group> + <group name="temperature_log" type="NXlog"> + <doc>temperature_log.value is a link to e.g. temperature_env.sensor1.value_log.value</doc> + </group> + <group name="temperature_env" type="NXenvironment"> + <doc>Additional sample temperature environment information</doc> + </group> + <group name="magnetic_field_log" type="NXlog"> + <doc>magnetic_field_log.value is a link to e.g. magnetic_field_env.sensor1.value_log.value</doc> + </group> + <group name="magnetic_field_env" type="NXenvironment"> + <doc>Additional sample magnetic environment information</doc> + </group> + <field name="external_DAC" type="NX_FLOAT" units="NX_ANY"> + <doc>value sent to user's sample setup</doc> + </field> + <group name="external_ADC" type="NXlog"> + <doc>logged value (or logic state) read from user's setup</doc> + </group> + <field name="short_title"> + <doc>20 character fixed length sample description for legends</doc> + <!-- How is the string length limitation imposed by the XSD? --> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Optional rotation angle for the case when the powder diagram has + been obtained through an omega-2theta scan like from a traditional + single detector powder diffractometer + </doc> + </field> + <field name="x_translation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the X-direction of the laboratory coordinate system</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the Z-direction of the laboratory coordinate system</doc> + </field> + <group type="NXpositioner"> + <doc>Any positioner (motor, PZT, ...) used to locate the sample</doc> + </group> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXsensor.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXsensor.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..41e5521a005119c9a989188ad45d1042de7a1b6a --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXsensor.nxdl.xml @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsensor" + version="1.0" + type="group" extends="NXobject"> + <doc> + A sensor used to monitor an external condition + + The condition itself is described in :ref:`NXenvironment`. + </doc> + <field name="model"> + <doc>Sensor identification code/model number</doc> + </field> + <field name="name"> + <doc>Name for the sensor</doc> + </field> + <field name="short_name"> + <doc>Short name of sensor used e.g. on monitor display program</doc> + </field> + <field name="attached_to"> + <doc>where sensor is attached to ("sample" | "can")</doc> + </field> + <group name="geometry" type="NXgeometry"> + <doc>Defines the axes for logged vector quantities if they are not the global instrument axes</doc> + </group> + <field name="measurement"> + <doc>name for measured signal</doc> + <enumeration> + <item value="temperature" /> + <item value="pH" /> + <item value="magnetic_field" /> + <item value="electric_field" /> + <item value="conductivity" /> + <item value="resistance" /> + <item value="voltage" /> + <item value="pressure" /> + <item value="flow" /> + <item value="stress" /> + <item value="strain" /> + <item value="shear" /> + <item value="surface_pressure" /> + </enumeration> + </field> + <field name="type"> + <doc> + The type of hardware used for the measurement. + Examples (suggestions but not restrictions): + + :Temperature: + J | K | T | E | R | S | Pt100 | Rh/Fe + :pH: + Hg/Hg2Cl2 | Ag/AgCl | ISFET + :Ion selective electrode: + specify species; e.g. Ca2+ + :Magnetic field: + Hall + :Surface pressure: + wilhelmy plate + </doc> + </field> + <field name="run_control" type="NX_BOOLEAN"> + <doc> + Is data collection controlled or synchronised to this quantity: + 1=no, 0=to "value", 1=to "value_deriv1", etc. + </doc> + </field> + <field name="high_trip_value" type="NX_FLOAT" units="NX_ANY"> + <doc> + Upper control bound of sensor reading if using run_control + </doc> + </field> + <field name="low_trip_value" type="NX_FLOAT" units="NX_ANY"> + <doc> + Lower control bound of sensor reading if using run_control + </doc> + </field> + <field name="value" type="NX_FLOAT" units="NX_ANY"> + <doc> + nominal setpoint or average value + - need [n] as may be a vector + </doc> + <dimensions> + <dim index="1" value="n"/> + </dimensions> + </field> + <field name="value_deriv1" type="NX_FLOAT" units="NX_ANY"> + <doc> + Nominal/average first derivative of value + e.g. strain rate + - same dimensions as "value" (may be a vector) + </doc> + <dimensions> + <dim index="1" ref="value"/> + </dimensions> + </field> + <field name="value_deriv2" type="NX_FLOAT" units="NX_ANY"> + <doc> + Nominal/average second derivative of value + - same dimensions as "value" (may be a vector) + </doc> + <dimensions> + <dim index="1" ref="value"/> + </dimensions> + </field> + <group name="value_log" type="NXlog"> + <doc>Time history of sensor readings</doc> + </group> + <group name="value_deriv1_log" type="NXlog"> + <doc>Time history of first derivative of sensor readings</doc> + </group> + <group name="value_deriv2_log" type="NXlog"> + <doc>Time history of second derivative of sensor readings</doc> + </group> + <field name="external_field_brief"> + <enumeration> + <item value="along beam" /> + <item value="across beam" /> + <item value="transverse" /> + <item value="solenoidal" /> + <item value="flow shear gradient" /> + <item value="flow vorticity" /> + </enumeration> + </field> + <group name="external_field_full" type="NXorientation"> + <doc>For complex external fields not satisfied by External_field_brief</doc> + </group> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXshape.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXshape.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..76672032f4b14a8e046c1efa3814ded5d7328687 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXshape.nxdl.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXshape" + version="1.0" + type="group" extends="NXobject"> + <doc> + legacy class - (used by :ref:`NXgeometry`) - the shape and size of a component. + + This is the description of the general shape and size of a + component, which may be made up of ``numobj`` separate + elements - it is used by the :ref:`NXgeometry` class + </doc> + <field name="shape"> + <doc>general shape of a component</doc> + <enumeration> + <item value="nxflat"/> + <item value="nxcylinder"/> + <item value="nxbox"/> + <item value="nxsphere"/> + <item value="nxcone"/> + <item value="nxelliptical"/> + <item value="nxtoroidal"/> + <item value="nxparabolic"/> + <item value="nxpolynomial"/> + </enumeration> + + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + physical extent of the object along its local axes (after NXorientation) + with the center of mass at the local origin (after NXtranslation). + The meaning and location of these axes will vary according to the value + of the "shape" variable. + ``nshapepar`` defines how many parameters: + + - For "nxcylinder" type the parameters are (diameter,height) and a three value orientation vector of the cylinder. + - For the "nxbox" type the parameters are (length,width,height). + - For the "nxsphere" type the parameters are (diameter). + - For nxcone cone half aperture + - For nxelliptical, semi-major axis, semi-minor-axis, angle of major axis and pole + - For nxtoroidal, major radius, minor radius + - For nxparabolic, parabolic parameter a + - For nxpolynomial, an array of polynom coefficients, the dimension of the array + encodes the degree of the polynom + </doc> + <dimensions> + <dim index="1" value="numobj"/> + <dim index="2" value="nshapepar"/> + </dimensions> + </field> + <field name="direction"> + <enumeration> + <item value="concave"></item> + <item value="convex"></item> + </enumeration> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXslit.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXslit.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d714b225bd4dc393a59f284867e888f9a346d40a --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXslit.nxdl.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXslit" + version="1.0" + type="group" extends="NXobject"> + <doc> + A simple slit. + + For more complex geometries, :ref:`NXaperture` should be used. + </doc> + <field name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the last element in the geometry chain that places + this object in space. + When followed through that chain is supposed to end at an element depending + on "." i.e. the origin of the coordinate system. + If desired the location of the slit can also be described relative to + an NXbeam, which will allow a simple description of a non-centred slit. + </doc> + </field> + <field name="x_gap" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Size of the gap opening in the first dimension of the local + coordinate system. + </doc> + </field> + <field name="y_gap" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Size of the gap opening in the second dimension of the local + coordinate system. + </doc> + </field> +</definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXsource.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXsource.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c1b201e0f34ce39da27ee2aa5f7e5a20770e3d7b --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXsource.nxdl.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsource" + version="1.0" + type="group" extends="NXobject"> + <doc>The neutron or x-ray storage ring/facility.</doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Effective distance from sample + Distance as seen by radiation from sample. This number should be negative + to signify that it is upstream of the sample. + </doc> + </field> + <field name="name"> + <doc>Name of source</doc> + <attribute name="short_name"> + <doc>short name for source, perhaps the acronym</doc> + </attribute> + </field> + <field name="type"> + <doc>type of radiation source (pick one from the enumerated list and spell exactly)</doc> + <enumeration> + <item value="Spallation Neutron Source" /> + <item value="Pulsed Reactor Neutron Source" /> + <item value="Reactor Neutron Source" /> + <item value="Synchrotron X-ray Source" /> + <item value="Pulsed Muon Source" /> + <item value="Rotating Anode X-ray" /> + <item value="Fixed Tube X-ray" /> + <item value="UV Laser" /> + <item value="Free-Electron Laser" /> + <item value="Optical Laser" /> + <item value="Ion Source" /> + <item value="UV Plasma Source" /> + </enumeration> + </field> + <field name="probe"> + <doc>type of radiation probe (pick one from the enumerated list and spell exactly)</doc> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="muon" /> + <item value="electron" /> + <item value="ultraviolet" /> + <item value="visible light" /> + <item value="positron" /> + <item value="proton" /> + </enumeration> + </field> + <field name="power" type="NX_FLOAT" units="NX_POWER"> + <doc>Source power</doc> + </field> + <field name="emittance_x" type="NX_FLOAT" units="NX_EMITTANCE"> + <doc>Source emittance (nm-rad) in X (horizontal) direction.</doc> + </field> + <field name="emittance_y" type="NX_FLOAT" units="NX_EMITTANCE"> + <doc>Source emittance (nm-rad) in Y (horizontal) direction.</doc> + </field> + <field name="sigma_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc>particle beam size in x</doc> + </field> + <field name="sigma_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc>particle beam size in y</doc> + </field> + <field name="flux" type="NX_FLOAT" units="NX_FLUX"> + <doc>Source intensity/area (example: s-1 cm-2)</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc> + Source energy. + For storage rings, this would be the particle beam energy. + For X-ray tubes, this would be the excitation voltage. + </doc> + </field> + <field name="current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Accelerator, X-ray tube, or storage ring current</doc> + </field> + <field name="voltage" type="NX_FLOAT" units="NX_VOLTAGE"> + <doc>Accelerator voltage</doc> + </field> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>Frequency of pulsed source</doc> + </field> + <field name="period" type="NX_FLOAT" units="NX_PERIOD"> + <doc>Period of pulsed source</doc> + </field> + <field name="target_material"> + <doc>Pulsed source target material</doc> + <enumeration> + <item value="Ta" /> + <item value="W" /> + <item value="depleted_U" /> + <item value="enriched_U" /> + <item value="Hg" /> + <item value="Pb" /> + <item value="C" /> + </enumeration> + </field> + <group name="notes" type="NXnote"> + <doc> + any source/facility related messages/events that + occurred during the experiment + </doc> + </group> + <group name="bunch_pattern" type="NXdata"> + <doc> + For storage rings, description of the bunch pattern. + This is useful to describe irregular bunch patterns. + </doc> + <field name="title"><doc>name of the bunch pattern</doc></field> + </group> + <field name="number_of_bunches" type="NX_INT"> + <doc>For storage rings, the number of bunches in use.</doc> + </field> + <field name="bunch_length" type="NX_FLOAT" units="NX_TIME"> + <doc>For storage rings, temporal length of the bunch</doc> + </field> + <field name="bunch_distance" type="NX_FLOAT" units="NX_TIME"> + <doc>For storage rings, time between bunches</doc> + </field> + <field name="pulse_width" type="NX_FLOAT" units="NX_TIME"> + <doc>temporal width of source pulse</doc><!-- pulsed sources or storage rings could use this --> + </field> + <group name="pulse_shape" type="NXdata"> + <doc>source pulse shape</doc><!-- pulsed sources or storage rings could use this --> + </group> + <field name="mode"> + <doc>source operating mode</doc> + <enumeration> + <item value="Single Bunch"><doc>for storage rings</doc></item> + <item value="Multi Bunch"><doc>for storage rings</doc></item> + <!-- other sources could add to this --> + </enumeration> + </field> + <field name="top_up" type="NX_BOOLEAN"> + <doc>Is the synchrotron operating in top_up mode?</doc> + </field> + <field name="last_fill" type="NX_NUMBER" units="NX_CURRENT"> + <doc>For storage rings, the current at the end of the most recent injection.</doc> + <attribute name="time" type="NX_DATE_TIME"><doc>date and time of the most recent injection.</doc></attribute> + </field> + <group name="geometry" type="NXgeometry"> + <doc>"Engineering" location of source</doc> + </group> + <group type="NXdata" name="distribution"> + <doc>The wavelength or energy distribution of the source</doc> + </group> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXsubentry.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXsubentry.nxdl.xml similarity index 99% rename from src/punx/cache/v3.2/base_classes/NXsubentry.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXsubentry.nxdl.xml index 3b6dcddda23a2d005325ff5106acea5cce319003..e292bbcf15ce6c1b3d9bad02ef08b0ebba0ec085 100644 --- a/src/punx/cache/v3.2/base_classes/NXsubentry.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXsubentry.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/v3.2/base_classes/NXtransformations.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXtransformations.nxdl.xml similarity index 81% rename from src/punx/cache/v3.2/base_classes/NXtransformations.nxdl.xml rename to src/punx/cache/a4fd52d/base_classes/NXtransformations.nxdl.xml index aad5d752a0d59c81a066c8ee4bc126b50e9393e1..f0a6b7a2191a4f35c15b018272827a6868b5c2a4 100644 --- a/src/punx/cache/v3.2/base_classes/NXtransformations.nxdl.xml +++ b/src/punx/cache/a4fd52d/base_classes/NXtransformations.nxdl.xml @@ -3,7 +3,7 @@ <!-- # NeXus - Neutron and X-ray Common Data Format # -# Copyright (C) 2014-2017 NeXus International Advisory Committee (NIAC) +# Copyright (C) 2014-2016 NeXus International Advisory Committee (NIAC) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ <definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" name="NXtransformations" - version="1.1" + version="1.0" type="group" extends="NXobject" ignoreExtraGroups="true" @@ -78,7 +78,7 @@ This entire explanation is not clear. --> - <field name="AXIS" nameType="any" type="NX_NUMBER" maxOccurs="unbounded"> + <field name="TRANSFORMATION" nameType="any" type="NX_NUMBER" maxOccurs="unbounded"> <doc> Units need to be appropriate for translation or rotation @@ -114,22 +114,4 @@ </doc> </attribute> </field> - <field name="AXIS_end" type="NX_NUMBER" maxOccurs="unbounded"> - <doc> - In the case of an oscillating axis, this field describes the - end of the oscillation, whereas the data in the actual AXIS - describes the start of the oscillation. - </doc> - </field> - <field name="AXIS_increment" type="NX_NUMBER" maxOccurs="unbounded"> - <doc> - In the case of an oscillating axis, this field describes the - amount of the oscillation. The actual AXIS field will - contain the start of the oscillation. This field could - actually be derived from AXIS_end but the fact is that both - AXIS_end and AXIS_increment are representations which are in - common use. Thus, the fields are there, decide to use one or - the other or both. - </doc> - </field> </definition> diff --git a/src/punx/cache/a4fd52d/base_classes/NXtranslation.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXtranslation.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..daa8586ada1bba0529077ff6357cb994771ad00f --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXtranslation.nxdl.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXtranslation" + version="1.0" + type="group" extends="NXobject"> + <doc> + legacy class - (used by :ref:`NXgeometry`) - general spatial location of a component. + </doc> + <group name="geometry" type="NXgeometry"> + <doc>Link to other object if we are relative, else absent</doc> + </group> + <field name="distances" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + (x,y,z) + This field describes the lateral movement of a component. + The pair of groups NXtranslation and NXorientation together + describe the position of a component. + For absolute position, the origin is the scattering center (where a perfectly + aligned sample would be) with the z-axis pointing downstream and the y-axis + pointing gravitationally up. For a relative position the NXtranslation is + taken into account before the NXorientation. The axes are right-handed and + orthonormal. + </doc> + <dimensions> + <dim index="1" value="numobj"/> + <dim index="2" value="3"/> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXuser.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXuser.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b13de28c56b9e0552fdfe9e4bf89a8ec0a7ffcb --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXuser.nxdl.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXuser" + version="1.0" + type="group" extends="NXobject"> + <doc> + Contact information for a user. + + The format allows more + than one user with the same affiliation and contact information, + but a second :ref:`NXuser` group should be used if they have different + affiliations, etc. + </doc> + <field name="name"> + <doc>Name of user responsible for this entry</doc> + </field> + <field name="role"> + <doc> + Role of user responsible for this entry. + Suggested roles are "local_contact", + "principal_investigator", and "proposer" + </doc> + </field> + <field name="affiliation"> + <doc>Affiliation of user</doc> + </field> + <field name="address"> + <doc>Address of user</doc> + </field> + <field name="telephone_number"> + <doc>Telephone number of user</doc> + </field> + <field name="fax_number"> + <doc>Fax number of user</doc> + </field> + <field name="email"> + <doc>Email of user</doc> + </field> + <field name="facility_user_id"> + <doc> + facility based unique identifier for this person + e.g. their identification code on the facility + address/contact database + </doc> + </field> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXvelocity_selector.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXvelocity_selector.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a51faf3eba3afbeabdd3b85c42e2a79074445048 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXvelocity_selector.nxdl.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXvelocity_selector" + version="1.0" + type="group" extends="NXobject"> + <doc>A neutron velocity selector</doc> + <field name="type"> + <doc>velocity selector type</doc> + </field> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>velocity selector rotation speed</doc> + </field> + <field name="radius" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius at beam centre</doc> + </field> + <field name="spwidth" type="NX_FLOAT" units="NX_LENGTH"> + <doc>spoke width at beam centre</doc> + </field> + <field name="length" type="NX_FLOAT" units="NX_LENGTH"> + <doc>rotor length</doc> + </field> + <field name="num" type="NX_INT" units="NX_UNITLESS"> + <doc>number of spokes/lamella</doc> + </field> + <field name="twist" type="NX_FLOAT" units="NX_ANGLE"> + <doc>twist angle along axis</doc> + </field> + <field name="table" type="NX_FLOAT" units="NX_ANGLE"> + <doc>offset vertical angle</doc> + </field> + <field name="height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam height</doc> + </field> + <field name="width" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam width</doc> + </field> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>wavelength</doc> + </field> + <field name="wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>deviation FWHM /Wavelength</doc> + </field> + <group type="NXgeometry" name="geometry"/> +</definition> + diff --git a/src/punx/cache/a4fd52d/base_classes/NXxraylens.nxdl.xml b/src/punx/cache/a4fd52d/base_classes/NXxraylens.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..3081be27cb8aca950f40485b2f899a3e17f4776f --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/NXxraylens.nxdl.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXxraylens" + version="1.0" + type="group" extends="NXobject"> + + <doc> + An X-ray lens, typically at a synchrotron X-ray beam line. + + Based on information provided by Gerd Wellenreuther (DESY). + </doc> + <field name="lens_geometry" type="NX_CHAR"> + <doc>Geometry of the lens</doc> + <enumeration> + <item value="paraboloid"/> + <item value="spherical"/> + <item value="elliptical"/> + <item value="hyperbolical"/> + </enumeration> + </field> + <field name="symmetric" type="NX_BOOLEAN"> + <doc> + Is the device symmetric? + </doc> + </field> + <field name="cylindrical" type="NX_BOOLEAN"> + <doc> + Is the device cylindrical? + </doc> + </field> + <group name="cylinder_orientation" type="NXnote"> + <doc> + Orientation of the cylinder axis. + </doc> + </group> + <field name="focus_type" type="NX_CHAR"> + <doc> + The type of focus of the lens + </doc> + <enumeration> + <item value="line"/> + <item value="point"/> + </enumeration> + </field> + <field name="lens_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of the lens</doc> + </field> + <field name="lens_length" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Length of the lens</doc> + </field> + <field name="curvature" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Radius of the curvature as measured in the middle of the lens</doc> + </field> + <field name="aperture" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Diameter of the lens.</doc> + </field> + <field name="number_of_lenses" type="NX_INT"> + <doc>Number of lenses that make up the compound lens.</doc> + </field> + <field name="lens_material" type="NX_CHAR"> + <doc>Material used to make the lens.</doc> + </field> + <field name="gas" type="NX_CHAR"> + <doc>Gas used to fill the lens</doc> + </field> + <field name="gas_pressure" type="NX_FLOAT" units="NX_PRESSURE"> + <doc>Gas pressure in the lens</doc> + </field> + </definition> diff --git a/src/punx/cache/a4fd52d/base_classes/nxdlformat.xsl b/src/punx/cache/a4fd52d/base_classes/nxdlformat.xsl new file mode 100644 index 0000000000000000000000000000000000000000..952e7515d1c030bac2e6abe19401e8af166d9668 --- /dev/null +++ b/src/punx/cache/a4fd52d/base_classes/nxdlformat.xsl @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Stylesheet to provide a condensed view of a NeXus NXDL specification. + (see https://github.com/nexusformat/definitions/issues/181) + + The nxdlformat.xsl stylesheets differ between the directories + because of the rule regarding either /definition/NXentry or + /definition/NXsubentry for application and contributed definitions. + (see https://github.com/nexusformat/definitions/issues/179) + + Modify <xsl:template match="nx:definition">...</xsl:template> + for each directory. + +line breaks are VERY TRICKY here, be careful how you edit! +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" version="1.0"> + + <xsl:output method="text"/> + <xsl:variable name="indent_step" select="' '"/> + + + <xsl:template match="/"> + <xsl:apply-templates select="nx:definition"/> + </xsl:template> + + + <!-- + Modify ONLY this section for each directory: + base_classes/nxdlformat.xsl no rule for NXentry or NXsubentry + applications/nxdlformat.xsl required rule for NXentry or NXsubentry + contributed_definitions/nxdlformat.xsl optional rule for NXentry or NXsubentry + --> + <xsl:template match="nx:definition"> + <xsl:call-template name="showClassName"/> + <xsl:call-template name="startFieldsGroups"/> + </xsl:template> + + + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + <!-- +++ From this point on, the code is the same for, +++ --> + <!-- +++ base_classes applications/, and contributed/ +++ --> + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + + <xsl:template match="nx:field"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/>:<xsl:choose> + <xsl:when test="count(@type)"><xsl:value-of select="@type" + /><xsl:apply-templates select="nx:dimensions" + ><xsl:sort select="@name"/></xsl:apply-templates></xsl:when> + <xsl:otherwise>NX_CHAR</xsl:otherwise> + </xsl:choose> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template match="nx:dimensions"><!-- + -->[<xsl:apply-templates select="nx:dim"/>]<!-- + --></xsl:template> + + + <xsl:template match="nx:dim"> + <xsl:choose> + <xsl:when test="position()=1"><xsl:value-of select="@value"/></xsl:when> + <xsl:otherwise>,<xsl:value-of select="@value"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="nx:link"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/><xsl:text + > --> </xsl:text><xsl:value-of select="@target"/><xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:attribute"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/>@<xsl:value-of select="@name"/> + <xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:group"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:if test="count(@name)"><xsl:value-of select="@name"/>:</xsl:if> + <xsl:value-of select="@type"/> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template name="startFieldsGroups"> + <xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:choose> + <!-- Two ways to render. + 1=1: write fields, links, then groups, each sorted alphabetically + 1!=1: order of appearance in NXDL + --> + <xsl:when test="1=1"><!-- write fields, links, then groups --> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise><!-- write in order of appearance in NXDL --> + <xsl:apply-templates select="nx:field|nx:link|nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="showClassName"> + <xsl:value-of select="@name"/> (<xsl:choose> + <xsl:when test="@category='base'">base class</xsl:when> + <xsl:when test="@category='application'">application definition</xsl:when> + <xsl:when test="@category='contributed'">contributed definition</xsl:when> + </xsl:choose><xsl:if test="count(@version)">, version <xsl:value-of + select="@version"/></xsl:if>)<xsl:text><!-- tricky line break here --> +</xsl:text></xsl:template> + +</xsl:stylesheet> + +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXcanSAS.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXcanSAS.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4a2749006f200dcb9c89bfb34d23d75c408eb553 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXcanSAS.nxdl.xml @@ -0,0 +1,1002 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2012-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> + +<!-- + NOTE: + This NXDL refers to several image files (.jpg, .png) in its documentation. + All such related resources are stored in the related subdirectory: ./canSAS/ + + In general, for an NXDL file: NXsomenxdl.nxdl.xml + all related resources should be stored in subdirectory: ./somenxdl/ + NOTE: + This is intended to become an application definition, thus its category + attribute has been set in anticipation of that use. + --> +<definition name="NXcanSAS" extends="NXobject" type="group" + version="1.0" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Implementation of the :index:`canSAS` standard to store reduced small-angle scattering data of any dimension. + + For more details, see: + + * http://www.cansas.org/ + * http://www.cansas.org/formats/canSAS1d/1.1/doc/ + * https://github.com/canSAS-org/NXcanSAS_examples + + The minimum requirements for *reduced* small-angle scattering data + as described by canSAS are summarized in the following figure: + + .. figure:: canSAS/minimum.png + :width: 60% + + The minimum requirements for *reduced* small-angle scattering data. + (:download:`full image <canSAS/minimum.png>`) + + .. rubric:: Implementation of canSAS standard in NeXus + + This application definition is an implementation of the canSAS + standard for storing both one-dimensional and multi-dimensional data. + + The canSAS data format has a structure similar to NeXus, not identical. + To allow canSAS data to be expressed in NeXus, yet identifiable + by the canSAS standard, an additional group attribute ``canSAS_class`` + was introduced. Here is the mapping of some common groups. + + =============== ============ ========================== + group (*) NX_class canSAS_class + =============== ============ ========================== + sasentry NXentry SASentry + sasdata NXdata SASdata + sasdetector NXdetector SASdetector + sasinstrument NXinstrument SASinstrument + sasnote NXnote SASnote + sasprocess NXprocess SASprocess + sasprocessnote NXcollection SASprocessnote + sastransmission NXdata SAStransmission_spectrum + sassample NXsample SASsample + sassource NXsource SASsource + =============== ============ ========================== + + (*) The name of each group is a suggestion, + not a fixed requirement and is chosen as fits each data file. + See the section on defining + :ref:`NXDL group and field names <RegExpName>`. + + + In canSAS1d, *orientation* (rotations of sample or detector) + are described in terms of *roll*, *pitch*, and *yaw*. + NeXus uses different terms as shown in the next table: + + ========= ============================== + canSAS1d NeXus + ========= ============================== + roll ``polar_angle`` + pitch ``x_axis_rotation`` (not expected or defined here) + yaw ``azimuthal_angle`` + ========= ============================== + + </doc> + + <group type="NXentry"> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + </doc> + </attribute> + <doc> + .. index:: NXcanSAS (contributed definition); SASentry + + Place the canSAS ``SASentry`` group as a child of a NeXus ``NXentry`` group + (when data from multiple techniques are being stored) + or as a replacement for the ``NXentry`` group. + + Note: It is required for all numerical objects to provide + a *units* attribute that describes the engineering units. + Use the Unidata UDunits [#]_ specification + as this is compatible with various community standards. + + .. [#] The UDunits specification also includes instructions for derived units. + </doc> + <attribute name="canSAS_class"> + <doc> + Official canSAS group: **SASentry** + </doc> + <enumeration> + <item value="SASentry" /> + </enumeration> + </attribute> + <attribute name="version"> + <doc> + Describes the version of the canSAS standard used to write this data. + This must be a text (not numerical) representation. Such as:: + + @version="1.0" + + </doc> + <enumeration> + <item value="1.0" /> + </enumeration> + </attribute> + + <field name="definition"> + <doc>Official NeXus NXDL schema to which this subentry conforms.</doc> + <enumeration> + <item value="NXcanSAS" /> + </enumeration> + </field> + + <!-- + ============================ + SASdata + ============================ + --> + + <group type="NXdata"> + <doc> + A *SASData* group contains reduced a single small-angle scattering data set + that can be represented as :math:`I(\vec{Q})` or :math:`I(|\vec{Q}|)`. + + .. figure:: canSAS/SASdata.png + :width: 60% + + The *SASdata* element + (:download:`full image <canSAS/SASdata.png>`) + + *Q* can be either a vector (:math:`\vec{Q}`) or a vector magnitude (:math:`|\vec{Q}|`) + + The name of each *SASdata* must be unique within a SASentry group. Such as ``sasdata01``. + + A *SASdata* group has several attributes: + + * I_axes + * Q_indices + * Mask_indices + + To indicate the dependency relationships of other varied parameters, + use attributes similar to ``@Mask_indices`` (such as ``@Temperature_indices`` + or ``@Pressure_indices``). + </doc> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SASdata`</doc> + <enumeration> + <item value="SASdata" /> + </enumeration> + </attribute> + <!-- attributes, see: http://www.cansas.org/formats/canSAS2012/1.0/doc/framework.html#terms --> + <attribute name="signal" type="NX_CHAR" > + <doc> + Name of the default data field. + </doc> + <enumeration> + <item value="I"><doc>For canSAS **SASdata**, this is always "I".</doc></item> + </enumeration> + </attribute> + <attribute name="I_axes"> + <doc> + String array that defines the independent data fields used in + the default plot for all of the dimensions of the *signal* field + (the *signal* field is the field in this group that is named by + the ``signal`` attribute of this group). + One entry is provided for every dimension of the ``I`` data object. + Such as:: + + @I_axes="Temperature", "Time", "Pressure", "Q", "Q" + + Since there are five items in the list, the intensity field of this example + ``I`` must be a five-dimensional array (rank=5). + </doc> + </attribute> + <attribute name="I_uncertainties"> + <doc> + Generally, this is the estimate of the uncertainty of each :math:`I`. + Typically the estimated standard deviation. + For Poisson statistics, use :math:`1/\sqrt{I}`. + + (optional for numerical arrays) + Name of the data object (in this SASdata group) that provides the + uncertainty to be used for data analysis. + + *Idev* is the canonical name from the 1D standard. + The multi-D standard allows for this name to be described in this attribute. + Such as:: + + @I_uncertainties="Idev" + + </doc> + </attribute> + + <attribute name="Q_indices" type="NX_INT"> + <doc> + Integer or integer array that describes which indices + (of the :math:`I` data object) are used to + reference the ``Q`` data object. The items in this array + use zero-based indexing. Such as:: + + @Q_indices=1,3,4 + + which indicates that ``Q`` requires three indices + from the :math:`I` data object: one for time and + two for Q position. Thus, in this example, the + ``Q`` data is time-dependent: :math:`\vec{Q}(t)`. + </doc> + </attribute> + <attribute name="Q_uncertainties"> + <doc> + (optional for numerical arrays) + Generally, this is the estimate of the uncertainty of each :math:`Q`. + Typically the estimated standard deviation. + Names the data object (in this SASdata group) that provides the + uncertainty to be used for data analysis. Such as:: + + @Q_uncertainties="Qdev" + + Can use this to describe the slit-length at each datum. + Use a subgroup to describe any supplementary uncertainty data. + + To specify two-dimensional uncertainty, such as (*dQw*, *dQl*), + use a string array, such as:: + + @Q_uncertainties="dQw", "dQl" + + </doc> + </attribute> + <attribute name="Mask_indices"> + <doc> + Integer or integer array that describes which indices + (of the :math:`I` data object) are used to + reference the ``Mask`` data object. The items in this + array use zero-based indexing. Such as:: + + @Mask_indices=3,4 + + which indicates that Q requires two indices + from the :math:`I` data object for Q position. + </doc> + </attribute> + + <field name="Q" type="NX_NUMBER" units="NX_PER_LENGTH"> + <!-- http://www.cansas.org/formats/canSAS2012/1.0/doc/basics.html#definition-of --> + <doc> + .. index:: NXcanSAS (contributed definition); Q + + Array of :math:`Q` data to accompany :math:`I`. + + .. figure:: canSAS/Q-geometry.jpg + :width: 60% + + The :math:`\vec{Q}` geometry. + (:download:`full image <canSAS/Q-geometry.jpg>`) + + :math:`Q` may be represented either + as the three-dimensional scattering vector :math:`\vec{Q}` + or by the magnitude of the scattering vector, :math:`|\vec{Q}|`. + + .. math:: |\vec{Q}| = (4\pi/\lambda) sin(\theta) + + When we write :math:`Q`, we may refer to either or both of + :math:`|\vec{Q}|` + or :math:`\vec{Q}`, depending on the context. + </doc> + </field> + <field name="I" type="NX_NUMBER"> + <!-- http://www.cansas.org/formats/canSAS2012/1.0/doc/basics.html#definition-of-intensity --> + <doc> + .. index:: NXcanSAS (contributed definition); I + + Array of intensity (:math:`I`) data. + + The intensity may be represented in one of these forms: + + **absolute units**: :math:`d\Sigma/d\Omega(Q)` + differential cross-section + per unit volume per unit solid angle (typical units: 1/cm/sr) + + **absolute units**: :math:`d\sigma/d\Omega(Q)` + differential cross-section + per unit atom per unit solid angle (typical units: cm^2) + + **arbitrary units**: :math:`I(Q)` + usually a ratio of two detectors + but units are meaningless (typical units: a.u.) + + This presents a few problems + for analysis software to sort out when reading the data. + Fortunately, it is possible to analyze the *units* to determine which type of + intensity is being reported and make choices at the time the file is read. But this is + an area for consideration and possible improvement. + + One problem arises with software that automatically converts data into some canonical + units used by that software. The software should not convert units between these different + types of intensity indiscriminately. + + A second problem is that when arbitrary units are used, then the set of possible + analytical results is restricted. With such units, no meaningful volume fraction + or number density can be determined directly from :math:`I(Q)`. + + In some cases, it is possible to apply a factor to convert the arbitrary + units to an absolute scale. This should be considered as a possibility + of the analysis process. + </doc> + </field> + + <field name="Idev" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (contributed definition); Idev + + Estimated uncertainty (usually standard deviation) + in :math:`I`. Must have the same units as :math:`I`. + + When present, the name of this field is also + recorded in the *uncertainties* attribute of *I*, as in:: + + I/@uncertainties="Idev" + + </doc> + </field> + + <field name="Qdev" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (contributed definition); Qdev + + Estimated uncertainty (usually standard deviation) + in :math:`Q`. Must have the same units as :math:`Q`. + + When present, the name of this field is also + recorded in the *uncertainties* attribute of *Q*, + as in:: + + Q/@uncertainties="Qdev" + + Q/@uncertainties="dQw", "dQl" + + </doc> + </field> + + <field name="dQw" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (contributed definition); dQw + + :math:`Q` resolution along the axis of scanning + (the high-resolution *slit width* direction). + Useful for defining resolution data from + slit-smearing instruments such as Bonse-Hart geometry. + Must have the same units as :math:`Q`. + + When present, the name of this field is also + recorded in the *uncertainties* attribute of *Q*, + as in:: + + Q/@uncertainties="dQw", "dQl" + + </doc> + </field> + + <field name="dQl" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (contributed definition); dQl + + :math:`Q` resolution perpendicular to the axis of scanning + (the low-resolution *slit length* direction). + Useful for defining resolution data from + slit-smearing instruments such as Bonse-Hart geometry. + Must have the same units as :math:`Q`. + + When present, the name of this field is also + recorded in the *uncertainties* attribute of *Q*, + as in:: + + Q/@uncertainties="dQw", "dQl" + + </doc> + </field> + + <field name="Qmean" minOccurs="0" units="NX_PER_LENGTH" type="NX_NUMBER"> + <doc> + Mean value of :math:`Q` for this data point. + Useful when describing data that has been + binned from higher-resolution data. + It is unexpected for ``Q`` and ``Qmean`` to have different units. + </doc> + </field> + <field name="ShadowFactor" minOccurs="0" units="NX_DIMENSIONLESS"> + <doc> + A numerical factor applied to pixels affected by the beam stop penumbra. + Used in data files from NIST/NCNR instruments. + + See: J.G. Barker and J.S. Pedersen (1995) *J. Appl. Cryst.* **28**, 105-114. + </doc> + </field> + + </group> + + <!-- optional items --> + <field name="title" minOccurs="1" maxOccurs="1"> + <doc> + Title of this *SASentry*. + </doc> + </field> + <field name="run" minOccurs="1" maxOccurs="unbounded" nameType="any"> + <doc> + Run identification for this *SASentry*. + For many facilities, this is an integer. + Use multiple instances of ``run`` as needed, keeping + in mind that HDF5 requires unique names for all entities + in a group. + </doc> + <attribute name="name"> + <doc> + Optional string attribute to identify this particular *run*. + Could use this to associate (correlate) multiple *SASdata* elements with *run* elements. + </doc> + </attribute> + </field> + + <group type="NXinstrument"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SASinstrument`</doc> + <enumeration> + <item value="SASinstrument" /> + </enumeration> + </attribute> + <doc> + This the SAS instrument. + + .. figure:: canSAS/SASinstrument.png + :width: 60% + + The *SASinstrument* element + (:download:`full image <canSAS/SASinstrument.png>`) + + </doc> + + <!-- + ============== + SAScollimation + ============== + --> + + <group type="NXcollimator" minOccurs="0"> <!-- TODO: confirm how SAScollimation maps onto NXcollimator --> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SAScollimation`</doc> + <enumeration> + <item value="SAScollimation" /> + </enumeration> + </attribute> + <doc> + Description of a collimating element in the instrument. + + .. figure:: canSAS/SAScollimation.png + :width: 60% + + The *SAScollimation* element + (:download:`full image <canSAS/SAScollimation.png>`) + + </doc> + + <field name="length" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Amount/length of collimation inserted (as on a SANS instrument)</doc> + </field> + + <group name="aperture" type="NXaperture" minOccurs="0"> + <doc> + Name of "aperture" is only a suggestion. + Base class could be either **NXpinhole** or **NXslit**. + But **NXaperture** is generic and limits the variation in data files. + </doc> + + <field name="shape"> + <doc> + describe the type of aperture (pinhole, 4-blade slit, Soller slit, ...) + </doc> + </field> + <field name="x_gap" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>opening along the :math:`x` axis</doc> + </field> + <field name="y_gap" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>opening along the :math:`y` axis</doc> + </field> + </group> + + <field name="distance" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Distance from this collimation element to the sample</doc> + </field> + + <!-- SAScollimation --> + </group> + + <!-- + ============================ + SASdetector + ============================ + --> + + <group type="NXdetector" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SASdetector`</doc> + <enumeration> + <item value="SASdetector" /> + </enumeration> + </attribute> + <doc> + Description of a detector in the instrument. + + .. figure:: canSAS/SASdetector.png + :width: 60% + + The *SASdetector* element + (:download:`full image <canSAS/SASdetector.png>`) + + </doc> + + <field name="name" maxOccurs="1"> + <doc>Identifies the name of this detector</doc> + </field> + <field name="SDD" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Distance between sample and detector. + + Note: In NXdetector, the ``distance`` field records the + distance to the previous component ... most often the sample. + This use is the same as ``SDD`` for most SAS + instruments but not all. For example, Bonse-Hart cameras + have one or more crystals between the sample and detector. + + We define here the field ``SDD`` to document without + ambiguity the distance between sample and detector. + </doc> + </field> + <field name="slit_length" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Slit length of the instrument for this detector, + expressed in the same units as :math:`Q`. + </doc> + </field> + + <field name="x_position" minOccurs="0" maxOccurs="1"> + <doc>Location of the detector in :math:`x`</doc> + </field> + <field name="y_position" minOccurs="0" maxOccurs="1"> + <doc>Location of the detector in :math:`y`</doc> + </field> + <field name="polar_angle" minOccurs="0" maxOccurs="1"> + <doc>Rotation of the detector about the :math:`z` axis (roll)</doc> + </field> + <field name="azimuthal_angle" minOccurs="0" maxOccurs="1"> + <doc>Rotation of the detector about the :math:`y` axis (yaw)</doc> + </field> + + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Position of the beam center on the detector. + + This is the x position where the direct beam would hit the detector plane. + This is a length, not a pixel position, and can be outside of the actual + detector. + </doc> + </field> + + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Position of the beam center on the detector. + + This is the y position where the direct beam would hit the detector plane. + This is a length, not a pixel position, and can be outside of the actual + detector. + </doc> + </field> + + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of each detector pixel. If it is scalar all pixels are the same size</doc> + </field> + + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of each detector pixel. If it is scalar all pixels are the same size</doc> + </field> + + <!-- SASdetector --> + </group> + + <!-- + ============================ + SASsource + ============================ + --> + + <group type="NXsource" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SASsource`</doc> + <enumeration> + <item value="SASsource" /> + </enumeration> + </attribute> + <doc> + Description of the radiation source. + + .. figure:: canSAS/SASsource.png + :width: 60% + + The *SASsource* element + (:download:`full image <canSAS/SASsource.png>`) + + </doc> + + <field name="radiation" maxOccurs="1"> + <doc> + Name of the radiation used. + Note that this is **not** the name of the facility! + </doc> + <enumeration> + <!-- enumeration values from NXsource/type and NXsource/probe --> + <item value="Spallation Neutron Source" /> + <item value="Pulsed Reactor Neutron Source" /> + <item value="Reactor Neutron Source" /> + <item value="Synchrotron X-ray Source" /> + <item value="Pulsed Muon Source" /> + <item value="Rotating Anode X-ray" /> + <item value="Fixed Tube X-ray" /> + <item value="UV Laser" /> + <item value="Free-Electron Laser" /> + <item value="Optical Laser" /> + <item value="Ion Source" /> + <item value="UV Plasma Source" /> + <item value="neutron" /> + <item value="x-ray" /> + <item value="muon" /> + <item value="electron" /> + <item value="ultraviolet" /> + <item value="visible light" /> + <item value="positron" /> + <item value="proton" /> + </enumeration> + </field> + <field name="beam_shape" minOccurs="0" maxOccurs="1"> + <doc>Text description of the shape of the beam (incident on the sample).</doc> + </field> + <field name="incident_wavelength" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc>wavelength (:math:`\lambda`) of radiation incident on the sample</doc> + </field> + <field name="wavelength_min" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Some facilities specify wavelength using a range. + This is the lowest wavelength in such a range. + </doc> + </field> + <field name="wavelength_max" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Some facilities specify wavelength using a range. + This is the highest wavelength in such a range. + </doc> + </field> + <field name="incident_wavelength_spread" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Some facilities specify wavelength using a range. + This is the width (FWHM) of such a range. + </doc> + </field> + <field name="beam_size_x" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of the incident beam along the x axis.</doc> + </field> + <field name="beam_size_y" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of the incident beam along the y axis.</doc> + </field> + + <!-- SASsource --> + </group> + + <!-- SASinstrument --> + </group> + + <!-- + ============== + SASsample + ============== + --> + + <group type="NXsample"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SASsample`</doc> + <enumeration> + <item value="SASsample" /> + </enumeration> + </attribute> + <doc> + Description of the sample. + + .. figure:: canSAS/SASsample.png + :width: 60% + + The *SASsample* element + (:download:`full image <canSAS/SASsample.png>`) + + </doc> + + <field name="name" maxOccurs="1"> + <doc>**ID**: Text string that identifies this sample.</doc> + </field> + <field name="thickness" type="NX_FLOAT" minOccurs="0" maxOccurs="1" units="NX_LENGTH"> + <doc>Thickness of this sample</doc> + </field> + <field name="transmission" type="NX_NUMBER" minOccurs="0" maxOccurs="1" units="NX_DIMENSIONLESS"> + <doc> + Transmission (:math:`I/I_0`) of this sample. + Note that there is no *units* attribute as this number is dimensionless. + </doc> + </field> + <field name="temperature" type="NX_NUMBER" minOccurs="0" maxOccurs="1" units="NX_TEMPERATURE"> + <doc>Temperature of this sample.</doc> + </field> + <field name="details" minOccurs="0" maxOccurs="unbounded" nameType="any"> + <doc>Any additional sample details.</doc> + </field> + + <!-- canSAS1d "SASsample/position" group: NXtranslation is deprecated --> + <field name="x_position" minOccurs="0" maxOccurs="1"> + <doc>Location of the sample in :math:`x`</doc> + </field> + <field name="y_position" minOccurs="0" maxOccurs="1"> + <doc>Location of the sample in :math:`y`</doc> + </field> + <!-- canSAS1d "SASsample/orientation" group: NXorientation is deprecated + + SASsample/orientation group rotation names mapped into NeXus + + ========= ============================== + canSAS1d NeXus + ========= ============================== + roll polar_angle + pitch x_axis_rotation (not expected or defined here) + yaw azimuthal_angle + ========= ============================== + --> + <field name="polar_angle" minOccurs="0" maxOccurs="1"> + <doc>Rotation of the sample about the :math:`z` axis (roll)</doc> + </field> + <field name="azimuthal_angle" minOccurs="0" maxOccurs="1"> + <doc>Rotation of the sample about the :math:`y` axis (yaw)</doc> + </field> + + <!-- NXsample --> + </group> + + + <!-- + ============== + SASprocess + ============== + --> + + <group type="NXprocess" minOccurs="0" maxOccurs="unbounded"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SASprocess`</doc> + <enumeration> + <item value="SASprocess" /> + </enumeration> + </attribute> + <doc> + Description of a processing or analysis step. + + .. figure:: canSAS/SASprocess.png + :width: 60% + + The *SASprocess* element + (:download:`full image <canSAS/SASprocess.png>`) + + Add additional fields as needed to describe value(s) of any + variable, parameter, or term related to the *SASprocess* step. + Be sure to include *units* attributes for all numerical fields. + </doc> + + <field name="name" minOccurs="0" maxOccurs="1"> + <doc>Optional name for this data processing or analysis step</doc> + </field> + <field name="date" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"> + <doc> + Optional date for this data processing or analysis step. [#iso8601]_ + + + .. [#iso8601] ISO-8601 standard time representation. + + NeXus dates and times are reported in ISO-8601 + (e.g., ``yyyy-mm-ddThh:mm:ss``) + or modified ISO-8601 (e.g., ``yyyy-mm-dd hh:mm:ss``). + + See: http://www.w3.org/TR/NOTE-datetime + or http://en.wikipedia.org/wiki/ISO_8601 for more details. + </doc> + </field> + <field name="description" minOccurs="0" maxOccurs="1"> + <doc>Optional description for this data processing or analysis step</doc> + </field> + <field name="term" minOccurs="0" maxOccurs="unbounded" nameType="any"> + <doc> + Specifies the value of a single variable, parameter, + or term (while defined here as a string, it could be a number) + related to the *SASprocess* step. + + Note: + The name *term* is not required, it could take any name, + as long as the name is unique within this group. + </doc> + </field> + + <!-- + suggested at NIAC2014 + Isn't this ALWAYS a possibility in any NeXus base class? + Not needed to define this but it is a good suggestion for usage. + --> + <group type="NXnote" minOccurs="0" maxOccurs="unbounded"> + <doc> + Any additional notes or subprocessing steps will be documented here. + + An **NXnote** group can be added to any NeXus group at or below the + **NXentry** group. It is shown here as a suggestion of a good place + to *consider* its use. + </doc> + </group> + + <group name="sasprocessnote" type="NXcollection" minOccurs="0" maxOccurs="unbounded"> + <doc> + Describes anything about *SASprocess* that is not already described. + + Any content not defined in the canSAS standard can be placed at this point. + + Note: + The name *sasprocessnote* is not required, it could take any name, + as long as the name is unique within the **NXprocess** group. + </doc> + <attribute name="canSAS_class"> + <doc> + Official canSAS group: :index:`NXcanSAS (contributed definition); SASprocessnote` + </doc> + <enumeration> + <item value="SASprocessnote" /> + </enumeration> + </attribute> + <!-- SASprocessnote --> + </group> + + <!-- SASprocess --> + </group> + + <!-- + ============== + SASnote + ============== + --> + + <group type="NXcollection" minOccurs="0" maxOccurs="unbounded"> + <attribute name="canSAS_class"> + <doc> + Official canSAS group: :index:`NXcanSAS (contributed definition); SASnote` + </doc> + <enumeration> + <item value="SASnote" /> + </enumeration> + </attribute> + <doc> + Free form description of anything not covered by other elements. + </doc> + </group> + + <!-- + ============================ + SAStransmission_spectrum + ============================ + --> + + <group type="NXdata" minOccurs="0"> + <doc> + The *SAStransmission_spectrum* element + + This describes certain data obtained from a variable-wavelength source + such as pulsed-neutron source. + <!-- requested to be in the 1D format by ISIS --> + + .. figure:: canSAS/SAStransmission_spectrum.png + :width: 60% + + The *SAStransmission_spectrum* element + (:download:`full image <canSAS/SAStransmission_spectrum.png>`) + + </doc> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (contributed definition); SAStransmission_spectrum`</doc> + <enumeration> + <item value="SAStransmission_spectrum" /> + </enumeration> + </attribute> + <attribute name="signal" type="NX_CHAR" > + <doc> + Name of the default data field. + </doc> + <enumeration> + <item value="T"><doc>For **SAStransmission_spectrum**, this is always "T".</doc></item> + </enumeration> + </attribute> + <attribute name="T_axes"> + <enumeration> + <item value="T"> + <doc>the wavelengths field (as a dimension scale) corresponding to this transmission</doc> + </item> + </enumeration> + </attribute> + <attribute name="T_uncertainties"> + <doc>Estimate of the uncertainty of each transmission :math:`T`.</doc> + </attribute> + <attribute name="name"> + <doc> + Identify what type of spectrum is being described. + It is expected that this value will take either of these two values: + + ====== ============================================== + value meaning + ====== ============================================== + sample measurement with the sample and container + can measurement with just the container + ====== ============================================== + </doc> + </attribute> + <attribute name="timestamp" type="NX_DATE_TIME"> + <doc> + ISO-8601 time [#iso8601]_ + </doc> + </attribute> + + <field name="lambda" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc>Wavelength of the radiation.</doc> + </field> + <field name="T" type="NX_NUMBER" units="NX_DIMENSIONLESS"> + <doc>Transmission value (:math:`I/I_0`)</doc> + </field> + + <field name="Tdev" type="NX_NUMBER" units="NX_PER_LENGTH" > + <doc> + .. index:: NXcanSAS (contributed definition); Tdev + + Estimated uncertainty (usually standard deviation) + in :math:`T`. Must have the same units as :math:`T`. + + When present, the name of this field is also + recorded in the *uncertainties* attribute of *T*, as in:: + + T/@uncertainties="Tdev" + + </doc> + </field> + </group> + + <!-- NXsubentry --> + </group> + +</definition> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXcontainer.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXcontainer.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b6c7fd93c8d75f29e130cf7f305be7f0d58dcff2 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXcontainer.nxdl.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcontainer" + category="contributed" + version="1.0" + type="group" + extends="NXobject" + > + + <doc> + State of a container holding the sample under investigation. + + A container is any object in the beam path which absorbs the beam and + whose contribution to the overall attenuation/scattering needs to be + determined to process the experimental data. Examples of containers + include glass capillary tubes, vanadium cans, windows in furnaces or + diamonds in a Diamond Anvil Cell. The following figures show a complex + example of a container: + + .. figure:: container/ComplexExampleContainer.png + + A hypothetical capillary furnace. The beam passes from left to right + (blue dashes), passing through window 1, then window 2, before + passing through the downstream wall of the capillary. It is then + scattered by the sample with scattered beams passing through the + upstream wall of the capillary, then windows 4 and 5. As part of the + corrections for a PDF experiment it is necessary to subtract the PDF + of the empty container (i.e. each of the windows and the capillary). + To calculate the PDF of the empty container it is necessary to have + the measured scattering data and to know the nature (e.g. density, + elemental composition, etc.) of the portion of the container which + the beam passed through. + + .. figure:: container/ComplexContainerBeampath.png + + A complete description of the shapes of the container elements with + their orientation relative to the beam and also information on + whether they are upstream or downstream of the sample is also + therefore important. For example, although the windows 2 and 4 have + the same shape, the path taken through them by the beam is very + different and this needs to be modelled. Furthermore, it is not + inconceivable that windows might move during an experiment and thus + the changes to the beampath would need to be accounted for. + + This class encodes the position of the container with respect to the + sample and allows the calculation of the beampath through the container. + It also includes sufficient data to model beam absorption of the + container and a link to a dataset containing a measurement of the + container with nothing inside, to allow data corrections (at a specific + beam energy/measurement time) to be made. + </doc> + <field name="name"> + <doc> + Descriptive name of container. + </doc> + </field> + <field name="description"> + <doc> + Verbose description of container and how it fits into the wider + experimental set up. + </doc> + </field> + <field name="chemical_formula"> + <doc> + Chemical composition of the material the container is made from. + Specified using CIF conventions. Abbreviated version of CIF + standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of + '1' may be omitted. + * A space or parenthesis must separate each cluster of (element + symbol + count). + * Where a group of elements is enclosed in parentheses, the + multiplier for the group must follow the closing parentheses. + That is, all element and group multipliers are assumed to be + printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to + their chemical structure, the order of the elements within any + group or moiety depends on whether or not carbon is present. + * If carbon is present, the order should be: + + - C, then H, then the other elements in alphabetical order of + their symbol. + - If carbon is not present, the elements are listed purely in + alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc> + Density of the material the container is made from. + </doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="packing_fraction" type="NX_FLOAT" units="NX_UNITLESS"> + <doc> + Fraction of the volume of the container occupied by the material + forming the container. + </doc> + <dimensions> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="relative_molecular_mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Relative molecular mass of container.</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <group name="beam" type="NXbeam"> + <doc> + Details of beam incident on container, including the position + relative to the sample (to determine whether the container is + upstream or downstream of the sample). + </doc> + </group> + <group name="shape" type="NXshape"> + <doc> + Shape of the container. In combination with orientation this + should allow the beampath through the container to be modelled to + allow the adsorption to be calculated. + </doc> + </group> + <group name="orientation" type="NXtransformations"> + <doc> + The angle the container makes to the beam and how it may change + during the experiment.In combination with shape this should allow + the beampath through the container to be modelled to allow the + adsorption of the container to be calculated. + </doc> + </group> + <link name="reference_measurement" target="/NXentry"> + <doc> + A link to a full data collection which contains the actual + measured data for this container within the experimental set up + (with no sample or inner container(s)). This data set will also + include the wavelength/energy, measurement time and intensity for + which these data are valid. + </doc> + </link> +</definition> + diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXelectrostatic_kicker.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXelectrostatic_kicker.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1a020f4b3b6a1cb64d08d5021aa75551deb6069f --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXelectrostatic_kicker.nxdl.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXelectrostatic_kicker" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0" + > +<doc>definition for a electrostatic kicker.</doc> +<field name="description" type="NX_CHAR"> +<doc>extended description of the kicker.</doc> +</field> +<field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> +<doc>define position of beamline element relative to production target</doc> +</field> +<field name="timing" type="NX_FLOAT" units="NX_TIME" + minOccurs="0" maxOccurs="1"> +<doc>kicker timing as defined by ``description`` attribute</doc> +<attribute name="description" type="NX_CHAR" /> +</field> +<field name="set_current" type="NX_FLOAT" units="NX_CURRENT" + minOccurs="0" maxOccurs="1"> +<doc>current set on supply.</doc> +</field> +<group name="read_current" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT"></field> +</group> +<field name="set_voltage" type="NX_FLOAT" units="NX_VOLTAGE" + minOccurs="0" maxOccurs="1"> +<doc>volage set on supply.</doc> +</field> +<group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE"></field> +</group> +</definition> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXmagnetic_kicker.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXmagnetic_kicker.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..7e715db53c990c6b1d3a882231ebad7e28c9f6ad --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXmagnetic_kicker.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXmagnetic_kicker" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0" + > + <doc>definition for a magnetic kicker.</doc> + <field name="description" type="NX_CHAR"> + <doc>extended description of the kicker.</doc> + </field> + <field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> + <doc>define position of beamline element relative to production target</doc> + </field> + <field name="timing" type="NX_FLOAT" units="NX_TIME" minOccurs="0" maxOccurs="1"> + <doc>kicker timing as defined by ``description`` attribute</doc> + <attribute name="description" type="NX_CHAR"/> + </field> + <field name="set_current" type="NX_FLOAT" units="NX_CURRENT" minOccurs="0" maxOccurs="1"> + <doc>current set on supply.</doc> + </field> + <group name="read_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT" /> + </group> + <field name="set_voltage" type="NX_FLOAT" units="NX_VOLTAGE" + minOccurs="0" maxOccurs="1" > + <doc>voltage set on supply.</doc> + </field> + <group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> + <doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE" /> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXquadrupole_magnet.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXquadrupole_magnet.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd347823ea93db6bf87059b1fd42b22f2530b9d0 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXquadrupole_magnet.nxdl.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXquadrupole_magnet" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0" + > + <doc>definition for a quadrupole magnet.</doc> +<field name="description" type="NX_CHAR"> +<doc>extended description of the magnet.</doc> +</field> +<field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> +<doc>define position of beamline element relative to production target</doc> +</field> +<field name="set_current" type="NX_FLOAT" units="NX_CURRENT" + minOccurs="0" maxOccurs="1"> +<doc>current set on supply.</doc> +</field> +<group name="read_current" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT" /> +</group> +<group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE" /> +</group> +</definition> diff --git a/src/punx/cache/v3.2/contributed_definitions/NXreflections.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXreflections.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXreflections.nxdl.xml rename to src/punx/cache/a4fd52d/contributed_definitions/NXreflections.nxdl.xml diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXseparator.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXseparator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c8400f9d242648302414042d1fbbbb2099a66a63 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXseparator.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXseparator" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" version="1.0" + > + <doc>definition for an electrostatic separator.</doc> + <field name="description" type="NX_CHAR"> + <doc>extended description of the separator.</doc> + </field> + <field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>define position of beamline element relative to production target</doc> + </field> + <field name="set_Bfield_current" type="NX_FLOAT" units="NX_CURRENT" minOccurs="0" maxOccurs="1"> + <doc>current set on magnet supply.</doc> + </field> + <group name="read_Bfield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from magnet supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Bfield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from magnet supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> + <field name="set_Efield_voltage" type="NX_FLOAT" units="NX_VOLTAGE" minOccurs="0" maxOccurs="1"> + <doc>current set on HT supply.</doc> + </field> + <group name="read_Efield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from HT supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Efield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from HT supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> +</definition> diff --git a/src/punx/cache/v3.2/contributed_definitions/NXsnsevent.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXsnsevent.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXsnsevent.nxdl.xml rename to src/punx/cache/a4fd52d/contributed_definitions/NXsnsevent.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXsnshisto.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXsnshisto.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXsnshisto.nxdl.xml rename to src/punx/cache/a4fd52d/contributed_definitions/NXsnshisto.nxdl.xml diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXsolenoid_magnet.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXsolenoid_magnet.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..7cd531fb911281a1dbe52621e3885d758bb26d0e --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXsolenoid_magnet.nxdl.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXsolenoid_magnet" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0" + > +<doc>definition for a solenoid magnet.</doc> +<field name="description" type="NX_CHAR"> +<doc>extended description of the magnet.</doc> +</field> +<field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> +<doc>define position of beamline element relative to production target</doc> +</field> +<field name="set_current" type="NX_FLOAT" units="NX_CURRENT" + minOccurs="0" maxOccurs="1"> +<doc>current set on supply.</doc> +</field> +<group name="read_current" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT" /> +</group> +<group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE" /> +</group> +</definition> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXspecdata.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXspecdata.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..35ea02799e75ab7ffaaf264b53cb8367bd2ce320 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXspecdata.nxdl.xml @@ -0,0 +1,461 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2012-2016 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> + +<definition name="NXspecdata" extends="NXobject" type="group" + version="1.0" + category="contributed" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Data collected by SPEC control and data acquisition software + + SPEC [#]_ is software for instrument control + and data acquisition in X-ray diffraction experiments. + + .. [#] SPEC: https://certif.com + </doc> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXentry` group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXentry` group exists. + The value is the name of the default :ref:`NXentry` group. + </doc> + </attribute> + <attribute name="HDF5_Version" optional="false"> + <doc> + Version of HDF5 library used in writing the file (as specified in :ref:`NXroot`). + + Note this attribute is spelled with uppercase "V", + different than other version attributes. + </doc> + </attribute> + <attribute name="h5py_version" optional="true"> + <doc> + version of h5py Python package used to write this HDF5 file + </doc> + </attribute> + <attribute name="SPEC_file" optional="true"> + <doc> + original SPEC data file name from **#F** line in file header + </doc> + </attribute> + <attribute name="SPEC_date" optional="true"> + <doc> + date from **#D** line in file header, in ISO8601 format + </doc> + </attribute> + <attribute name="SPEC_epoch" type="NX_INT"> + <doc> + UNIX time epoch from **#E** line in file header + </doc> + </attribute> + <!-- + place SPEC_user into NXentry/NXuser group + <attribute name="SPEC_user"> + <doc> + user name from first **#C** line in file header + </doc> + </attribute> + --> + <attribute name="SPEC_comments" optional="true"> + <doc> + any **#C** lines in file header, stored as one string with newlines between comments + </doc> + </attribute> + <attribute name="SPEC_num_headers" type="NX_INT" optional="true"> + <doc> + Number of header sections found in the spec file + </doc> + </attribute> + + <group type="NXentry"> + <doc> + one scan from a SPEC data file, starts with a **#S** line + </doc> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + </doc> + </attribute> + + <field name="definition"> + <doc>Official NeXus NXDL schema to which this subentry conforms.</doc> + <enumeration> + <item value="NXspecdata" /> + </enumeration> + </field> + + <field name="scan_number" type="NX_NUMBER"> + <doc> + SPEC scan number + </doc> + </field> + + <field name="title"> + <doc> + SPEC scan number and command, from **#S** line + + SPEC data file line:: + + #S 1 cscan en 690 750 60 0 + + *title*:: + + 1 cscan en 690 750 60 0 + + </doc> + </field> + + <field name="command"> + <doc> + SPEC scan command, from **#S** line, after the scan number. + + :SPEC data file line: ``#S 1 cscan en 690 750 60 0`` + + :command*: ``cscan en 690 750 60 0`` + </doc> + </field> + + <field name="date" type="NX_DATE_TIME"> + <doc> + date from **#D** line in scan header, in ISO8601 format + </doc> + </field> + + <group type="NXmonitor"> + <attribute name="description" /> + + <field name="mode"> + <doc> + Count to a preset value based on either clock time + (timer) or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + + <field name="preset" type="NX_NUMBER"> + <doc> + preset value for time or monitor + + * **#M** -- counting against this constant monitor count (see #T) + * **#T** -- counting against this constant number of seconds (see #M) + </doc> + <attribute name="units" /> + </field> + + <field name="data" type="NX_NUMBER" nameType="any"> + <doc> + array(s) of monitor data + </doc> + </field> + + <field name="count_time" type="NX_NUMBER" nameType="any"> + <doc> + array(s) of monitor data + </doc> + </field> + </group> + + <!-- moved to NXmonitor + <field name="counting_basis"> + <doc> + describes if counts are referenced to time or a detector + </doc> + </field> + + <field name="M" type="NX_NUMBER"> + <doc> + **#M** - - counting against this constant monitor count (see #T) + </doc> + </field> + + <field name="T" type="NX_NUMBER"> + <doc> + **#T** - - counting against this constant number of seconds (see #M) + </doc> + </field> + --> + + <field name="comments"> + <doc> + Any **#C** lines in this scan, stored as one string with newlines between comments + </doc> + </field> + + <field name="Q" type="NX_NUMBER"> + <doc> + **#Q** -- :math:`Q` (:math:`hkl`) at start of scan + + array of [:math:`h` :math:`k` :math:`l`] + </doc> + </field> + + <field name="TEMP_SP" type="NX_NUMBER"> + <doc> + **#X** -- temperature set point + </doc> + </field> + + <field name="DEGC_SP" type="NX_NUMBER"> + <doc> + **#X** -- temperature set point (C) + </doc> + </field> + + + <group name="data" type="NXdata"> + <doc> + detector (and MCA) data from this scan + </doc> + <attribute name="description" /> + <attribute name="signal"> + <doc> + name of the field with the plottable data, typically the last column for 1-D scans + + This is the primary dependent axis, such as two-theta detector. + This field must exist (or be linked) in this :ref:`NXdata` group. + </doc> + </attribute> + <attribute name="axes"> + <doc> + name(s) of the field(s) for plotting the data, typically the first column for 1-D scans + + These are the independent axes, such as positioners. For 2-D or higher + dimension data, there will be a field named for each dimension, + separated by ":" (preferred) or "," or " " (whitespace). + + Such as for 2-D data plotted against *energy* and *th*:: + + @axes = energy:th + + This(these) field(s) must exist (or be linked) in this :ref:`NXdata` group. + </doc> + </attribute> + <attribute name="AXISNAME_indices" type="NX_NUMBER"> + <doc> + For each field named in *@axes*, there will be an instance of this attribute, + defining into which dimensions of the *@signal* data this field applies. + The value of this attribute is a list of index numbers using 0-based indexing + (first dimension is 0, seconds i 1, ...). + + Such as for 2-D data plotted against *energy* and *th*:: + + @energy_indices = [0] + @th_indices = [1] + + </doc> + </attribute> + + <!-- scan data --> + <field name="data" nameType="any" type="NX_NUMBER"> + <doc> + one column of data from the scan + + HDF5 requires that each member of a group must have a unique name. + + Pick the name of column from **#L** but make it unique which means if the same + name is used in more than one column, append a number to the extra instances + to make them unique yet preserve their content, just in case they might be different. + + Example: ``seconds seconds`` becomes ``seconds`` and ``seconda_1``. + </doc> + <attribute name="spec_name"> + <doc> + name as specified in **#L** line, before it was made unique for HDF5 + </doc> + </attribute> + <attribute name="units"> + <doc> + Unless stated otherwise, units (not declared in the SPEC data file) + are assumed to be *counts* for detectors and "unknown" for + positioners or other scan columns. + </doc> + </attribute> + </field> + + <!-- scaling factor defined in SPEC --> + <field name="intensity_factor" type="NX_NUMBER"> + <doc> + **#I** -- intensity normalizing factor + </doc> + </field> + + <!-- MCA (multi-channel analyzer) spectra --> + <field name="_mca_" type="NX_NUMBER" /> + <field name="_mca_channel_" type="NX_NUMBER" /> + <field name="_mca1_" type="NX_NUMBER" /> + <field name="_mca1_channel_" type="NX_NUMBER" /> + </group> + + + <group name="counter_cross_reference" type="NXnote"> + <doc> + associates values declared in **#J** and **#j** scan header lines + </doc> + <attribute name="comment" /> + <attribute name="description" /> + </group> + + + <group name="positioner_cross_reference" type="NXnote"> + <doc> + associates values declared in **#O** and **#o** scan header lines + </doc> + <attribute name="comment" /> + <attribute name="description" /> + </group> + + + <group name="spec" type="NXinstrument"> + <doc> + various metadata from the SPEC scan header that have well-known NeXus base clases + </doc> + + <group name="UB" type="NXcrystal"> + <doc> + Orientation matrix of single crystal sample using Busing-Levy convention + </doc> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + **#G3** line in scan header + </doc> + <dimensions rank="2"><!--3,3--> + <dim index="1" value="3"/> + <dim index="2" value="3"/> + </dimensions> + </field> + </group> + + </group> + + + <group name="G" type="NXnote"> + <doc> + SPEC geometry variables for this diffractometer geometry (instrument specific) + + TODO: give interpreted name for each array value (need to figure out how to get the names) + </doc> + <attribute name="comment" /> + <attribute name="description" /> + <field name="G0" type="NX_NUMBER"><doc>geometry parameters from G[] array (geo mode, sector, etc)</doc></field> + <field name="G1" type="NX_NUMBER"><doc>geometry parameters from U[] array (lattice constants, orientation reflections)</doc></field> + <field name="G2" type="NX_NUMBER"><doc>not used, although some files has a single zero value</doc></field> + <!-- G3 data placed into /NXentry/NXinstrument/NXcrystal/orientation_matrix --> + <field name="G4" type="NX_NUMBER"><doc>geometry parameters from Q[] array (lambda, frozen angles, cut points, etc)</doc></field> + </group> + + + <group name="positioners" type="NXnote"> <!-- TODO: consider as NXpositioner --> + <doc> + names and values of all positioners (**#O** and **#P** lines) in scan header + </doc> + <attribute name="description" /> + <field name="positioner" nameType="any" type="NX_NUMBER"> + <doc> + one positioner from the scan header + + HDF5 requires that each member of a group must have a unique name. + + SPEC assigns a unique name to each positioner, no extra work is neccesary + to comply with the HDF5 rule for unique names in a group. + </doc> + </field> + </group> + + + <group name="MCA" type="NXnote"> <!-- TODO: change to NXdetector --> + <doc> + **#@CALIB** -- coefficients to compute a scale based on the MCA channel number + </doc> + <attribute name="description" /> + <field name="preset_time" type="NX_NUMBER" /> + <field name="elapsed_live_time" type="NX_NUMBER" /> + <field name="elapsed_real_time" type="NX_NUMBER" /> + <field name="number_saved" type="NX_NUMBER" /> + <field name="first_saved" type="NX_INT" /> + <field name="last_saved" type="NX_INT" /> + <field name="reduction_coef" type="NX_NUMBER" /> + <field name="calib_a" type="NX_NUMBER" /> + <field name="calib_b" type="NX_NUMBER" /> + <field name="calib_c" type="NX_NUMBER" /> + <group name="ROI" type="NXnote"> + <field name="roiN"> + <doc> + numbered regions of interest, use an index number as part of the name + </doc> + <attribute name="description"><doc>``first_channel, last_channel``</doc></attribute> + <attribute name="first_channel" type="NX_INT" /> + <attribute name="last_channel" type="NX_INT" /> + </field> + </group> + </group> + + + <group name="metadata" type="NXnote"> + <doc> + SPEC metadata (UNICAT-style #H and #V lines) + + This is a block that may be unique to SPEC files acquired at certain + APS beam lines. Other facilities or instruments may use this block + for storing key:value pairs of data where the values have suitable + attributes (such as units). + </doc> + <attribute name="description" /> + </group> + + + <group name="SPEC_user" type="NXuser"> + <field name="SPEC_user"> + <doc> + user name from first **#C** line in file header + </doc> + </field> + </group> + + + <group name="_unrecognized" type="NXnote"> + <doc> + Fallback for any SPEC data file control lines not otherwise placed + into groups or fields elsewhere in this specification. + </doc> + <attribute name="comment" /> + <attribute name="description" /> + </group> + + </group> + +</definition> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/NXspin_rotator.nxdl.xml b/src/punx/cache/a4fd52d/contributed_definitions/NXspin_rotator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..73332404807f98ca1b06d4b9e2b1cb9551253952 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/NXspin_rotator.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXspin_rotator" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" version="1.0" + > + <doc>definition for a spin rotator.</doc> + <field name="description" type="NX_CHAR"> + <doc>extended description of the spin rotator.</doc> + </field> + <field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>define position of beamline element relative to production target</doc> + </field> + <field name="set_Bfield_current" type="NX_FLOAT" units="NX_CURRENT" minOccurs="0" maxOccurs="1"> + <doc>current set on magnet supply.</doc> + </field> + <group name="read_Bfield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from magnet supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Bfield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from magnet supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> + <field name="set_Efield_voltage" type="NX_FLOAT" units="NX_VOLTAGE" minOccurs="0" maxOccurs="1"> + <doc>current set on HT supply.</doc> + </field> + <group name="read_Efield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from HT supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Efield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from HT supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> +</definition> diff --git a/src/punx/cache/a4fd52d/contributed_definitions/nxdlformat.xsl b/src/punx/cache/a4fd52d/contributed_definitions/nxdlformat.xsl new file mode 100644 index 0000000000000000000000000000000000000000..b9ee01035628514ad28c26c801160a92ca26c625 --- /dev/null +++ b/src/punx/cache/a4fd52d/contributed_definitions/nxdlformat.xsl @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Stylesheet to provide a condensed view of a NeXus NXDL specification. +(see https://github.com/nexusformat/definitions/issues/181) + +The nxdlformat.xsl stylesheets differ between the directories +because of the rule regarding either /definition/NXentry or +/definition/NXsubentry for application and contributed definitions. +(see https://github.com/nexusformat/definitions/issues/179) + +Modify <xsl:template match="nx:definition">...</xsl:template> +for each directory. + +line breaks are VERY TRICKY here, be careful how you edit! +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" version="1.0"> + + <xsl:output method="text"/> + <xsl:variable name="indent_step" select="' '"/> + + + <xsl:template match="/"> + <xsl:apply-templates select="nx:definition"/> + </xsl:template> + + + <!-- + Modify ONLY this section for each directory: + base_classes/nxdlformat.xsl no rule for NXentry or NXsubentry + applications/nxdlformat.xsl required rule for NXentry or NXsubentry + contributed_definitions/nxdlformat.xsl optional rule for NXentry or NXsubentry + --> + <xsl:template match="nx:definition"> + <xsl:call-template name="showClassName"/> + <xsl:choose> + <xsl:when test="count(nx:group[@type='NXentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:when test="count(nx:group[@type='NXsubentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXsubentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:otherwise><!-- optional rule for NXentry or NXsubentry + --> (base class definition, NXentry or NXsubentry not found)<!-- + --><xsl:text><!-- tricky line break here --> +</xsl:text><xsl:call-template name="startFieldsGroups"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + <!-- +++ From this point on, the code is the same for, +++ --> + <!-- +++ base_classes applications/, and contributed/ +++ --> + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + + <xsl:template match="nx:field"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/>:<xsl:choose> + <xsl:when test="count(@type)"><xsl:value-of select="@type" + /><xsl:apply-templates select="nx:dimensions" + ><xsl:sort select="@name"/></xsl:apply-templates></xsl:when> + <xsl:otherwise>NX_CHAR</xsl:otherwise> + </xsl:choose> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template match="nx:dimensions"><!-- + -->[<xsl:apply-templates select="nx:dim"/>]<!-- + --></xsl:template> + + + <xsl:template match="nx:dim"> + <xsl:choose> + <xsl:when test="position()=1"><xsl:value-of select="@value"/></xsl:when> + <xsl:otherwise>,<xsl:value-of select="@value"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="nx:link"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/><xsl:text + > --> </xsl:text><xsl:value-of select="@target"/><xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:attribute"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/>@<xsl:value-of select="@name"/> + <xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:group"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:if test="count(@name)"><xsl:value-of select="@name"/>:</xsl:if> + <xsl:value-of select="@type"/> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template name="startFieldsGroups"> + <xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:choose> + <!-- Two ways to render. + 1=1: write fields, links, then groups, each sorted alphabetically + 1!=1: order of appearance in NXDL + --> + <xsl:when test="1=1"><!-- write fields, links, then groups --> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise><!-- write in order of appearance in NXDL --> + <xsl:apply-templates select="nx:field|nx:link|nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="showClassName"> + <xsl:value-of select="@name"/> (<xsl:choose> + <xsl:when test="@category='base'">base class</xsl:when> + <xsl:when test="@category='application'">application definition</xsl:when> + <xsl:when test="@category='contributed'">contributed definition</xsl:when> + </xsl:choose><xsl:if test="count(@version)">, version <xsl:value-of + select="@version"/></xsl:if>)<xsl:text><!-- tricky line break here --> +</xsl:text></xsl:template> + +</xsl:stylesheet> + +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> diff --git a/src/punx/cache/v3.2/nxdl.xsd b/src/punx/cache/a4fd52d/nxdl.xsd similarity index 98% rename from src/punx/cache/v3.2/nxdl.xsd rename to src/punx/cache/a4fd52d/nxdl.xsd index 4c2d04cfedbee5b3f555dd89a4f2571f4effed53..4d14454534dec766349cfbe95eb1a16c2bb339ca 100644 --- a/src/punx/cache/v3.2/nxdl.xsd +++ b/src/punx/cache/a4fd52d/nxdl.xsd @@ -10,7 +10,7 @@ .. NeXus - Neutron and X-ray Common Data Format - Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) + Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) This library is free software; you can redistribute it and/osr modify it under the terms of the GNU Lesser General Public @@ -705,7 +705,7 @@ <xs:attribute name="minOccurs" use="optional" default="0" type="nx:nonNegativeUnbounded"> <xs:annotation> <xs:documentation> - Defines the minimum number of times this ``field`` may be used. Its + Defines the minimum number of times this element may be used. Its value is confined to zero or greater. Must be less than or equal to the value for the "maxOccurs" attribute. </xs:documentation> @@ -813,7 +813,7 @@ </xs:documentation> </xs:annotation> <xs:simpleType> - <xs:restriction base="nx:NX_CHAR"> + <xs:restriction base="xs:string"> <xs:enumeration value="scalar"/> <xs:enumeration value="spectrum"/> <xs:enumeration value="image"/> @@ -830,7 +830,7 @@ </xs:documentation> </xs:annotation> <xs:simpleType> - <xs:restriction base="nx:NX_CHAR"> + <xs:restriction base="xs:string"> <xs:enumeration value="specified"/> <xs:enumeration value="any"/> </xs:restriction> @@ -1082,12 +1082,15 @@ <xs:annotation> <xs:documentation> One of the prescribed values. Use the ``value`` attribute. - - Defines the value of one selection for an ``enumeration`` list. - Each enumerated item must have a value (it cannot have an empty text node). </xs:documentation> </xs:annotation> <xs:complexType> + <xs:annotation> + <xs:documentation> + Defines the value of one selection for an ``enumeration`` list. + Each enumerated item must have a value (it cannot have an empty text node). + </xs:documentation> + </xs:annotation> <xs:sequence> <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> <xs:annotation> @@ -1183,9 +1186,6 @@ <xs:attribute name="ref" type="nx:NX_CHAR"> <xs:annotation> <xs:documentation> - Deprecated: 2016-11-23 telco - (https://github.com/nexusformat/definitions/issues/330) - The dimension specification is the same as that in the ``ref`` field, specified either by a relative path, such as ``polar_angle`` or ``../Qvec`` or absolute path, such as @@ -1196,9 +1196,6 @@ <xs:attribute name="refindex" type="nx:NX_CHAR"> <xs:annotation> <xs:documentation> - Deprecated: 2016-11-23 telco - (https://github.com/nexusformat/definitions/issues/330) - The dimension specification is the same as the ``refindex`` axis within the ``ref`` field. Requires ``ref`` attribute to be present. diff --git a/src/punx/cache/v3.2/nxdlTypes.xsd b/src/punx/cache/a4fd52d/nxdlTypes.xsd similarity index 99% rename from src/punx/cache/v3.2/nxdlTypes.xsd rename to src/punx/cache/a4fd52d/nxdlTypes.xsd index 8c327361dc3f152a2e06f2c3162524c708de69b2..ec98eb2e344bf7d8fc759a53f824603247a6970c 100644 --- a/src/punx/cache/v3.2/nxdlTypes.xsd +++ b/src/punx/cache/a4fd52d/nxdlTypes.xsd @@ -10,7 +10,7 @@ .. NeXus - Neutron and X-ray Common Data Format - Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) + Copyright (C) 2008-2016 NeXus International Advisory Committee (NIAC) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/punx/cache/v2018.5/__github_info__.json b/src/punx/cache/v2018.5/__github_info__.json new file mode 100644 index 0000000000000000000000000000000000000000..b3a78f6fe171f2879e1b401bbe50f2a2b3dd6632 --- /dev/null +++ b/src/punx/cache/v2018.5/__github_info__.json @@ -0,0 +1,9 @@ +{ + "# description": "NXDL files downloaded from GitHub repository", + "zip_url": "https://api.github.com/repos/nexusformat/definitions/zipball/v2018.5", + "# written": "2018-06-24 12:57:20.657454", + "sha": "a3045fd7ff0029adc811d9ed92f42ad51007f32d", + "last_modified": "2018-05-15 16:34:19", + "ref_type": "release", + "ref": "v2018.5" +} \ No newline at end of file diff --git a/src/punx/cache/v2018.5/applications/NXarchive.nxdl.xml b/src/punx/cache/v2018.5/applications/NXarchive.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..81b62a2895add70f7bbc71f12f995d0079f014d0 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXarchive.nxdl.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXarchive" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is a definition for data to be archived by ICAT (http://www.icatproject.org/). + + .. text from the icatproject.org site + + the database (with supporting software) that provides an + interface to all ISIS experimental data and will provide + a mechanism to link all aspects of ISIS research from + proposal through to publication. + </doc> + <group type="NXentry" name="entry"> + <attribute name="index"></attribute> + <field name="title" /> + <field name="experiment_identifier" type="NX_CHAR"> + <doc>unique identifier for the experiment</doc> + </field> + <field name="experiment_description" type="NX_CHAR"> + <doc>Brief description of the experiment and its objectives</doc> + </field> + <field name="collection_identifier" type="NX_CHAR"> + <doc>ID of user or DAQ define group of data files </doc> + </field> + <field name="collection_description" type="NX_CHAR"> + <doc>Brief summary of the collection, including grouping criteria </doc> + </field> + <field name="entry_identifier" type="NX_CHAR"> + <doc>unique identifier for this measurement as provided by the facility</doc> + </field> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="duration" type="NX_FLOAT" units="NX_TIME"> + <doc>TODO: needs documentation</doc> + </field> + <field name="collection_time" type="NX_FLOAT" units="NX_TIME"> + <doc>TODO: needs documentation</doc> + </field> + <field name="run_cycle" type="NX_CHAR"> + <doc>TODO: needs documentation</doc> + </field> + <field name="revision" type="NX_CHAR"> + <doc>revision ID of this file, may be after recalibration, reprocessing etc.</doc> + </field> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXarchive"/> + </enumeration> + </field> + <field name="program" type="NX_CHAR"> + <doc>The program and version used for generating this file</doc> + <attribute name="version"></attribute></field> + <field name="release_date" type="NX_CHAR" units="NX_TIME"> + <doc>when this file is to be released into PD</doc></field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field> + <field name="role" type="NX_CHAR"> + <doc>role of the user</doc></field> + <field name="facility_user_id" type="NX_CHAR"> + <doc>ID of the user in the facility burocracy database</doc> + </field> + </group> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" type="NX_CHAR" > + <!-- TODO: suggest changing from enumeration to suggested list --> + <enumeration> + <item value="Spallation Neutron Source"/> + <item value="Pulsed Reactor Neutron Source"/> + <item value="Reactor Neutron Source"/> + <item value="Synchrotron X-Ray Source"/> + <item value="Pulsed Muon Source"/> + <item value="Rotating Anode X-Ray"/> + <item value="Fixed Tube X-Ray"/> + </enumeration> + </field> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <field name="name" type="NX_CHAR"/> + <field name="description" type="NX_CHAR"> + <doc>Brief description of the instrument</doc> + </field> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="sample_id" type="NX_CHAR"> + <doc>Unique database id of the sample</doc> + </field> + <field name="description" type="NX_CHAR"/> + <field name="type" type="NX_CHAR"> + <enumeration> + <item value="sample"/> + <item value="sample+can"/> + <item value="calibration sample"/> + <item value="normalisation sample"/> + <item value="simulated data"/> + <item value="none"/> + <item value="sample_environment"/> + </enumeration> + </field> + <field name="chemical_formula" type="NX_CHAR"> + <doc>Chemical formula formatted according to CIF conventions</doc> + </field> + <field name="preparation_date" type="NX_CHAR" units="NX_TIME"/> + <field name="situation" type="NX_CHAR"> + <doc> + Description of the environment the sample is in: + air, vacuum, oxidizing atmosphere, dehydrated, etc. + </doc> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"/> + <field name="magnetic_field" type="NX_FLOAT" units="NX_CURRENT"/> + <field name="electric_field" type="NX_FLOAT" units="NX_VOLTAGE"/> + <field name="stress_field" type="NX_FLOAT" units="NX_UNITLESS"/> + <field name="pressure" type="NX_FLOAT" units="NX_PRESSURE"/> + </group> + </group> +</definition> + + + + + + + + + + + + + + + diff --git a/src/punx/cache/v2018.5/applications/NXarpes.nxdl.xml b/src/punx/cache/v2018.5/applications/NXarpes.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..8f6d75ae88c37021cfcc2d098d0a0516678720b2 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXarpes.nxdl.xml @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2012-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXarpes" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is an application definition for angular resolved photo electron spectroscopy. + + It has been drawn up with hemispherical electron analysers in mind. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use "entry1", "entry2", ... + for analysis software to locate each entry. + </doc> + </attribute> + <field name="title" type="NX_CHAR"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this file conforms.</doc> + <enumeration> + <item value="NXarpes"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type" type="NX_CHAR"/> + <field name="name" type="NX_CHAR"/> + <field name="probe"> + <enumeration> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="energy" type="NX_NUMBER" units="NX_ENERGY"/> + </group> + <group type="NXdetector" name="analyser"> + <field name="data" type="NX_NUMBER" /> + <field name="lens_mode" type="NX_CHAR"> + <doc>setting for the electron analyser lens</doc> + </field> + <field name="acquisition_mode"> + <enumeration> + <item value="swept"/> + <item value="fixed"/> + </enumeration> + </field> + <field name="entrance_slit_shape"> + <enumeration> + <item value="curved"/> + <item value="straight"/> + </enumeration> + </field> + <field name="entrance_slit_setting" type="NX_NUMBER" units="NX_ANY"> + <doc>dial setting of the entrance slit</doc> + </field> + <field name="entrance_slit_size" units="NX_LENGTH"> + <doc>size of the entrance slit</doc> + </field> + <field name="pass_energy" units="NX_ENERGY"> + <doc>energy of the electrons on the mean path of the analyser</doc> + </field> + <field name="time_per_channel" units="NX_TIME"> + <doc>todo: define more clearly</doc> + </field> + <field name="angles" type="NX_NUMBER" units="NX_ANGLE"> + <doc> + Angular axis of the analyser data + which dimension the axis applies to is defined + using the normal NXdata methods. + </doc> + </field> + <field name="energies" type="NX_NUMBER" units="NX_ENERGY"> + <doc> + Energy axis of the analyser data + which dimension the axis applies to is defined + using the normal NXdata methods. + </doc> + </field> + <field name="sensor_size" type="NX_INT"> + <doc>number of raw active elements in fast and slow pixel dimension direction</doc> + <dimensions rank="2" /> + </field> + <field name="region_origin" type="NX_INT"> + <doc>origin of rectangular region selected for readout</doc> + <dimensions rank="2" /> + </field> + <field name="region_size" type="NX_INT"> + <doc>size of rectangular region selected for readout</doc> + <dimensions rank="2" /> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name" type="NX_CHAR"> + <doc>Descriptive name of sample</doc> + </field> + <field name="temperature" type="NX_NUMBER" units="NX_TEMPERATURE"/> + </group> + <group type="NXdata"/> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXcanSAS.nxdl.xml b/src/punx/cache/v2018.5/applications/NXcanSAS.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ed252eb8acb12c2778503db415f4a2cff4152b1 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXcanSAS.nxdl.xml @@ -0,0 +1,1286 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2012-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> + +<!-- + NOTE: + This NXDL refers to several image files (.jpg, .png) in its documentation. + All such related resources are stored in the related subdirectory: ./canSAS/ + + In general, for an NXDL file: NXsomenxdl.nxdl.xml + all related resources should be stored in subdirectory: ./somenxdl/ + --> +<definition name="NXcanSAS" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc> + Implementation of the canSAS standard to store reduced small-angle scattering data of any dimension. + + .. index:: canSAS + + For more details, see: + + * http://www.cansas.org/ + * http://www.cansas.org/formats/canSAS1d/1.1/doc/ + * http://cansas-org.github.io/canSAS2012/ + * https://github.com/canSAS-org/NXcanSAS_examples + + The minimum requirements for *reduced* small-angle scattering data + as described by canSAS are summarized in the following figure: + + .. _canSAS_2012_minimum: + + .. figure:: canSAS/2012-minimum.png + :width: 60% + + The minimum requirements for *reduced* small-angle scattering data. + (:download:`full image <canSAS/2012-minimum.png>`) + See :ref:`below <NXcanSAS_minimum>` for the minimum required + information for a NeXus data file + written to the NXcanSAS specification. + + .. rubric:: Implementation of canSAS standard in NeXus + + This application definition is an implementation of the canSAS + standard for storing both one-dimensional and multi-dimensional + *reduced* small-angle scattering data. + + * NXcanSAS is for reduced SAS data and metadata to be stored together in one file. + * *Reduced* SAS data consists of :math:`I(\vec{Q})` or :math:`I(|\vec{Q}|)` + * External file links are not to be used for the reduced data. + * A good practice/practise is, at least, to include a reference to how the data was acquired and processed. Yet this is not a requirement. + * There is no need for NXcanSAS to refer to any raw data. + + The canSAS data format has a structure similar to NeXus, not identical. + To allow canSAS data to be expressed in NeXus, yet identifiable + by the canSAS standard, an additional group attribute ``canSAS_class`` + was introduced. Here is the mapping of some common groups. + + =============== ============ ========================== + group (*) NX_class canSAS_class + =============== ============ ========================== + sasentry NXentry SASentry + sasdata NXdata SASdata + sasdetector NXdetector SASdetector + sasinstrument NXinstrument SASinstrument + sasnote NXnote SASnote + sasprocess NXprocess SASprocess + sasprocessnote NXcollection SASprocessnote + sastransmission NXdata SAStransmission_spectrum + sassample NXsample SASsample + sassource NXsource SASsource + =============== ============ ========================== + + (*) The name of each group is a suggestion, + not a fixed requirement and is chosen as fits each data file. + See the section on defining + :ref:`NXDL group and field names <RegExpName>`. + + Refer to the NeXus Coordinate System drawing (:ref:`Design-CoordinateSystem`) + for choice and direction of :math:`x`, :math:`y`, and :math:`z` axes. + + .. _NXcanSAS_minimum: + + .. rubric:: The minimum required information for a NeXus data file + written to the NXcanSAS specification. + + .. literalinclude:: canSAS/minimum-required.txt + :tab-width: 4 + :linenos: + :language: text + + </doc> + + <group type="NXentry"> + <attribute name="default" optional="true"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + Usually, this will be the name of the first *SASdata* group. + </doc> + </attribute> + <doc> + .. index:: NXcanSAS (applications); SASentry + + Place the canSAS ``SASentry`` group as a child of a NeXus ``NXentry`` group + (when data from multiple techniques are being stored) + or as a replacement for the ``NXentry`` group. + + Note: It is required for all numerical objects to provide + a *units* attribute that describes the engineering units. + Use the Unidata UDunits [#]_ specification + as this is compatible with various community standards. + + .. [#] The UDunits specification also includes instructions for derived units. + </doc> + <attribute name="canSAS_class"> + <doc> + Official canSAS group: **SASentry** + </doc> + <enumeration> + <item value="SASentry" /> + </enumeration> + </attribute> + <attribute name="version"> + <doc> + Describes the version of the canSAS standard used to write this data. + This must be a text (not numerical) representation. Such as:: + + @version="1.0" + + </doc> + <enumeration> + <item value="1.0" /> + </enumeration> + </attribute> + + <field name="definition"> + <doc>Official NeXus NXDL schema to which this subentry conforms.</doc> + <enumeration> + <item value="NXcanSAS" /> + </enumeration> + </field> + + <!-- + ============================ + SASdata + ============================ + --> + + <group type="NXdata"> + <doc> + A *SASData* group contains a single reduced small-angle scattering data set + that can be represented as :math:`I(\vec{Q})` or :math:`I(|\vec{Q}|)`. + + *Q* can be either a vector (:math:`\vec{Q}`) or a vector magnitude (:math:`|\vec{Q}|`) + + The name of each *SASdata* group must be unique within a SASentry group. + Suggest using names such as ``sasdata01``. + + NOTE: For the first *SASdata* group, be sure to write the chosen name + into the `SASentry/@default` attribute, as in:: + + SASentry/@default="sasdata01" + + A *SASdata* group has several attributes: + + * I_axes + * Q_indices + * Mask_indices + + To indicate the dependency relationships of other varied parameters, + use attributes similar to ``@Mask_indices`` (such as ``@Temperature_indices`` + or ``@Pressure_indices``). + </doc> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASdata`</doc> + <enumeration> + <item value="SASdata" /> + </enumeration> + </attribute> + <!-- attributes, see: http://www.cansas.org/formats/canSAS2012/1.0/doc/framework.html#terms --> + <attribute name="signal" type="NX_CHAR" > + <doc> + Name of the default data field. + </doc> + <enumeration> + <item value="I"><doc>For canSAS **SASdata**, this is always "I".</doc></item> + </enumeration> + </attribute> + <attribute name="I_axes"> + <doc> + String array that defines the independent data fields used in + the default plot for all of the dimensions of the *signal* field + (the *signal* field is the field in this group that is named by + the ``signal`` attribute of this group). + One entry is provided for every dimension of the ``I`` data object. + Such as:: + + @I_axes="Temperature", "Time", "Pressure", "Q", "Q" + + Since there are five items in the list, the intensity field of this example + ``I`` must be a five-dimensional array (rank=5). + </doc> + </attribute> + + <attribute name="Q_indices" type="NX_INT"> + <doc> + Integer or integer array that describes which indices + (of the :math:`I` data object) are used to + reference the ``Q`` data object. The items in this array + use zero-based indexing. Such as:: + + @Q_indices=1,3,4 + + which indicates that ``Q`` requires three indices + from the :math:`I` data object: one for time and + two for Q position. Thus, in this example, the + ``Q`` data is time-dependent: :math:`\vec{Q}(t)`. + </doc> + </attribute> + <attribute name="mask" type="NX_CHAR" > + <doc> + Name of the data mask field. + + .. see: https://github.com/nexusformat/definitions/issues/533 + + The data *mask* must have the same shape as the *data* field. + Positions in the mask correspond to positions in the *data* field. + The value of the mask field may be either a boolean array + where ``false`` means *no mask* and ``true`` means *mask* + or a more descriptive array as as defined in :ref:`NXdetector`. + </doc> + </attribute> + <attribute name="Mask_indices" optional="true"> + <doc> + Integer or integer array that describes which indices + (of the :math:`I` data object) are used to + reference the ``Mask`` data object. The items in this + array use zero-based indexing. Such as:: + + @Mask_indices=3,4 + + which indicates that Q requires two indices + from the :math:`I` data object for Q position. + </doc> + </attribute> + <attribute name="timestamp" type="NX_DATE_TIME" optional="true"> + <doc> + ISO-8601 time [#iso8601]_ + </doc> + </attribute> + + <field name="Q" type="NX_NUMBER" units="NX_PER_LENGTH"> + <!-- http://www.cansas.org/formats/canSAS2012/1.0/doc/basics.html#definition-of --> + <doc> + .. index:: NXcanSAS (applications); Q + + Array of :math:`Q` data to accompany :math:`I`. + + .. figure:: canSAS/Q-geometry.jpg + :width: 60% + + The :math:`\vec{Q}` geometry. + (:download:`full image <canSAS/Q-geometry.jpg>`) + + :math:`Q` may be represented as either + the three-dimensional scattering vector :math:`\vec{Q}` + or the magnitude of the scattering vector, :math:`|\vec{Q}|`. + + .. math:: |\vec{Q}| = (4\pi/\lambda) sin(\theta) + + When we write :math:`Q`, we may refer to either or both of + :math:`|\vec{Q}|` + or :math:`\vec{Q}`, depending on the context. + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`Q` and related terms. + + Data expressed in other units will generate + a warning from validation software and may not + be processed by some analysis software packages. + </doc> + <enumeration> + <item value="1/m" /> + <item value="1/nm"> + <doc>preferred</doc> + </item> + <item value="1/angstrom" /> + </enumeration> + </attribute> + <attribute name="uncertainties" optional="true"> + <doc> + (optional: for numerical arrays) + + Names the dataset (in this SASdata group) that provides the + uncertainty to be used for data analysis. + The name of the dataset containing the :math:`Q` uncertainty + is flexible. The name must be unique in the *SASdata* group. + + .. comment + see: https://github.com/canSAS-org/canSAS2012/issues/7 + + Such as:: + + @uncertainties="Q_uncertainties" + + The *uncertainties* field will have the same *shape* (dimensions) + as the Q field. + + These values are the estimates of uncertainty of each Q. By default, + this will be interpreted to be the estimated standard deviation. + In special cases, when a standard deviation cannot possibly be used, + its value can specify another measure of distribution width. + + There may also be a subdirectory (optional) with constituent + components. + + .. note:: To report distribution in reported :math:`Q` values, + use the ``@resolutions`` attribute. It is possible for both + ``@resolutions`` and ``uncertainties`` to be reported. + + </doc> + </attribute> + <attribute name="resolutions" type="NX_CHAR" optional="true"> + <doc> + .. index:: NXcanSAS (applications); resolutions + + (optional: for numerical arrays) + + Names the dataset (in this SASdata group) containing the :math:`Q` resolution. + The name of the dataset containing the :math:`Q` resolution + is flexible. The name must be unique in the *SASdata* group. + + .. comment + see: https://github.com/canSAS-org/canSAS2012/issues/7 + + The *resolutions* field will have the same *shape* (dimensions) + as the Q field. + + Generally, this is the principal resolution of each :math:`Q`. + Names the data object (in this SASdata group) that provides the + :math:`Q` resolution to be used for data analysis. Such as:: + + @resolutions="Qdev" + + To specify two-dimensional resolution for slit-smearing geometry, + such as (*dQw*, *dQl*), use a string array, such as:: + + @resolutions="dQw", "dQl" + + There may also be a subdirectory (optional) with constituent + components. + + This pattern will demonstrate how to introduce further as-yet + unanticipated terms related to the data. + + .. comment + see: https://github.com/nexusformat/definitions/issues/492#issuecomment-262813907 + + By default, the values of the resolutions data object are assumed to be + one standard deviation of any function used to approximate the + resolution function. This equates to the width of the gaussian + distribution if a Gaussian is chosen. See the ``@resolutions_description`` + attribute. + + .. note:: To report uncertainty in reported :math:`Q` values, + use the ``@uncertainties`` attribute. It is possible for both + ``@resolutions`` and ``uncertainties`` to be reported. + + </doc> + </attribute> + <attribute name="resolutions_description" type="NX_CHAR" optional="true"> + <doc> + (optional) + Generally, this describes the :math:`Q` ``@resolutions`` data object. + By default, the value is assumed to be "Gaussian". These are + suggestions: + + * Gaussian + * Lorentzian + * Square : + note that the full width of the square would be ~2.9 times + the standard deviation specified in the vector + * Triangular + * Sawtooth-outward : vertical edge pointing to larger Q + * Sawtooth-inward vertical edge pointing to smaller Q + * Bin : range of values contributing + (for example, when 2-D detector data have been reduced + to a 1-D :math:`I(|Q|)` dataset) + + For other meanings, it may be necessary to provide further details + such as the function used to assess the resolution. + In such cases, use additional datasets or a :ref:`NXnote` subgroup + to include that detail. + </doc> + </attribute> + </field> + <field name="I" type="NX_NUMBER"> + <!-- http://www.cansas.org/formats/canSAS2012/1.0/doc/basics.html#definition-of-intensity --> + <doc> + .. index:: NXcanSAS (applications); I + + Array of intensity (:math:`I`) data. + + The intensity may be represented in one of these forms: + + **absolute units**: :math:`d\Sigma/d\Omega(Q)` + differential cross-section + per unit volume per unit solid angle (such as: 1/cm/sr or 1/m/sr) + + **absolute units**: :math:`d\sigma/d\Omega(Q)` + differential cross-section + per unit atom per unit solid angle (such as: cm^2 or m^2) + + **arbitrary units**: :math:`I(Q)` + usually a ratio of two detectors + but units are meaningless (such as: a.u. or counts) + + This presents a few problems + for analysis software to sort out when reading the data. + Fortunately, it is possible to analyze the *units* to determine which type of + intensity is being reported and make choices at the time the file is read. But this is + an area for consideration and possible improvement. + + One problem arises with software that automatically converts data into some canonical + units used by that software. The software should not convert units between these different + types of intensity indiscriminately. + + A second problem is that when arbitrary units are used, then the set of possible + analytical results is restricted. With such units, no meaningful volume fraction + or number density can be determined directly from :math:`I(Q)`. + + In some cases, it is possible to apply a factor to convert the arbitrary + units to an absolute scale. This should be considered as a possibility + of the analysis process. + + Where this documentation says *typical units*, it is possible that small-angle + data may be presented in other units and still be consistent with NeXus. + See the :ref:`design-units` section. + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`I` and intensity-related terms. + + Data expressed in other units (or missing a ``@units`` attribute) + will be treated as ``arbitrary`` by some software packages. + + For software using the UDUNITS-2 library, ``arbitrary`` will be + changed to ``unknown`` for handling with that library. + </doc> + <enumeration> + <item value="1/m"> + <doc>includes m2/m3 and 1/m/sr</doc> + </item> + <item value="1/cm"> + <doc>includes cm2/cm3 and 1/cm/sr</doc> + </item> + <item value="m2/g" /> + <item value="cm2/g" /> + <item value="arbitrary" /> + </enumeration> + </attribute> + <attribute name="uncertainties" optional="true"> + <doc> + (optional: for numerical arrays) + + Names the dataset (in this SASdata group) that provides the + uncertainty of :math:`I` to be used for data analysis. + The name of the dataset containing the :math:`I` uncertainty + is flexible. The name must be unique in the *SASdata* group. + + .. comment + see: https://github.com/canSAS-org/canSAS2012/issues/7 + + Generally, this is the estimate of the uncertainty of each :math:`I`. + Typically the estimated standard deviation. + + *Idev* is the canonical name from the 1D standard. + The NXcanSAS standard allows for the name to be described using this attribute. + Such as:: + + @uncertainties="Idev" + + </doc> + </attribute> + <attribute name="scaling_factor" optional="true"> + <doc> + (optional) + Names the field (a.k.a. dataset) that contains a factor + to multiply ``I``. By default, this value is unity. + Should an uncertainty be associated with the scaling factor + field, the field containing that uncertainty would be + designated via the ``uncertainties`` attribute. + Such as:: + + I : NX_NUMBER + @uncertainties="Idev" : NX_CHAR + @scaling_factor="I_scaling" : NX_CHAR + Idev : NX_NUMBER + I_scaling : NX_NUMBER + @uncertainties="I_scaling_dev" : NX_CHAR + I_scaling_dev : NX_NUMBER + + The exact names for ``I_scaling`` and ``I_scaling_dev`` are not + defined by NXcanSAS. The user has the flexibility to use names + different than those shown in this example. + </doc> + </attribute> + </field> + + <field name="Idev" type="NX_NUMBER" minOccurs="0"> + <doc> + .. index:: NXcanSAS (applications); Idev + + Estimated **uncertainty** (usually standard deviation) + in :math:`I`. Must have the same units as :math:`I`. + + When present, the name of this field is also + recorded in the *uncertainties* attribute of *I*, as in:: + + I/@uncertainties="Idev" + + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`I` and intensity-related terms. + + Data expressed in other units (or missing a ``@units`` attribute) + will generate a warning from any validation process + and will be treated as ``arbitrary`` by some analysis software packages. + + For software using the UDUNITS-2 library, ``arbitrary`` will be + changed to ``unknown`` for handling with that library. + </doc> + <enumeration> + <item value="1/m"> + <doc>includes m2/m3 and 1/m/sr</doc> + </item> + <item value="1/cm"> + <doc>includes cm2/cm3 and 1/cm/sr</doc> + </item> + <item value="m2/g" /> + <item value="cm2/g" /> + <item value="arbitrary" /> + </enumeration> + </attribute> + </field> + + <field name="Qdev" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (applications); Qdev + + Estimated :math:`Q` **resolution** (usually standard deviation). + Must have the same units as :math:`Q`. + + When present, the name of this field is also + recorded in the *resolutions* attribute of *Q*, + as in:: + + Q/@resolutions="Qdev" + + or:: + + Q/@resolutions="dQw", "dQl" + + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`Q` and related terms. + + Data expressed in other units may not be processed by some + software packages. + </doc> + <enumeration> + <item value="1/m" /> + <item value="1/nm"> + <doc>preferred</doc> + </item> + <item value="1/angstrom" /> + </enumeration> + </attribute> + </field> + + <field name="dQw" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (applications); dQw + + :math:`Q` **resolution** along the axis of scanning + (the high-resolution *slit width* direction). + Useful for defining resolution data from + slit-smearing instruments such as Bonse-Hart geometry. + Must have the same units as :math:`Q`. + + When present, the name of this field is also + recorded in the *resolutions* attribute of *Q*, + as in:: + + Q/@resolutions="dQw", "dQl" + + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`Q` and related terms. + + Data expressed in other units may not be processed by some + software packages. + </doc> + <enumeration> + <item value="1/m" /> + <item value="1/nm"> + <doc>preferred</doc> + </item> + <item value="1/angstrom" /> + </enumeration> + </attribute> + </field> + + <field name="dQl" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0"> + <doc> + .. index:: NXcanSAS (applications); dQl + + :math:`Q` **resolution** perpendicular to the axis of scanning + (the low-resolution *slit length* direction). + Useful for defining resolution data from + slit-smearing instruments such as Bonse-Hart geometry. + Must have the same units as :math:`Q`. + + When present, the name of this field is also + recorded in the *resolutions* attribute of *Q*, + as in:: + + Q/@resolutions="dQw", "dQl" + + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`Q` and related terms. + + Data expressed in other units may not be processed by some + software packages. + </doc> + <enumeration> + <item value="1/m" /> + <item value="1/nm"> + <doc>preferred</doc> + </item> + <item value="1/angstrom" /> + </enumeration> + </attribute> + </field> + + <field name="Qmean" minOccurs="0" units="NX_PER_LENGTH" type="NX_NUMBER"> + <doc> + Mean value of :math:`Q` for this data point. + Useful when describing data that has been + binned from higher-resolution data. + + It is expected that ``Q`` is provided + and that both ``Q`` and ``Qmean`` will have the same units. + </doc> + <attribute name="units" optional="false"> + <doc> + Engineering units to use when expressing + :math:`Q` and related terms. + + Data expressed in other units may not be processed by some + software packages. + </doc> + <enumeration> + <item value="1/m" /> + <item value="1/nm"> + <doc>preferred</doc> + </item> + <item value="1/angstrom" /> + </enumeration> + </attribute> + </field> + <field name="ShadowFactor" minOccurs="0" units="NX_DIMENSIONLESS"> + <doc> + A numerical factor applied to pixels affected by the beam stop penumbra. + Used in data files from NIST/NCNR instruments. + + See: J.G. Barker and J.S. Pedersen (1995) *J. Appl. Cryst.* **28**, 105-114. + </doc> + </field> + + </group> + + <!-- optional items --> + <field name="title" minOccurs="1" maxOccurs="1"> + <doc> + Title of this *SASentry*. + Make it so that you can recognize the data by its title. + Could be the name of the sample, + the name for the measured data, or something else representative. + </doc> + </field> + <field name="run" minOccurs="1" maxOccurs="unbounded" nameType="any"> + <doc> + Run identification for this *SASentry*. + For many facilities, this is an integer, such as en experiment number. + Use multiple instances of ``run`` as needed, keeping + in mind that HDF5 requires unique names for all entities + in a group. + </doc> + <attribute name="name" optional="true"> + <doc> + Optional string attribute to identify this particular *run*. + Could use this to associate (correlate) multiple *SASdata* elements with *run* elements. + </doc> + </attribute> + </field> + + <group type="NXinstrument" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASinstrument`</doc> + <enumeration> + <item value="SASinstrument" /> + </enumeration> + </attribute> + <doc> + Description of the small-angle scattering instrument. + + Consider, carefully, the relevance to the SAS data analysis process + when adding subgroups in this **NXinstrument** group. Additional information + can be added but will likely be ignored by standardized data anlysis processes. + + The NeXus :ref:`NXbeam` base class may be added as a subgroup of this **NXinstrument** + group *or* as a subgroup of the **NXsample** group to describe properties of the beam at any + point downstream from the source. + </doc> + + <!-- + =========== + SASaperture + =========== + --> + + <group type="NXaperture" minOccurs="0"> + <doc> + :ref:`NXaperture` is generic and limits the variation in data files. + + Possible NeXus base class alternatives are: :ref:`NXpinhole` or :ref:`NXslit`. + </doc> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASaperture`</doc> + <enumeration> + <item value="SASaperture" /> + </enumeration> + </attribute> + + <field name="shape"> + <doc> + describe the type of aperture (pinhole, 4-blade slit, Soller slit, ...) + </doc> + </field> + <field name="x_gap" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>opening along the :math:`x` axis</doc> + </field> + <field name="y_gap" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>opening along the :math:`y` axis</doc> + </field> + </group> + + <!-- + ============== + SAScollimation + ============== + --> + <group type="NXcollimator" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SAScollimation`</doc> + <enumeration> + <item value="SAScollimation" /> + </enumeration> + </attribute> + <doc> + Description of a collimating element (defines the divergence of the beam) in the instrument. + + To document a slit, pinhole, or the beam, refer to the + documentation of the ``NXinstrument`` group above. + </doc> + + <field name="length" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Amount/length of collimation inserted (as on a SANS instrument)</doc> + </field> + + <field name="distance" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Distance from this collimation element to the sample</doc> + </field> + + <!-- SAScollimation --> + </group> + + + <!-- + ============================ + SASdetector + ============================ + --> + + <group type="NXdetector" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASdetector`</doc> + <enumeration> + <item value="SASdetector" /> + </enumeration> + </attribute> + <doc> + Description of a detector in the instrument. + </doc> + + <field name="name" maxOccurs="1"> + <doc>Identifies the name of this detector</doc> + </field> + <field name="SDD" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Distance between sample and detector. + + Note: In NXdetector, the ``distance`` field records the + distance to the previous component ... most often the sample. + This use is the same as ``SDD`` for most SAS + instruments but not all. For example, Bonse-Hart cameras + have one or more crystals between the sample and detector. + + We define here the field ``SDD`` to document without + ambiguity the distance between sample and detector. + </doc> + </field> + <field name="slit_length" type="NX_NUMBER" units="NX_PER_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Slit length of the instrument for this detector, + expressed in the same units as :math:`Q`. + </doc> + </field> + + <field name="x_position" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_LENGTH"> + <doc>Location of the detector in :math:`x`</doc> + </field> + <field name="y_position" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_LENGTH"> + <doc>Location of the detector in :math:`y`</doc> + </field> + <field name="roll" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_ANGLE"> + <doc>Rotation of the detector about the :math:`z` axis (roll)</doc> + </field> + <field name="pitch" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_ANGLE"> + <doc>Rotation of the detector about the :math:`x` axis (roll)</doc> + </field> + <field name="yaw" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_ANGLE"> + <doc>Rotation of the detector about the :math:`y` axis (yaw)</doc> + </field> + + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Position of the beam center on the detector. + + This is the x position where the direct beam would hit the detector plane. + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. The value can be any + real number (positive, zero, or negative). + </doc> + </field> + + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc> + Position of the beam center on the detector. + + This is the y position where the direct beam would hit the detector plane. + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. The value can be any + real number (positive, zero, or negative). + </doc> + </field> + + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of each detector pixel. If it is scalar all pixels are the same size</doc> + </field> + + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of each detector pixel. If it is scalar all pixels are the same size</doc> + </field> + + <!-- SASdetector --> + </group> + + <!-- + ============================ + SASsource + ============================ + --> + + <group type="NXsource" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASsource`</doc> + <enumeration> + <item value="SASsource" /> + </enumeration> + </attribute> + <doc> + Description of the radiation source. + </doc> + + <field name="radiation" maxOccurs="1"> + <doc> + Name of the radiation used. + Note that this is **not** the name of the facility! + </doc> + <enumeration> + <!-- enumeration values from NXsource/type and NXsource/probe --> + <item value="Spallation Neutron Source" /> + <item value="Pulsed Reactor Neutron Source" /> + <item value="Reactor Neutron Source" /> + <item value="Synchrotron X-ray Source" /> + <item value="Pulsed Muon Source" /> + <item value="Rotating Anode X-ray" /> + <item value="Fixed Tube X-ray" /> + <item value="UV Laser" /> + <item value="Free-Electron Laser" /> + <item value="Optical Laser" /> + <item value="Ion Source" /> + <item value="UV Plasma Source" /> + <item value="neutron" /> + <item value="x-ray" /> + <item value="muon" /> + <item value="electron" /> + <item value="ultraviolet" /> + <item value="visible light" /> + <item value="positron" /> + <item value="proton" /> + </enumeration> + </field> + <field name="beam_shape" minOccurs="0" maxOccurs="1"> + <doc>Text description of the shape of the beam (incident on the sample).</doc> + </field> + <field name="incident_wavelength" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc>wavelength (:math:`\lambda`) of radiation incident on the sample</doc> + </field> + <field name="wavelength_min" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Some facilities specify wavelength using a range. + This is the lowest wavelength in such a range. + </doc> + </field> + <field name="wavelength_max" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Some facilities specify wavelength using a range. + This is the highest wavelength in such a range. + </doc> + </field> + <field name="incident_wavelength_spread" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Some facilities specify wavelength using a range. + This is the width (FWHM) of such a range. + </doc> + </field> + <field name="beam_size_x" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of the incident beam along the x axis.</doc> + </field> + <field name="beam_size_y" type="NX_NUMBER" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Size of the incident beam along the y axis.</doc> + </field> + + <!-- SASsource --> + </group> + + <!-- SASinstrument --> + </group> + + <!-- + ============== + SASsample + ============== + --> + + <group type="NXsample" minOccurs="0"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASsample`</doc> + <enumeration> + <item value="SASsample" /> + </enumeration> + </attribute> + <doc> + Description of the sample. + </doc> + + <field name="name" maxOccurs="1"> + <doc>**ID**: Text string that identifies this sample.</doc> + </field> + <field name="thickness" type="NX_FLOAT" minOccurs="0" maxOccurs="1" units="NX_LENGTH"> + <doc>Thickness of this sample</doc> + </field> + <field name="transmission" type="NX_NUMBER" minOccurs="0" maxOccurs="1" units="NX_DIMENSIONLESS"> + <doc> + Transmission (:math:`I/I_0`) of this sample. + There is no *units* attribute as this number is dimensionless. + + Note: the ability to store a transmission *spectrum*, + instead of a single value, is provided elsewhere in the structure, + in the *SAStransmission_spectrum* element. + </doc> + </field> + <field name="temperature" type="NX_NUMBER" minOccurs="0" maxOccurs="1" units="NX_TEMPERATURE"> + <doc>Temperature of this sample.</doc> + </field> + <field name="details" minOccurs="0" maxOccurs="unbounded" nameType="any"> + <doc>Any additional sample details.</doc> + </field> + + <field name="x_position" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_LENGTH"> + <doc>Location of the sample in :math:`x`</doc> + </field> + <field name="y_position" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_LENGTH"> + <doc>Location of the sample in :math:`y`</doc> + </field> + <field name="roll" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_ANGLE"> + <doc>Rotation of the sample about the :math:`z` axis (roll)</doc> + </field> + <field name="pitch" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_ANGLE"> + <doc>Rotation of the sample about the :math:`x` axis (roll)</doc> + </field> + <field name="yaw" minOccurs="0" maxOccurs="1" type="NX_NUMBER" units="NX_ANGLE"> + <doc>Rotation of the sample about the :math:`y` axis (yaw)</doc> + </field> + + <!-- NXsample --> + </group> + + + <!-- + ============== + SASprocess + ============== + --> + + <group type="NXprocess" minOccurs="0" maxOccurs="unbounded"> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SASprocess`</doc> + <enumeration> + <item value="SASprocess" /> + </enumeration> + </attribute> + <doc> + Description of a processing or analysis step. + + Add additional fields as needed to describe value(s) of any + variable, parameter, or term related to the *SASprocess* step. + Be sure to include *units* attributes for all numerical fields. + </doc> + + <field name="name" minOccurs="0" maxOccurs="1"> + <doc>Optional name for this data processing or analysis step</doc> + </field> + <field name="date" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"> + <doc> + Optional date for this data processing or analysis step. [#iso8601]_ + + + .. [#iso8601] ISO-8601 standard time representation. + + NeXus dates and times are reported in ISO-8601 + (e.g., ``yyyy-mm-ddThh:mm:ss``) + or modified ISO-8601 (e.g., ``yyyy-mm-dd hh:mm:ss``). + + See: http://www.w3.org/TR/NOTE-datetime + or http://en.wikipedia.org/wiki/ISO_8601 for more details. + </doc> + </field> + <field name="description" minOccurs="0" maxOccurs="1"> + <doc>Optional description for this data processing or analysis step</doc> + </field> + <field name="term" minOccurs="0" maxOccurs="unbounded" nameType="any"> + <doc> + Specifies the value of a single variable, parameter, + or term (while defined here as a string, it could be a number) + related to the *SASprocess* step. + + Note: + The name *term* is not required, it could take any name, + as long as the name is unique within this group. + </doc> + </field> + + <!-- + suggested at NIAC2014 + Isn't this ALWAYS a possibility in any NeXus base class? + Not needed to define this but it is a good suggestion for usage. + --> + <group type="NXnote" minOccurs="0" maxOccurs="unbounded"> + <doc> + Any additional notes or subprocessing steps will be documented here. + + An **NXnote** group can be added to any NeXus group at or below the + **NXentry** group. It is shown here as a suggestion of a good place + to *consider* its use. + </doc> + </group> + + <group type="NXcollection" minOccurs="0" maxOccurs="unbounded"> + <doc> + Describes anything about *SASprocess* that is not already described. + + Any content not defined in the canSAS standard can be placed at this point. + + Note: + The name of this group is flexible, it could take any name, + as long as it is unique within the **NXprocess** group. + </doc> + <attribute name="canSAS_class"> + <doc> + Official canSAS group: :index:`NXcanSAS (applications); SASprocessnote` + </doc> + <enumeration> + <item value="SASprocessnote" /> + </enumeration> + </attribute> + <!-- SASprocessnote --> + </group> + + <!-- SASprocess --> + </group> + + <!-- + ============== + SASnote + ============== + --> + + <group type="NXcollection" minOccurs="0" maxOccurs="unbounded"> + <attribute name="canSAS_class"> + <doc> + Official canSAS group: :index:`NXcanSAS (applications); SASnote` + </doc> + <enumeration> + <item value="SASnote" /> + </enumeration> + </attribute> + <doc> + Free form description of anything not covered by other elements. + </doc> + </group> + + <!-- + ============================ + SAStransmission_spectrum + ============================ + --> + + <group type="NXdata" minOccurs="0"> + <doc> + The *SAStransmission_spectrum* element + + This describes certain data obtained from a variable-wavelength source + such as pulsed-neutron source. + <!-- requested to be in the 1D format by ISIS --> + + The name of each *SAStransmission_spectrum* group must be unique within a SASentry group. + Suggest using names such as ``sastransmission_spectrum01``. + </doc> + <attribute name="canSAS_class"> + <doc>Official canSAS group: :index:`NXcanSAS (applications); SAStransmission_spectrum`</doc> + <enumeration> + <item value="SAStransmission_spectrum" /> + </enumeration> + </attribute> + <attribute name="signal" type="NX_CHAR" > + <doc> + Name of the default data field. + </doc> + <enumeration> + <item value="T"><doc>For **SAStransmission_spectrum**, this is always "T".</doc></item> + </enumeration> + </attribute> + <attribute name="T_axes"> + <enumeration> + <item value="T"> + <doc>the wavelengths field (as a dimension scale) corresponding to this transmission</doc> + </item> + </enumeration> + </attribute> + <attribute name="name"> + <doc> + Identify what type of spectrum is being described. + It is expected that this value will take either of these two values: + + ====== ============================================== + value meaning + ====== ============================================== + sample measurement with the sample and container + can measurement with just the container + ====== ============================================== + </doc> + </attribute> + <attribute name="timestamp" type="NX_DATE_TIME" optional="true"> + <doc> + ISO-8601 time [#iso8601]_ + </doc> + </attribute> + + <field name="lambda" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc> + Wavelength of the radiation. + + This array is of the same shape as ``T`` and ``Tdev``. + </doc> + </field> + <field name="T" type="NX_NUMBER" units="NX_DIMENSIONLESS"> + <doc> + Transmission values (:math:`I/I_0`) + as a function of wavelength. + + This array is of the same shape as ``lambda`` and ``Tdev``. + </doc> + <attribute name="uncertainties"> + <doc> + Names the dataset (in this SASdata group) that provides the + uncertainty of each transmission :math:`T` to be used for data analysis. + The name of the dataset containing the :math:`T` uncertainty + is expected to be ``Tdev``. + + .. comment + see: https://github.com/canSAS-org/canSAS2012/issues/7 + + Typically: + + @uncertainties="Tdev" + + </doc> + </attribute> + </field> + + <field name="Tdev" type="NX_NUMBER" units="NX_DIMENSIONLESS" > + <doc> + .. index:: NXcanSAS (applications); Tdev + + Estimated uncertainty (usually standard deviation) + in :math:`T`. Must have the same units as :math:`T`. + + This is the field is named in the *uncertainties* attribute of *T*, as in:: + + T/@uncertainties="Tdev" + + This array is of the same shape as ``lambda`` and ``T``. + </doc> + </field> + </group> + + </group> + +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXdirecttof.nxdl.xml b/src/punx/cache/v2018.5/applications/NXdirecttof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..45e9d63ffb33b551790078a555ef896baec1cc3a --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXdirecttof.nxdl.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXdirecttof" extends="NXtofraw" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is a application definition for raw data from a direct geometry TOF spectrometer</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXdirecttof"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXfermi_chopper" name="fermi_chopper" minOccurs="0"> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + </group> + <group type="NXdisk_chopper" name="disk_chopper" minOccurs="0"> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + </group> + <doc> + We definitly want the rotation_speed and energy of the chopper. Thus either + a fermi_chopper or a disk_chopper group is required. + </doc> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXfluo.nxdl.xml b/src/punx/cache/v2018.5/applications/NXfluo.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..713bdad826122e656a936181f08fb2bcbca23dcb --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXfluo.nxdl.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXfluo" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd " + > + <doc> + This is an application definition for raw data from an X-ray fluorescence experiment + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> + Official NeXus NXDL schema to which this file conforms. + </doc> + <enumeration> + <item value="NXfluo"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="x-ray" /> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" type="NX_FLOAT"></field> + </group> + <group type="NXdetector" name="fluorescence"> + <field name="data" type="NX_INT" axes="energy" signal="1"> + <dimensions rank="1"> + <dim index="1" value="nenergy" /> + </dimensions> + </field> + <field name="energy" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nenergy" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT"></field> + </group> + <group type="NXdata" name="data"> + <link name="energy" + target="/entry/instrument/fluorescence/energy"> + </link> + <link name="data" target="/entry/instrument/fluorescence/data"> + </link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXindirecttof.nxdl.xml b/src/punx/cache/v2018.5/applications/NXindirecttof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..5af5c9dc61efd7cefe7cbecf75fa016ee46ca713 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXindirecttof.nxdl.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXindirecttof" extends="NXtofraw" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is a application definition for raw data from a direct geometry TOF spectrometer</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXindirecttof"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXmonochromator" name="analyser"> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>analyzed energy </doc> + <dimensions rank="1"> + <dim index="1" value="nDet" /></dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>polar angle towards sample</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance from sample</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions> + </field> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXiqproc.nxdl.xml b/src/punx/cache/v2018.5/applications/NXiqproc.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..57377f56f1eb5823947e9e356d2812eb85009c39 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXiqproc.nxdl.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXiqproc" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>Application definition for any :math:`I(Q)` data.</doc> + <group type="NXentry"> + <attribute name="entry"> + <!-- TODO documentation string needed here --> + </attribute> + <field name="title"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXiqproc"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument from which this data was reduced. </doc></field> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="reduction"> + <field name="program" type="NX_CHAR"></field> + <field name="version" type="NX_CHAR"></field> + <group type="NXparameters" name="input"> + <field name="filenames" type="NX_CHAR"> + <doc>Raw data files used to generate this I(Q)</doc></field> + <doc>Input parameters for the reduction program used</doc></group> + <group type="NXparameters" name="output"> + <doc>Eventual output parameters from the data reduction program used</doc></group></group> + <group type="NXdata"> + <field name="data" type="NX_INT" signal="1"> + <doc> + This is I(Q). The client has to analyse the dimensions + of I(Q). Often, multiple I(Q) for various environment + conditions are measured; that would be the first + dimension. Q can be multidimensional, this accounts for + the further dimensions in the data + </doc> + <dimensions rank="3"> + + <dim index="1" value="NE" /> + <dim index="2" value="NQX" /> + <dim index="3" value="NQY" /> + </dimensions> + </field> + <field name="variable" axis="1"> + <dimensions rank="1"> + <dim index="1" value="NE" /></dimensions> + <attribute name="varied_variable"> + <doc>The real name of the varied variable in the first dim of data, temperature, P, MF etc...</doc></attribute></field> + <field name="qx" axis="2"> + <doc>Values for the first dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NQX" /></dimensions></field> + <field name="qy" axis="3"> + <doc>Values for the second dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NQY" /></dimensions></field> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXlauetof.nxdl.xml b/src/punx/cache/v2018.5/applications/NXlauetof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..0e3b8b25717d716a2c10093e993a62cd10b7c8b1 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXlauetof.nxdl.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXlauetof" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is the application definition for a TOF laue diffractometer + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXlauetof"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <doc> + This assumes a planar 2D detector. All angles and distances refer to the center of the + detector. + </doc> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The polar_angle (two theta) where the detector is placed.</doc> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The azimuthal angle where the detector is placed.</doc> + </field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="number of x pixels" /> + <dim index="2" value="number of y pixels" /> + <dim index="3" value="nTOF" /> + </dimensions> + <attribute name="signal" type="NX_POSINT"> + <enumeration> + <item value="1" /> + </enumeration> + </attribute> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + The orientation matrix according to Busing and + Levy conventions. This is not strictly necessary as + the UB can always be derived from the data. But + let us bow to common usage which includes thie + UB nearly always. + </doc> + <dimensions rank="2"> + <dim index="1" value="3" /> + <dim index="2" value="3" /> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT"> + <doc> + The unit cell, a, b, c, alpha, beta, gamma. + Again, not strictly necessary, but normally written. + </doc> + <dimensions rank="1"> + <dim index="1" value="6" /> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> Count to a preset value based on either clock time (timer) or received monitor counts + (monitor). </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT"> + <doc>use these attributes ``primary=1 signal=1``</doc> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXmonopd.nxdl.xml b/src/punx/cache/v2018.5/applications/NXmonopd.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc9c004f0db49da6316a2665ef2a85bd0945f8d7 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXmonopd.nxdl.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXmonopd" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Monochromatic Neutron and X-Ray Powder diffractometer + + Instrument + definition for a powder diffractometer at a monochromatic neutron + or X-ray beam. This is both suited for a powder diffractometer + with a single detector or a powder diffractometer with a position + sensitive detector. + </doc> + <group type="NXentry" name="entry"> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXmonopd"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type"/> + <field name="name"/> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + <item value="electron"/> + </enumeration> + </field> + </group> + <group type="NXcrystal"> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Optimum diffracted wavelength</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + </group> + <group type="NXdetector"> + <field name="polar_angle" type="NX_FLOAT" axis="1"> + <doc>where ndet = number of detectors</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + <field name="data" type="NX_INT" signal="1"> + <doc> + detector signal (usually counts) are already + corrected for detector efficiency + </doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Optional rotation angle for the case when the powder diagram + has been obtained through an omega-2theta scan like from a + traditional single detector powder diffractometer + </doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + </group> + <group type="NXdata"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"> + <doc>Link to polar angle in /NXentry/NXinstrument/NXdetector</doc> + </link> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"> + <doc>Link to data in /NXentry/NXinstrument/NXdetector</doc> + </link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXmx.nxdl.xml b/src/punx/cache/v2018.5/applications/NXmx.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b04794e1fef81b3008495be2c9e571d0e6293ae2 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXmx.nxdl.xml @@ -0,0 +1,622 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2013-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition name="NXmx" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <!-- TODO define options for most fields to allow them to be either scalar + or arrays indexed by np, i, j, k, ..., + --> + <doc> + These symbols will be used below to coordinate datasets + with the same shape. Most MX x-ray detectors will produce + two-dimensional images. Some will produce three-dimensional + images, using one of the indices to select a detector element. + </doc> + <symbol name="dataRank"> + <doc>rank of the ``data`` field</doc> + </symbol> + <symbol name="np"> + <doc>number of scan points</doc> + </symbol> + <symbol name="i"> + <doc>number of detector pixels in the slowest direction</doc> + </symbol> + <symbol name="j"> + <doc>number of detector pixels in the second slowest direction</doc> + </symbol> + <symbol name="k"> + <doc>number of detector pixels in the third slowest direction</doc> + </symbol> + </symbols> + + <doc> + functional application definition for macromolecular crystallography + </doc> + + <group type="NXentry"> + <field name="title" type="NX_CHAR" minOccurs="0" /> + + <field name="start_time" type="NX_DATE_TIME" minOccurs="0" /> + + <field name="end_time" type="NX_DATE_TIME" minOccurs="0" /> + + <field name="definition"> + <doc> NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXmx" /> + </enumeration> + </field> + + <group type="NXinstrument"> + <group type="NXattenuator" minOccurs="0"> + <field name="attenuator_transmission" type="NX_NUMBER" units="NX_UNITLESS" + minOccurs="0" /> + </group> + + <group type="NXdetector_group" minOccurs="0"> + <doc> + Optional logical grouping of detector elements. + + Each detector element is represented as an NXdetector group + with its own detector data array. Each detector data array + may be further decomposed into array sections by use of + NXdetector_module groups. The names are given in the + group names field. + + The groups are defined hierarchically, with names given + in the group_names field, unique identifiing indices given + in the field group_index, and the level in the hierarchy + given in the group_parent field. For example if an x-ray + detector, DET, consists of four elements in a rectangular array:: + + DTL DTR + DLL DLR + + We could have:: + + group_names: ["DET", "DTL", "DTR", "DLL", "DLR"] + group_index: [1, 2, 3, 4, 5] + group_parent: [-1, 1, 1, 1, 1] + + </doc> + + <field name="group_names" type="NX_CHAR"> + <doc> + An array of the names of the detector elements or hierarchical + groupings of detector elements. + + Specified in the base classes as comma separated list of names, + but new code should use an array of names as quoted strings. + </doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> + + <field name="group_index" type="NX_INT"> + <doc> + An array of unique indices for detector elements or groupings + of detector elements. + + Each element is a unique ID for the corresponding group named + in the field group_names. The IDs are positive integers starting + with 1. + </doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + + <field name="group_parent" type="NX_INT"> + <doc> + An array of the hierarchical levels of the parents of detector + elements or groupings of detector elements. + + A top-level element or grouping has parent level -1 + </doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> + </group> + <group type="NXdetector"> + <doc> + Normally the detector group will have the name ``detector``. + However, in the case of multiple detector elements, each element + needs a uniquely named NXdetector group. + </doc> + <field name="depends_on" type="NX_CHAR" /> <!-- better type for paths needed --> + + <group type="NXtransformations" minOccurs="0"> + <doc> + Suggested location for axes (transformations) to do with the + detector + </doc> + </group> + + <group type="NXcollection" minOccurs="0"> + <doc> + Suggested container for detailed non-standard detector + information like corrections applied automatically or + performance settings. + </doc> + </group> + + <field name="data" type="NX_NUMBER"> + <doc> + For a dimension-2 detector, the rank of the data array will be 3. + For a dimension-3 detector, the rank of the data array will be 4. + This allows for the introduction of the frame number as the + first index. + </doc> + <dimensions rank="dataRank"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + <dim index="4" value="k" required="false"/> + </dimensions> + </field> + + <field name="description" minOccurs="0"> + <doc> + name/manufacturer/model/etc. information + </doc> + </field> + + <field name="time_per_channel" units="NX_TIME" minOccurs="0"> + <doc>todo: define more clearly</doc> + </field> + + <group type="NXdetector_module" minOccurs="1" maxOccurs="unbounded"> + <doc> + Many detectors consist of multiple smaller modules that are + operated in sync and store their data in a common dataset. + To allow consistent parsing of the experimental geometry, + this application definiton requires all detectors to + define a detector module, even if there is only one. + + This group specifies the hyperslab of data in the data + array associated with the detector that contains the + data for this module. If the module is associated with + a full data array, rather than with a hyperslab within + a larger array, then a single module should be defined, + spanning the entire array. + </doc> + <field name="data_origin" type="NX_INT"> + <doc> + A dimension-2 or dimension-3 field which gives the indices + of the origin of the hyperslab of data for this module in the + main area detector image in the parent NXdetector module. + + The data_origin is 0-based. + + The frame number dimension (np) is omitted. The order + of indices is i, j or i, j, k, i.e. slow to fast. + </doc> + </field> + <field name="data_size" type="NX_INT"> + <doc> + Two or three values for the size of the module in pixels in + each direction. + </doc> + </field> + <field name="data_stride" type="NX_INT" minOccurs="0"> + <doc> + Two or three values for the stride of the module in pixels in + each direction. By default the stride is [1,1] or [1,1,1], + and this is the most likely case. This optional field is + included for completeness. + </doc> + </field> + + <field name="module_offset" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Offset of the module in regards to the origin of the detector in an + arbitrary direction. + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector"> + </attribute> + <attribute name="offset"> + </attribute> + <attribute name="depends_on"> + </attribute> + </field> + <field name="fast_pixel_direction" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Values along the direction of fastest varying pixel direction.The + direction itself is given through the vector attribute + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector"> + </attribute> + <attribute name="offset"> + </attribute> + <attribute name="depends_on"> + </attribute> + </field> + <field name="slow_pixel_direction" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Values along the direction of slow varying pixel direction. The + direction itself is given through the vector attribute + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector"> + </attribute> + <attribute name="offset"> + </attribute> + <attribute name="depends_on"> + </attribute> + </field> + </group> + + <field name="distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0"> + <doc> + Distance from the sample to the beam center. + This value is a + guidance only, the proper geometry can be + found following the + depends_on axis chain. + </doc> + </field> + + <field name="dead_time" type="NX_FLOAT" units="NX_TIME" minOccurs="0"> + <doc> + Detector dead time + </doc> + </field> + + <field name="count_time" type="NX_NUMBER" units="NX_TIME" minOccurs="0"> + <doc> + Elapsed actual counting time + </doc> + </field> + + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0"> + <doc> + This is the x position where the direct beam would hit the + detector. This is a length and can be outside of the actual + detector. The length can be in physical units or pixels as + documented by the units attribute. + </doc> + </field> + + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0"> + <doc> + This is the y position where the direct beam would hit the + detector. This is a length and can be outside of the actual + detector. The length can be in physical units or pixels as + documented by the units attribute. + </doc> + </field> + + <field name="angular_calibration_applied" type="NX_BOOLEAN" + minOccurs="0"> + <doc> + True when the angular calibration has been applied in the + electronics, false otherwise. + </doc> + </field> + + <field name="angular_calibration" type="NX_FLOAT" minOccurs="0"> + <doc>Angular calibration data.</doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="flatfield_applied" type="NX_BOOLEAN" minOccurs="0"> + <doc> + True when the flat field correction has been applied in the + electronics, false otherwise. + </doc> + </field> + + <field name="flatfield" type="NX_FLOAT" minOccurs="0"> + <doc>Flat field correction data.</doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="flatfield_error" type="NX_FLOAT" minOccurs="0"> + <doc>Errors of the flat field correction data.</doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="pixel_mask_applied" type="NX_BOOLEAN" minOccurs="0"> + <doc> + True when the pixel mask correction has been applied in the + electronics, false otherwise. + </doc> + </field> + + <field name="pixel_mask" type="NX_INT" minOccurs="0"> + <doc> + The 32-bit pixel mask for the detector. + Contains a bit field + for each pixel to signal dead, + blind or high or otherwise unwanted + or undesirable pixels. + They have the following meaning: + + * bit 0: gap (pixel with no sensor) + * bit 1: dead + * bit 2: under responding + * bit 3: over responding + * bit 4: noisy + * bit 5: -undefined- + * bit 6: pixel is part of a cluster of problematic pixels (bit set in addition to others) + * bit 7: -undefined- + * bit 8: user defined mask (e.g. around beamstop) + * bits 9-30: -undefined- + * bit 31: virtual pixel (corner pixel with interpolated value) + + Normal data analysis software would + not take pixels into account + when a bit in (mask & 0x0000FFFF) is + set. Tag bit in the upper + two bytes would indicate special pixel + properties that normally + would not be a sole reason to reject the + intensity value (unless + lower bits are set. + + If the full bit depths is not required, providing a + mask with fewer bits is permissible. + </doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="countrate_correction_applied" type="NX_BOOLEAN" + minOccurs="0"> + <doc> + True when a count-rate correction has already been applied in + the data recorded here, false otherwise. + </doc> + </field> + + <field name="bit_depth_readout" type="NX_INT" minOccurs="0"> + <doc> + How many bits the electronics record per pixel. + </doc> + </field> + + <field name="detector_readout_time" type="NX_FLOAT" units="NX_TIME" + minOccurs="0"> + <doc> + Time it takes to read the detector (typically milliseconds). + This is important to know for time resolved experiments. + </doc> + </field> + + <field name="frame_time" type="NX_FLOAT" units="NX_TIME" + minOccurs="0"> + <doc> + This is time for each frame. This is exposure_time + readout + time. + </doc> + </field> + + <field name="gain_setting" type="NX_CHAR" minOccurs="0"> + <doc> + The gain setting of the detector. This influences background. + </doc> + </field> + + <field name="saturation_value" type="NX_INT" minOccurs="0"> + <doc> + The value at which the detector goes into saturation. + Data + above this value is known to be invalid. + </doc> + </field> + + <field name="sensor_material" type="NX_CHAR" minOccurs="0"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter + like a scintillator. + This is the name of this converter material. + </doc> + </field> + + <field name="sensor_thickness" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter + like a scintillator. This is the thickness of this + converter + material. + </doc> + </field> + + <field name="threshold_energy" type="NX_FLOAT" units="NX_ENERGY" + minOccurs="0"> + <doc> + Single photon counter detectors can be adjusted for a certain + energy range in which they work optimally. This is the energy + setting for this. + </doc> + </field> + + <field name="type" minOccurs="0"> + <doc> + Description of type such as scintillator, + ccd, pixel, image + plate, CMOS, ... + </doc> + </field> + </group> + </group> + + <group type="NXsample"> + <field name="name" type="NX_CHAR" minOccurs="0"> + <doc>Descriptive name of sample</doc> + </field> + + <field name="depends_on" type="NX_CHAR" minOccurs="0"> + <!-- better type for paths the need to resolve --> + <doc> + This is a requirement to describe for any scan experiment. + The reason it is optional is mainly to accommodate XFEL + single shot exposures. + + The axis on which the sample position depends may be stored + anywhere, but is normally stored in the NXtransformations + NXtransformations group within the NXsample group. + </doc> + </field> + + <group type="NXtransformations" minOccurs="0"> + <doc> + This is the recommended location for sample goniometer + and other related axes. + + This is a requirement to describe for any scan experiment. + The reason it is optional is mainly to accommodate XFEL + single shot exposures. + + Use of the depends_on field and the NXtransformations group is + strongly recommended. As noted above this should be an absolute + requirement to have for any scan experiment. + + The reason it is optional is mainly to accommodate XFEL + single shot exposures. + </doc> + </group> + + <field name="temperature" units="NX_TEMPERATURE" minOccurs="0" /> + + <group type="NXbeam"> + <field name="incident_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH" + minOccurs="0" > + <doc> + In the case of a monchromatic beam this is the scalar + wavelength. + + In the case of a polychromatic beam this is an array of + the wavelengths with the relative weights in + incident_wavelength_weight. + </doc> + </field> + + <field name="incident_wavelength_weight" type="NX_FLOAT" minOccurs="0" > + <doc> + In the case of a polychromatic beam this is an array of the + relative weights of the corresponding wavelengths in + incident_wavelength. + </doc> + </field> + + <field name="incident_wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH" + minOccurs="0" > + <doc> + The wavelength spread FWHM for the corresponding + wavelength(s) in incident_wavelength. + </doc> + </field> + + <group name="incident_wavelength_spectrum" type="NXdata" + minOccurs="0" /> + + <field name="flux" type="NX_FLOAT" units="NX_FLUX" minOccurs="0"> + <doc> + flux incident on beam plane area in photons + per second per unit area + </doc> + </field> + + <field name="total_flux" type="NX_FLOAT" units="NX_FREQUENCY" minOccurs="0"> + <doc> + flux incident on beam plane in photons per second + </doc> + </field> + + <field name="incident_beam_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0"> + <doc> + Two-element array of FWHM (if Gaussian or Airy function) or + diameters (if top hat) or widths (if rectangular) of beam + in the order x, y + </doc> + <dimensions rank="1"> + <dim index="1" value="2"/> + </dimensions> + </field> + + <field name="profile" type="NX_CHAR" minOccurs="0"> + <doc> + The beam profile, Gaussian, Airy function, top-hat or + rectangular. The profile is given in the plane of + incidence of the beam on the sample. + </doc> + <enumeration> + <item value="Gaussian"/> + <item value="Airy"/> + <item value="top-hat"/> + <item value="rectangular"/> + </enumeration> + </field> + + + <field name="incident_polarisation_stokes" minOccurs="0"> + <dimensions rank="2"> + <dim index="1" value="np" /> + <dim index="2" value="4" /> + </dimensions> + </field> + </group> + </group> + + <group type="NXdata" /> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXrefscan.nxdl.xml b/src/punx/cache/v2018.5/applications/NXrefscan.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d4d112e152bbc9a688fc844999d05d7f431bd62e --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXrefscan.nxdl.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXrefscan" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is an application definition for a monochromatic scanning reflectometer. + + It does not have the information to calculate the resolution + since it does not have any apertures. + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXrefscan"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + <group type="NXdetector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_FLOAT" units="NX_ANY"> + <doc>Monitor counts for each step</doc> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXreftof.nxdl.xml b/src/punx/cache/v2018.5/applications/NXreftof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..9a00999c123dad4e04749dcfd36f190b06b7ad28 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXreftof.nxdl.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXreftof" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is an application definition for raw data from a TOF reflectometer. </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXreftof"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <field name="name" type="NX_CHAR"></field> + <group type="NXdisk_chopper" name="chopper"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance between chopper and sample</doc> + </field> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="xsize" /> + <dim index="2" value="ysize" /> + <dim index="3" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="3"> + <doc> + Array of time values for each bin in a time-of-flight + measurement + </doc> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="x_pixel_size" type="NX_FLOAT" + units="NX_LENGTH"> + </field> + <field name="y_pixel_size" type="NX_FLOAT" + units="NX_LENGTH"> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT" units="NX_ANY"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_INT"> + <doc>Total integral monitor counts</doc> + </field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <doc>Time channels</doc> + </field> + <field name="data" type="NX_INT" signal="1"> + <doc>Monitor counts in each time channel</doc> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="time_binning" target="/NXentry/NXinstrument/NXdetector/time_binning"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXsas.nxdl.xml b/src/punx/cache/v2018.5/applications/NXsas.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..40788aa2066eda43251847057eb218911e9c376a --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXsas.nxdl.xml @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsas" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw, monochromatic 2-D SAS data with an area detector + + This is an application definition for raw data (not processed or reduced data) + from a 2-D small angle scattering instrument collected with a monochromatic + beam and an area detector. It is meant to be suitable both for neutron SANS + and X-ray SAXS data. + + It covers all raw data from any monochromatic SAS techniques that + use an area detector: SAS, WSAS, grazing incidence, GISAS + + It covers all raw data from any SAS techniques + that use an area detector + and a monochromatic beam. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use ``entry1``, ``entry2``, ... + for analysis software to locate each entry + </doc> + </attribute> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXsas"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <field name="type"> + <doc>type of radiation source</doc> + </field> + <field name="name"> + <doc>Name of the radiation source</doc> + </field> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" units="NX_WAVELENGTH" type="NX_FLOAT"> + <doc>The wavelength of the radiation</doc> + </field> + <field name="wavelength_spread" type="NX_FLOAT"> + <doc> + delta_lambda/lambda (:math:`\Delta\lambda/\lambda`): + Important for resolution calculations + </doc> + </field> + </group> + <group type="NXcollimator" name="collimator"> + <group type="NXgeometry" name="geometry"> + <group type="NXshape" name="shape"> + <field name="shape" type="NX_CHAR"> + <enumeration> + <item value="nxcylinder"/> + <item value="nxbox"/> + </enumeration> + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The collimation length</doc> + </field> + </group> + </group> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_NUMBER" signal="1"> + <doc> + This is area detector data, of number of x-pixel versus + number of y-pixels. Since the beam center is to be + determined as a step of data reduction, it is not necessary + to document or assume the position of the beam center in + acquired data. + </doc> + <dimensions rank="2"> + <dim index="1" value="nXPixel" /> + <dim index="2" value="nYPixel" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The distance between detector and sample</doc> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Physical size of a pixel in x-direction</doc> + </field> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Size of a pixel in y direction</doc> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument actually used to perform the experiment</doc> + </field> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time + (timer) or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXsastof.nxdl.xml b/src/punx/cache/v2018.5/applications/NXsastof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c56045d662250d64995aa8a772632fd15f96afba --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXsastof.nxdl.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsastof" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw, 2-D SAS data with an area detector with a time-of-flight source + + It covers all raw data from any SAS techniques + that use an area detector + at a time-of-flight source. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc>NeXus convention is to use "entry1", "entry2", ... for analysis software to locate each entry</doc> + </attribute> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXsastof"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <field name="type"> + <doc>type of radiation source</doc> + </field> + <field name="name"> + <doc>Name of the radiation source</doc> + </field> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXcollimator" name="collimator"> + <group type="NXgeometry" name="geometry"> + <group type="NXshape" name="shape"> + <field name="shape" type="NX_CHAR"> + <enumeration> + <item value="nxcylinder"/> + <item value="nxbox"/> + </enumeration> + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The collimation length</doc> + </field> + </group> + </group> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_NUMBER" signal="1"> + <doc> + This is area detector data, of number of x-pixel versus + number of y-pixels. Since the beam center is to be + determined as a step of data reduction, it is not necessary + to document or assume the position of the beam center in + acquired data. + </doc> + <dimensions rank="3"> + <dim index="1" value="nXPixel" /> + <dim index="2" value="nYPixel" /> + <dim index="3" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /></dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The distance between detector and sample</doc> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Physical size of a pixel in x-direction</doc> + </field> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Size of a pixel in y direction</doc> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument actually used to perform the experiment</doc> + </field> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> Count to a preset value based on either clock time (timer) or received monitor counts (monitor). </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT" primary="1" signal="1"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXscan.nxdl.xml b/src/punx/cache/v2018.5/applications/NXscan.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..15d9156db4df96b5c460777a036c0f9f477d67e6 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXscan.nxdl.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXscan" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Application definition for a generic scan instrument. + + This definition is more an + example then a stringent definition as the content of a given NeXus scan file needs to + differ for different types of scans. This example definition shows a scan like done + on a rotation camera: the sample is rotated and a detector image, the rotation angle + and a monitor value is stored at each step in the scan. In the following, the symbol + ``NP`` is used to represent the number of scan points. These are the rules for + storing scan data in NeXus files which are implemented in this example: + + * Each value varied throughout a scan is stored as an array of + length ``NP`` at its respective location within the NeXus hierarchy. + * For area detectors, ``NP`` is the first dimension, + example for a detector of 256x256: ``data[NP,256,256]`` + * The NXdata group contains links to all variables varied in the scan and the data. + This to give an equivalent to the more familiar classical tabular representation of scans. + + These rules exist for a reason: HDF allows the first dimension of a data set to be + unlimited. This means the data can be appended too. Thus a NeXus file built according + to the rules given above can be used in the following way: + + * At the start of a scan, write all the static information. + * At each scan point, append new data from varied variables + and the detector to the file. + </doc> + <group type="NXentry"> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="definition" type="NX_CHAR"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXscan"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXdetector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="NP" /> + <dim index="2" value="xdim" /> + <dim index="3" value="ydim" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="rotation_angle" type="NX_FLOAT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + </group> + <group type="NXmonitor"> + <field name="data" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + </group> + <group type="NXdata"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXspe.nxdl.xml b/src/punx/cache/v2018.5/applications/NXspe.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c100b5d8777ab9603605329b50597120088a284 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXspe.nxdl.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + name="NXspe" + extends="NXobject" + type="group" + category="application" +> + <doc>NXSPE Inelastic Format. Application definition for NXSPE file format. </doc> + <group type="NXentry"> + <field name="program_name"/> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this file conforms.</doc> + <attribute name="version"/> + <enumeration> + <item value="NXSPE"/> + <item value="NXspe"/> + </enumeration> + </field> + <group type="NXcollection" name="NXSPE_info"> + <field name="fixed_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>The fixed energy used for this file.</doc> + </field> + <field name="ki_over_kf_scaling" type="NX_BOOLEAN"> + <doc>Indicates whether ki/kf scaling has been applied or not.</doc> + </field> + <field name="psi" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Orientation angle as expected in DCS-MSlice</doc> + </field> + </group> + <group type="NXdata" name="data"> + <field name="azimuthal" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="azimuthal_width" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="polar" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="polar_width" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="data" type="NX_NUMBER"/> + <field name="error" type="NX_NUMBER"/> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"/> + </group> + <group type="NXinstrument"> + <field name="name" type="NX_CHAR"/> + <group type="NXfermi_chopper"> + <field name="energy" type="NX_NUMBER" units="NX_ENERGY"/> + </group> + </group> + <group type="NXsample"> + <field name="rotation_angle" type="NX_NUMBER" units="NX_ANGLE"/> + <field name="seblock" type="NX_CHAR"/> + <field name="temperature" type="NX_NUMBER" units="NX_TEMPERATURE"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXsqom.nxdl.xml b/src/punx/cache/v2018.5/applications/NXsqom.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..8cf07f458d9f1196a915eb3ded661d7d8f0b98ff --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXsqom.nxdl.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsqom" extends="NXobject" type="group" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is the application definition for S(Q,OM) processed data. + + As this kind of data is in + general not on a rectangular grid after data reduction, it is stored as Q,E positions plus their + intensity, table like. It is the task of a possible visualisation program to regrid this data in + a sensible way. + </doc> + <group type="NXentry"> + <attribute name="entry"> </attribute> + <field name="title"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXsqom"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type"/> + <field name="name"/> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + <item value="electron"/> + </enumeration> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument from which this data was reduced. </doc> + </field> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="reduction"> + <field name="program" type="NX_CHAR"/> + <field name="version" type="NX_CHAR"/> + <group type="NXparameters" name="input"> + <field name="filenames" type="NX_CHAR"> + <doc>Raw data files used to generate this I(Q)</doc> + </field> + <doc>Input parameters for the reduction program used</doc> + </group> + <group type="NXparameters" name="output"> + <doc>Eventual output parameters from the data reduction program used</doc> + </group> + </group> + <group type="NXdata"> + <field name="data" type="NX_INT" signal="1"> + <doc> This is the intensity for each point in QE </doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="qx" axis="1" units="NX_WAVENUMBER"> + <doc>Positions for the first dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="qy" axis="1" units="NX_WAVENUMBER"> + <doc>Positions for the the second dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="qz" axis="1" units="NX_WAVENUMBER"> + <doc>Positions for the the third dimension of Q</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + <field name="en" axis="1" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Values for the energy transfer for each point</doc> + <dimensions rank="1"> + <dim index="1" value="NP"/> + </dimensions> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXstxm.nxdl.xml b/src/punx/cache/v2018.5/applications/NXstxm.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..e2141cef10b96ee9d24b06b9872c15588cc8b611 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXstxm.nxdl.xml @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition name="NXstxm" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <symbols> + <doc>These symbols will be used below to coordinate the shapes of the datasets.</doc> + <symbol name="numP"><doc>total number of scan points</doc></symbol> + <symbol name="numE"><doc>number of photon energies scanned</doc></symbol> + <symbol name="numY"><doc>number of pixels in Y direction</doc></symbol> + <symbol name="numX"><doc>number of pixels in X direction</doc></symbol> + </symbols> + <doc> + Application definition for a STXM instrument. + + The interferometer + position measurements, monochromator photon energy values and + detector measurements are all treated as NXdetectors and stored + within the NXinstrument group as lists of values stored in + chronological order. The NXdata group then holds another version + of the data in a regular 3D array (NumE by NumY by NumX, for a + total of NumP points in a sample image stack type scan). The former + data values should be stored with a minimum loss of precision, while + the latter values can be simplified and/or approximated in order to + fit the constraints of a regular 3D array. 'Line scans' and 'point spectra' + are just sample_image scan types with reduced dimensions in the same way + as single images have reduced E dimensions compared to image 'stacks'. + </doc> + <group type="NXentry"> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="definition" type="NX_CHAR" minOccurs="1" maxOccurs="1"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXstxm"/> + </enumeration> + </field> + <group type="NXinstrument" minOccurs="1" maxOccurs="1"> + <group type="NXsource" minOccurs="1" maxOccurs="1"> + <field name="type" minOccurs="1" maxOccurs="1"/> + <field name="name" minOccurs="1" maxOccurs="1"/> + <field name="probe" minOccurs="1" maxOccurs="1"/> + </group> + <group type="NXmonochromator" name="monochromator" minOccurs="1" maxOccurs="1"> + <field name="energy" minOccurs="1" maxOccurs="1"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" minOccurs="1"> + <field name="data" type="NX_NUMBER"> + <dimensions> + <doc> Detector data should be presented with the first dimension corresponding to the + scan point and subsequent dimensions corresponding to the output of the detector. + Detectors that provide more than one value per scan point should have + a data array of rank 1+d, where d is the dimensions of the array provided per + scan point. For example, an area detector should have an NXdetector data array + of 3 dimensions, with the first being the set of scan points and the latter + two being the x- and y- extent of the detector </doc> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample_x" minOccurs="0" maxOccurs="1"> + <doc> Measurements of the sample position from the x-axis interferometer.</doc> + <field name="data" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample_y" minOccurs="0" maxOccurs="1"> + <doc> Measurements of the sample position from the y-axis interferometer.</doc> + <field name="data" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample_z" minOccurs="0" maxOccurs="1"> + <doc> Measurements of the sample position from the z-axis interferometer.</doc> + <field name="data" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="NumP" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="rotation_angle" type="NX_FLOAT" /> + </group> + <group type="NXdata"> + <field name="stxm_scan_type" minOccurs="1" maxOccurs="1"> + <doc> Label for typical scan types as a convenience for humans. + Each label corresponds to a specific set of axes being scanned + to produce a data array of shape: + + * sample point spectrum: (photon_energy,) + * sample line spectrum: (photon_energy, sample_y/sample_x) + * sample image: (sample_y, sample_x) + * sample image stack: (photon_energy, sample_y, sample_x) + * sample focus: (zoneplate_z, sample_y/sample_x) + * osa image: (osa_y, osa_x) + * osa focus: (zoneplate_z, osa_y/osa_x) + * detector image: (detector_y, detector_x) + + The "generic scan" string is to be used when none of the + other choices are appropriate. + </doc> + <enumeration> + <item value="sample point spectrum"/> + <item value="sample line spectrum"/> + <item value="sample image"/> + <item value="sample image stack"/> + <item value="sample focus"/> + <item value="osa image"/> + <item value="osa focus"/> + <item value="detector image"/> + <item value="generic scan"/> + </enumeration> + </field> + <field name="data" type="NX_NUMBER" signal="1"> + <doc> Detectors that provide more than one value per scan point should be summarised + to a single value per scan point for this array in order to simplify plotting. + + Note that 'Line scans' and focus type scans measure along one spatial dimension + but are not restricted to being parallel to the X or Y axes. Such scans + should therefore use a single dimension for the positions along the spatial + line. The 'sample_x' and 'sample_y' fields should then contain lists of the + x- and y-positions and should both have the 'axis' attribute pointing to the same dimension.</doc> + </field> + <field name="energy" type="NX_FLOAT" minOccurs="1" maxOccurs="1"> + <doc> List of photon energies of the X-ray beam. If scanned through multiple values, + then an 'axis' attribute will be required to link the field to the appropriate data array dimension.</doc> + <dimensions rank="1"> + <dim index="1" value="NumE" /> + </dimensions> + </field> + <field name="sample_y" type="NX_FLOAT" minOccurs="1" maxOccurs="1"> + <doc> List of Y positions on the sample. If scanned through multiple values, + then an 'axis' attribute will be required to link the field to the appropriate data array dimension.</doc> + <dimensions rank="1"> + <dim index="1" value="NumY" /> + </dimensions> + </field> + <field name="sample_x" type="NX_FLOAT" minOccurs="1" maxOccurs="1"> + <doc> List of X positions on the sample. If scanned through multiple values, + then an 'axis' attribute will be required to link the field to the appropriate data array dimension.</doc> + <dimensions rank="1"> + <dim index="1" value="NumX" /> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control" minOccurs="0" maxOccurs="1"> + <field name="data" type="NX_FLOAT"> + <doc> Values to use to normalise for time-variations in photon flux. Typically, the synchrotron storage ring + electron beam current is used as a proxy for the X-ray beam intensity. Array must have same shape as the + NXdata groups.</doc> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtas.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtas.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1562fe207e4e5855e8662b33951c95922f148a01 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtas.nxdl.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtas" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This is an application definition for a triple axis spectrometer. + + It is for the trademark scan of the TAS, the Q-E scan. + For your alignment scans use the rules in :ref:`NXscan`. + </doc> + <group type="NXentry" name="entry"> + <field name="title" type="NX_CHAR" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtas"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + </enumeration> + </field> + </group> + <group type="NXcrystal" name="monochromator"> + <field name="ei" type="NX_FLOAT" units="NX_ENERGY" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXcrystal" name="analyser"> + <field name="ef" type="NX_FLOAT" units="NX_ENERGY" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdetector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="qh" type="NX_FLOAT" units="NX_DIMENSIONLESS" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="qk" type="NX_FLOAT" units="NX_DIMENSIONLESS" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="ql" type="NX_FLOAT" units="NX_DIMENSIONLESS" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="en" type="NX_FLOAT" units="NX_ENERGY" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="sgu" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="sgl" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <dimensions rank="1"> + <dim index="1" value="9"/> + </dimensions> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + <dimensions rank="1"> + <dim index="1" value="np"></dim></dimensions> + </field> + </group> + <group type="NXdata"> + <doc>One of the ei,ef,qh,qk,ql,en should get a primary=1 attribute to denote the main scan axis</doc> + <link name="ei" target="/NXentry/NXinstrument/monochromator:NXcrystal/ei"/> + <link name="ef" target="/NXentry/NXinstrument/analyzer:NXcrystal/ef"/> + <link name="en" target="/NXentry/NXsample/en"/> + <link name="qh" target="/NXentry/NXsample/qh"/> + <link name="qk" target="/NXentry/NXsample/qk"/> + <link name="ql" target="/NXentry/NXsample/ql"/> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtofnpd.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtofnpd.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ac6887e2b7ff0c8a685e47665e4f1d5a8afa4f7 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtofnpd.nxdl.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtofnpd" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is a application definition for raw data from a TOF neutron powder diffractometer</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtofnpd"></item> + </enumeration> + </field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flight path before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field></group> + <group type="NXinstrument"> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="2"> + <dim index="1" value="ndet" /><dim index="2" value="ntimechan" /> + </dimensions> + </field> + <field name="detector_number" type="NX_INT" axis="2"> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions></field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance to sample for each detector</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>azimuthal angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="detector_number" target="/NXentry/NXinstrument/NXdetector/detector_number"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtofraw.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtofraw.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..0ee2155806c748ad37bd367e000c7da9a7eda83c --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtofraw.nxdl.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtofraw" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is an application definition for raw data from a generic TOF instrument</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtofraw"></item> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT"></field> + <field name="run_number" type="NX_INT"></field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flight path before the sample position. This can be determined by a chopper, + by the moderator, or the source itself. In other words: it is the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field></group> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="2"> + <dim index="1" value="ndet" /> + <dim index="2" value="ntimechan" /> + </dimensions> + </field> + <field name="detector_number" type="NX_INT" axis="2"> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance to sample for each detector</doc> + <dimensions rank="1"> + <dim index="1" value="ndet" /> + </dimensions> + </field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim> + </dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature" type="NX_CHAR"> + <enumeration> + <item value="powder"></item> + <item value="liquid"></item> + <item value="single crystal"></item> + </enumeration></field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + <field name="integral_counts" type="NX_INT" units="NX_UNITLESS"></field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="detector_number" target="/NXentry/NXinstrument/NXdetector/detector_number"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtofsingle.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtofsingle.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4011a1d876b716a58c9b0b11ece0d8601702c35f --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtofsingle.nxdl.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtofsingle" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is a application definition for raw data from a generic TOF instrument</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtofsingle"></item> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT"></field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flight path before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group type="NXuser" name="user"> + <field name="name" type="NX_CHAR"></field></group> + <group type="NXinstrument"> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="xsize" /> + <dim index="2" value="ysize" /> + <dim index="3" value="ntimechan" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance to sample for the center of the detector</doc> + <dimensions rank="1"> + <dim index="1" value="1" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>polar angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + <doc>azimuthal angle for each detector element</doc> + <dimensions rank="1"> + <dim index="1" value="ndet"></dim></dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature" type="NX_CHAR"> + <enumeration> + <item value="powder"></item> + <item value="liquid"></item> + <item value="single crystal"></item> + </enumeration></field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions></field> + <field name="time_of_flight" type="NX_FLOAT" + units="NX_TIME_OF_FLIGHT" axis="1"> + <dimensions rank="1"> + <dim index="1" value="ntimechan" /></dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + <link name="detector_number" target="/NXentry/NXinstrument/NXdetector/detector_number"></link> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtomo.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtomo.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..337b22d5508edbf8444f8898cea32c77f597893a --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtomo.nxdl.xml @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtomo" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="nFrames"><doc>number of frames</doc></symbol> + <symbol name="xsize"><doc>number of pixels in X direction</doc></symbol> + <symbol name="ysize"><doc>number of pixels in Y direction</doc></symbol> + </symbols> + + <doc> + This is the application definition for x-ray or neutron tomography raw data. + + In tomography + a number of dark field images are measured, some bright field images and, of course the sample. + In order to distinguish between them images carry a image_key. + </doc> + <group type="NXentry" name="entry"> + <field name="title" minOccurs="0" maxOccurs="1"/> + <field name="start_time" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"/> + <field name="end_time" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtomo"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" minOccurs="0" maxOccurs="1"> + <field name="type" minOccurs="0" maxOccurs="1"/> + <field name="name" minOccurs="0" maxOccurs="1"/> + <field name="probe" minOccurs="0" maxOccurs="1"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="nFrames" /> + <dim index="2" value="xsize" /> + <dim index="3" value="ysize" /> + </dimensions> + </field> + <field name="image_key" type="NX_INT" > + <doc> + In order + to distinguish between sample projectrions, dark and flat + images, a magic number is recorded per frame. + The key is as follows: + + * projection = 0 + * flat field = 1 + * dark field = 2 + * invalid = 3 + </doc> + <dimensions rank="1"> + <dim index="1" value="nFrames" /> + </dimensions> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>Distance between detector and sample</doc> + </field> + <field name="x_rotation_axis_pixel_position" type="NX_FLOAT" minOccurs="0" maxOccurs="1"/> + <field name="y_rotation_axis_pixel_position" type="NX_FLOAT" minOccurs="0" maxOccurs="1"/> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + In practice this axis is always aligned along one pixel direction on the detector and usually vertical. + There are experiments with horizontal rotation axes, so this would need to be indicated somehow. + For now the best way for that is an open question. + </doc> + <dimensions rank="1"> + <dim index="1" value="nFrames" /> + </dimensions> + </field> + <field name="x_translation" units="NX_LENGTH" type="NX_FLOAT" minOccurs="0" maxOccurs="1"> + <dimensions rank="1"> + <dim value="nFrames" index="1"/> + </dimensions> + </field> + <field name="y_translation" units="NX_LENGTH" type="NX_FLOAT" minOccurs="0" maxOccurs="1"> + <dimensions rank="1"> + <dim value="nFrames" index="1"/> + </dimensions> + </field> + <field name="z_translation" units="NX_LENGTH" type="NX_FLOAT" minOccurs="0" maxOccurs="1"> + <dimensions rank="1"> + <dim value="nFrames" index="1"/> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control" minOccurs="0" maxOccurs="1"> + <field name="data" type="NX_FLOAT" units="NX_ANY"> + <doc> + Total integral monitor counts for each measured frame. Allows a to correction for + fluctuations in the beam between frames. + </doc> + <dimensions rank="1"> + <dim index="1" value="nFrames" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/detector:NXdetector/data"/> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"/> + <link name="image_key" target="/NXentry/NXinstrument/detector:NXdetector/image_key"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtomophase.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtomophase.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5996d5882e5c3079827b6a3ea0bba422974fbea --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtomophase.nxdl.xml @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtomophase" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="nBrightFrames"><doc>number of bright frames</doc></symbol> + <symbol name="nDarkFrames"><doc>number of dark frames</doc></symbol> + <symbol name="nSampleFrames"><doc>number of image (sample) frames</doc></symbol> + <symbol name="nPhase"><doc>number of phase settings</doc></symbol> + <symbol name="xsize"><doc>number of pixels in X direction</doc></symbol> + <symbol name="ysize"><doc>number of pixels in Y direction</doc></symbol> + </symbols> + + <doc> + This is the application definition for x-ray or neutron tomography raw data with phase contrast variation at each point. + + In tomography first + some dark field images are measured, some bright field images and, of course the sample. In order + to properly sort the order of the images taken, a sequence number is stored with each image. + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="end_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtomophase"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXdetector" name="bright_field"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="nBrightFrames" /> + <dim index="2" value="xsize" /> + <dim index="3" value="ysize" /> + </dimensions> + </field> + <field name="sequence_number" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="nBrightFrames" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="dark_field"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="3"> + <dim index="1" value="nDarkFrames" /> + <dim index="2" value="xsize" /> + <dim index="3" value="ysize" /> + </dimensions> + </field> + <field name="sequence_number" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="nDarkFrames" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="sample"> + <field name="data" type="NX_INT" signal="1"> + <dimensions rank="4"> + <dim index="1" value="nSampleFrames" /> + <dim index="2" value="nPhase" /> + <dim index="3" value="xsize" /> + <dim index="4" value="ysize" /> + </dimensions> + </field> + <field name="sequence_number" type="NX_INT"> + <dimensions rank="2"> + <dim index="1" value="nSampleFrames" /> + <dim index="2" value="nPhase" /> + </dimensions> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance between detector and sample</doc> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <dimensions rank="1"> + <dim index="1" value="nSampleFrames" /> + </dimensions> + </field> + <field name="x_translation" units="NX_LENGTH" type="NX_FLOAT"> + <dimensions rank="1"> + <dim value="nSampleFrames" index="1"/> + </dimensions> + </field> + <field name="y_translation" units="NX_LENGTH" type="NX_FLOAT"> + <dimensions rank="1"> + <dim value="nSampleFrames" index="1"/> + </dimensions> + </field> + <field name="z_translation" units="NX_LENGTH" type="NX_FLOAT"> + <dimensions rank="1"> + <dim value="nSampleFrames" index="1"/> + </dimensions> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc> + Total integral monitor counts for each measured frame. Allows a correction for + fluctuations in the beam between frames. + </doc> + <dimensions rank="1"> + <dim index="1" value="nDarkFrames + nBrightFrames + nSampleFrame" /> + <!-- TODO: nPhase? --> + </dimensions> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/sample:NXdetector/data"/> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXtomoproc.nxdl.xml b/src/punx/cache/v2018.5/applications/NXtomoproc.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..cbedef51aff8ffa5ee21aa03d677a42cc191de3c --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXtomoproc.nxdl.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXtomoproc" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="nx"><doc>number of voxels in X direction</doc></symbol> + <symbol name="ny"><doc>number of voxels in Y direction</doc></symbol> + <symbol name="nz"><doc>number of voxels in Z direction</doc></symbol> + </symbols> + + <doc>This is an application definition for the final result of a tomography experiment: a 3D construction of some volume of physical properties.</doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXtomoproc"/> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="reconstruction"> + <field name="program" type="NX_CHAR"> + <doc>Name of the program used for reconstruction</doc> + </field> + <field name="version" type="NX_CHAR"> + <doc>Version of the program used</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date and time of reconstruction processing.</doc> + </field> + <group type="NXparameters" name="parameters"> + <field name="raw_file" type="NX_CHAR"> + <doc>Original raw data file this data was derived from</doc> + </field> + </group> + </group> + <group type="NXdata" name="data"> + <field name="data" type="NX_INT" signal="1"> + <doc> + This is the reconstructed volume. This can be different + things. Please indicate in the unit attribute what physical + quantity this really is. + </doc> + <dimensions rank="3"> + <dim index="1" value="nx" /> + <dim index="2" value="nx" /> + <dim index="3" value="nz" /> + </dimensions> + <attribute name="transform"></attribute> + <attribute name="offset"></attribute> + <attribute name="scaling"></attribute> + </field> + <field name="x" type="NX_FLOAT" units="NX_ANY" axis="1"> + <doc> + This is an array holding the values to use for the x-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nx" /> + </dimensions> + </field> + <field name="y" type="NX_FLOAT" units="NX_ANY" axis="2"> + <doc> + This is an array holding the values to use for the y-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="ny" /> + </dimensions> + </field> + <field name="z" type="NX_FLOAT" units="NX_ANY" axis="3"> + <doc> + This is an array holding the values to use for the z-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nz" /> + </dimensions> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxas.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxas.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0802b8e4d246fbbc18ec4196c08a0975b1ef439 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxas.nxdl.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxas" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd " + > + <doc> + This is an application definition for raw data from an X-ray absorption spectroscopy experiment. + + This is essentially a scan on energy versus incoming/ + absorbed beam. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use "entry1", "entry2", ... + for analysis software to locate each entry. + </doc> + </attribute> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxas"></item> + </enumeration> + </field> + <group type="NXinstrument"> + <group type="NXsource"> + <field name="type"/> + <field name="name"/> + <field name="probe"> + <enumeration> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="energy" axis="1" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="incoming_beam"> + <field name="data" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdetector" name="absorbed_beam"> + <field name="data" type="NX_INT"> + <doc>mark this field with attribute ``signal=1``</doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXmonitor"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT"> + <dimensions rank="1"> + <dim index="1" value="np" /></dimensions></field> + </group> + <group type="NXdata"> + <link name="energy" target="/entry/instrument/monochromator/energy"></link> + <link name="absorbed_beam" target="/entry/instrument/absorbed_beam/data"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxasproc.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxasproc.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..5d382d02703a04b167926a007e5e7cd1595fdb57 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxasproc.nxdl.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxasproc" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd " + > + <doc> + Processed data from XAS. This is energy versus I(incoming)/I(absorbed). + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use "entry1", "entry2", ... + for analysis software to locate each entry. + </doc> + </attribute> + <field name="title"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxasproc"></item> + </enumeration> + </field> + <group type="NXsample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + </group> + <group type="NXprocess" name="XAS_data_reduction"> + <field name="program" type="NX_CHAR"> + <doc>Name of the program used for reconstruction</doc> + </field> + <field name="version" type="NX_CHAR"> + <doc>Version of the program used</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date and time of reconstruction processing.</doc> + </field> + <group type="NXparameters" name="parameters"> + <field name="raw_file" type="NX_CHAR"> + <doc>Original raw data file this data was derived from</doc> + </field> + </group> + </group> + <group type="NXdata"> + <field name="energy" axis="1"> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="data" type="NX_FLOAT"> + <doc> + This is corrected and calibrated I(incoming)/I(absorbed). So it is the absorption. + Expect attribute ``signal=1`` + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxbase.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxbase.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..3898e1b2377f4aca8465ba3994cb3a3e5bda6ac1 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxbase.nxdl.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxbase" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + This definition covers the common parts of all monochromatic single crystal raw data application definitions. + </doc> + <group type="NXentry" name="entry"> + <field name="title" /> + <field name="start_time" type="NX_DATE_TIME" /> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxbase"></item> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <field name="type" /> + <field name="name" /> + <field name="probe"> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="electron" /> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + <group type="NXdetector" name="detector" maxOccurs="unbounded"> + <field name="data" type="NX_INT" signal="1"> + <doc> + The area detector data, the first dimension is always the + number of scan points, the second and third are the number + of pixels in x and y. The origin is always assumed to be + in the center of the detector. maxOccurs is limited to the + the number of detectors on your instrument. + </doc> + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="number of x pixels" /> + <dim index="3" value="number of y pixels" /> + </dimensions> + <attribute name="signal" type="NX_POSINT"> + <enumeration> + <item value="1" /> + </enumeration> + </attribute> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"/> + <doc> + The name of the group is detector if there is only one detector, + if there are several, names have to be detector1, + detector2, ...detectorn.</doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="frame_start_number" type="NX_INT"> + <doc> + This is the start number of the first frame of a scan. In PX one often scans a couple + of frames on a give sample, then does something else, then returns to the same sample + and scans some more frames. Each time with a new data file. + This number helps concatenating such measurements. + </doc> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="name" type="NX_CHAR"> + <doc>Descriptive name of sample</doc> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + The orientation matrix according to Busing and + Levy conventions. This is not strictly necessary as + the UB can always be derived from the data. But + let us bow to common usage which includes the + UB nearly always. + </doc> + <dimensions rank="2"> + <dim index="1" value="3" /> + <dim index="2" value="3" /> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT"> + <doc> + The unit cell, a, b, c, alpha, beta, gamma. + Again, not strictly necessary, but normally written. + </doc> + <dimensions rank="1"> + <dim index="1" value="6" /> + </dimensions> + </field> + <field name="temperature" type="NX_FLOAT"> + <doc> + The sample temperature or whatever sensor represents this value best + </doc> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + <field name="x_translation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the X-direction of the laboratory coordinate system</doc> + </field> + <field name="y_translation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the Y-direction of the laboratory coordinate system</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the Z-direction of the laboratory coordinate system</doc> + </field> + + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + </group> + <group type="NXdata"> + <doc> + The name of this group id data if there is only + one detector; if there are several the names will + be data1, data2, data3 and will point + to the corresponding detector groups in the + instrument hierarchy. + </doc> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxeuler.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxeuler.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..efd7f949a525c618865f8d763e11be69bb1d7bbc --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxeuler.nxdl.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxeuler" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw data from a :index:`four-circle diffractometer` with an :index:`eulerian cradle`, extends :ref:`NXxbase` + + It extends :ref:`NXxbase`, so the full definition is the content + of :ref:`NXxbase` plus the data defined here. All four angles are + logged in order to support arbitrary scans in reciprocal space. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxeuler"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + The polar_angle (two theta) where the detector is placed + at each scan point. + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + This is an array holding the sample rotation angle at each + scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="chi" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + This is an array holding the chi angle of the eulerian + cradle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="phi" type="NX_FLOAT" units="NX_ANGLE" signal="1"> + <doc> + This is an array holding the phi rotation of the eulerian + cradle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + <link name="chi" target="/NXentry/NXsample/chi"></link> + <link name="phi" target="/NXentry/NXsample/phi"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxkappa.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxkappa.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f2e4575ac34a5e971f49e00e32abdb2dee0580cb --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxkappa.nxdl.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxkappa" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw data from a kappa geometry (CAD4) single crystal diffractometer, extends :ref:`NXxbase` + + This is the application definition for raw data from a kappa geometry + (CAD4) single crystal + diffractometer. It extends :ref:`NXxbase`, so the full definition is + the content of :ref:`NXxbase` plus the + data defined here. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxkappa"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The polar_angle (two theta) at each scan point</doc> + <dimensions rank="1"> + <dim index="1" value="np"/> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + This is an array holding the sample rotation angle at each + scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="kappa" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + This is an array holding the kappa angle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="phi" type="NX_FLOAT" units="NX_ANGLE" axis="1"> + <doc> + This is an array holding the phi angle at each scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="alpha" type="NX_FLOAT" units="NX_ANGLE"> + <doc>This holds the inclination angle of the kappa arm. </doc> + </field> + </group> + <group type="NXdata" name="name"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + <link name="kappa" target="/NXentry/NXsample/kappa"></link> + <link name="phi" target="/NXentry/NXsample/phi"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxlaue.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxlaue.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a8af0ecbed02b7f4f9252aa280168ab7e5568a36 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxlaue.nxdl.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxlaue" extends="NXxrot" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw data from a single crystal laue camera, extends :ref:`NXxrot` + + This is the application definition for raw data from a single crystal laue + camera. It extends :ref:`NXxrot`. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxlaue"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <group type="NXdata" name="distribution"> + <field name="data"> + <doc>expect ``signal=1 axes="energy"``</doc> + <dimensions rank="1"> + <dim index="1" value="ne" /> + </dimensions> + </field> + <field name="wavelength" units="NX_WAVELENGTH"> + <dimensions rank="1"> + <dim index="1" value="ne" /> + </dimensions> + </field> + <doc> + This is the wavelength distribution of the beam + </doc> + </group> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxlaueplate.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxlaueplate.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9149ee1f813f1da96bda10c3e0d49cbd0fb1ad6 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxlaueplate.nxdl.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxlaueplate" extends="NXxlaue" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw data from a single crystal Laue camera, extends :ref:`NXxlaue` + + This is the application definition for raw data from a single crystal Laue + camera with an image plate as a detector. It extends :ref:`NXxlaue`. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxlaueplate"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name ="detector"> + <field name="diameter" units="NX_LENGTH" type="NX_FLOAT"> + <doc>The diameter of a cylindrical detector</doc> + </field> + </group> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxnb.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxnb.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..79cadf03b9dfdc888ed037b7c0a43fa6f9491f15 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxnb.nxdl.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxnb" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw data from a single crystal diffractometer, extends :ref:`NXxbase` + + This is the application definition for raw data from + a single crystal diffractometer + measuring in normal beam mode. It extends :ref:`NXxbase`, + so the full definition is the content of + :ref:`NXxbase` plus the data defined here. All angles are + logged in order to support arbitrary scans in + reciprocal space. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXxnb"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + The polar_angle (gamma) of the detector for each scan point. + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="tilt_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc> + The angle by which the detector has been tilted out of the + scattering plane. + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1" primary="1"> + <doc> + This is an array holding the sample rotation angle at each + scan point + </doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"></link> + <link name="tilt" target="/NXentry/NXinstrument/NXdetector/tilt"></link> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/NXxrot.nxdl.xml b/src/punx/cache/v2018.5/applications/NXxrot.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a6dbd7a68e4eb336b00072eb35a299c9ff66a360 --- /dev/null +++ b/src/punx/cache/v2018.5/applications/NXxrot.nxdl.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXxrot" extends="NXxbase" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + raw data from a rotation camera, extends :ref:`NXxbase` + + This is the application definition for raw data from a rotation camera. + It extends :ref:`NXxbase`, so the full definition is the content of :ref:`NXxbase` + plus the data defined here. + </doc> + <group type="NXentry" name="entry"> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this file conforms.</doc> + <enumeration> + <item value="NXxrot"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXdetector" name="detector"> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>The polar_angle (two theta) where the detector is placed.</doc> + </field> + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc></field> + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc></field> + </group> + <group type="NXattenuator" name="attenuator"> + <field name="attenuator_transmission" type="NX_FLOAT" + units="NX_ANY"> + </field> + </group> + </group> + <group type="NXsample" name="sample"> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc>This is an array holding the sample rotation start angle at each scan point</doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + <field name="rotation_angle_step" type="NX_FLOAT" units="NX_ANGLE" + axis="1"> + <doc>This is an array holding the step made for sample rotation angle at each scan point</doc> + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + </group> + <group type="NXdata" name="name"> + <link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/applications/nxdlformat.xsl b/src/punx/cache/v2018.5/applications/nxdlformat.xsl new file mode 100644 index 0000000000000000000000000000000000000000..c3e34616aad5d30b68023f2a706de36b0130e56d --- /dev/null +++ b/src/punx/cache/v2018.5/applications/nxdlformat.xsl @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Stylesheet to provide a condensed view of a NeXus NXDL specification. + (see https://github.com/nexusformat/definitions/issues/181) + + The nxdlformat.xsl stylesheets differ between the directories + because of the rule regarding either /definition/NXentry or + /definition/NXsubentry for application and contributed definitions. + (see https://github.com/nexusformat/definitions/issues/179) + + Modify <xsl:template match="nx:definition">...</xsl:template> + for each directory. + +line breaks are VERY TRICKY here, be careful how you edit! +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" version="1.0"> + + <xsl:output method="text"/> + <xsl:variable name="indent_step" select="' '"/> + + + <xsl:template match="/"> + <xsl:apply-templates select="nx:definition"/> + </xsl:template> + + + <!-- + Modify ONLY this section for each directory: + base_classes/nxdlformat.xsl no rule for NXentry or NXsubentry + applications/nxdlformat.xsl required rule for NXentry or NXsubentry + contributed_definitions/nxdlformat.xsl optional rule for NXentry or NXsubentry + --> + <xsl:template match="nx:definition"> + <xsl:call-template name="showClassName"/> + <xsl:choose> + <xsl:when test="count(nx:group[@type='NXentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:when test="count(nx:group[@type='NXsubentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXsubentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:otherwise><!-- optional rule for NXentry or NXsubentry + --> (base class definition, NXentry or NXsubentry not found)<!-- + --><xsl:text><!-- tricky line break here --> +</xsl:text><xsl:call-template name="startFieldsGroups"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + <!-- +++ From this point on, the code is the same for, +++ --> + <!-- +++ base_classes applications/, and contributed/ +++ --> + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + + <xsl:template match="nx:field"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/>:<xsl:choose> + <xsl:when test="count(@type)"><xsl:value-of select="@type" + /><xsl:apply-templates select="nx:dimensions" + ><xsl:sort select="@name"/></xsl:apply-templates></xsl:when> + <xsl:otherwise>NX_CHAR</xsl:otherwise> + </xsl:choose> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template match="nx:dimensions"><!-- + -->[<xsl:apply-templates select="nx:dim"/>]<!-- + --></xsl:template> + + + <xsl:template match="nx:dim"> + <xsl:choose> + <xsl:when test="position()=1"><xsl:value-of select="@value"/></xsl:when> + <xsl:otherwise>,<xsl:value-of select="@value"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="nx:link"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/><xsl:text + > --> </xsl:text><xsl:value-of select="@target"/><xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:attribute"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/>@<xsl:value-of select="@name"/> + <xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:group"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:if test="count(@name)"><xsl:value-of select="@name"/>:</xsl:if> + <xsl:value-of select="@type"/> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template name="startFieldsGroups"> + <xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:choose> + <!-- Two ways to render. + 1=1: write fields, links, then groups, each sorted alphabetically + 1!=1: order of appearance in NXDL + --> + <xsl:when test="1=1"><!-- write fields, links, then groups --> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise><!-- write in order of appearance in NXDL --> + <xsl:apply-templates select="nx:field|nx:link|nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="showClassName"> + <xsl:value-of select="@name"/> (<xsl:choose> + <xsl:when test="@category='base'">base class</xsl:when> + <xsl:when test="@category='application'">application definition</xsl:when> + <xsl:when test="@category='contributed'">contributed definition</xsl:when> + </xsl:choose>)<xsl:text><!-- tricky line break here --> +</xsl:text></xsl:template> + +</xsl:stylesheet> + +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> diff --git a/src/punx/cache/v2018.5/base_classes/NXaperture.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXaperture.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a6fe707c23a7f3d0d426eb27484f594a69f9bf4d --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXaperture.nxdl.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXaperture" + type="group" extends="NXobject"> + + <doc>A beamline aperture.</doc> + <!-- TODO compare with "screens" in SHADOW --> + + <group type="NXgeometry"> + <doc> + location and shape of aperture + + .. TODO: documentation needs improvement, contributions welcome + + * description of terms is poor and leaves much to interpretation + * Describe what is meant by translation _here_ and ... + * Similar throughout base classes + * Some base classes do this much better + * Such as where is the gap written? + </doc> + </group> + <group type="NXgeometry"> + <doc>location and shape of each blade</doc> + </group> + <field name="material"><!-- TODO Uniformity problem, "type" is used elsewhere for same context --> + <doc>Absorbing material of the aperture</doc> + </field> + <field name="description"> + <doc>Description of aperture</doc> + </field> + <group type="NXnote"><doc>describe any additional information in a note*</doc></group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXattenuator.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXattenuator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..bac2567c68fece98cc816c390ef67abf33b8aae0 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXattenuator.nxdl.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXattenuator" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc> + A device that reduces the intensity of a beam by attenuation. + + If uncertain whether to use :ref:`NXfilter` (band-pass filter) + or :ref:`NXattenuator` (reduces beam intensity), then choose + :ref:`NXattenuator`. + </doc> + <!-- + TODO compare with SHADOW definition "screen" + TODO SHADOW: http://ftp.esrf.eu/pub/scisoft/shadow or (older) http://www.nanotech.wisc.edu/shadow + --> + + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance from sample</doc> + </field> + <field name="type"> + <doc>Type or composition of attenuator, e.g. polythene</doc> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of attenuator along beam direction</doc> + </field> + <field name="scattering_cross_section" type="NX_FLOAT" units="NX_CROSS_SECTION"> + <doc>Scattering cross section (coherent+incoherent)</doc> + </field> + <field name="absorption_cross_section" type="NX_FLOAT" units="NX_CROSS_SECTION"> + <doc>Absorption cross section</doc> + </field> + <field name="attenuator_transmission" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc> + The nominal amount of the beam that gets through + (transmitted intensity)/(incident intensity) + </doc> + </field> + <field name="status"> + <doc>In or out or moving of the beam</doc> + <attribute name="time" type="NX_DATE_TIME"> + <doc>time stamp for this observation</doc> + </attribute> + <enumeration> + <item value="in" /> + <item value="out" /> + <item value="moving" /> + </enumeration> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXbeam.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXbeam.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..27f79526c94df32ae14aff14f9f8e152bed7804e --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXbeam.nxdl.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXbeam" + type="group" extends="NXobject"> + + <doc> + Properties of the neutron or X-ray beam at a given location. + + It will be referenced + by beamline component groups within the :ref:`NXinstrument` group or by the :ref:`NXsample` group. Note + that variables such as the incident energy could be scalar values or arrays. This group is + especially valuable in storing the results of instrument simulations in which it is useful + to specify the beam profile, time distribution etc. at each beamline component. Otherwise, + its most likely use is in the :ref:`NXsample` group in which it defines the results of the neutron + scattering by the sample, e.g., energy transfer, polarizations. </doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance from sample</doc> + </field> + <field name="incident_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Energy on entering beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="final_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Energy on leaving beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="energy_transfer" type="NX_FLOAT" units="NX_ENERGY"> + <doc>Energy change caused by beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength on entering beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength spread FWHM on entering component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_beam_divergence" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Divergence of beam entering this component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="final_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength on leaving beamline component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="incident_polarization" type="NX_FLOAT" units="NX_ANY"> + <doc>Polarization vector on entering beamline component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="final_polarization" type="NX_FLOAT" units="NX_ANY"> + <doc>Polarization vector on leaving beamline component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="final_wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Wavelength spread FWHM of beam leaving this component</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <field name="final_beam_divergence" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Divergence FWHM of beam leaving this component</doc> + <dimensions rank="2"><!-- [2,:] --> + <dim index="1" value="2"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="flux" type="NX_FLOAT" units="NX_FLUX"> + <doc>flux incident on beam plane area</doc> + <dimensions rank="1"> + <dim index="1" value="i"/> + </dimensions> + </field> + <group type="NXdata"> + <doc> + Distribution of beam with respect to relevant variable e.g. wavelength. This is mainly + useful for simulations which need to store plottable information at each beamline + component.</doc> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXbeam_stop.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXbeam_stop.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..40cb784edb8b8848ae9b2654736abdd13fbd8064 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXbeam_stop.nxdl.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXbeam_stop" + type="group" extends="NXobject"> + + <doc> + A device that blocks the beam completely, usually to protect a detector. + + Beamstops and their positions are important for SANS + and SAXS experiments. + </doc> + <group type="NXgeometry"> + <doc>engineering shape, orientation and position of the beam stop.</doc> + </group> + <field name="description"> + <doc>description of beamstop</doc> + <enumeration> + <item value="circular"/> + <item value="rectangular"/> + </enumeration> + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>size of beamstop</doc> + </field> + <field name="x" type="NX_FLOAT" units="NX_LENGTH"> + <doc>x position of the beamstop in relation to the detector</doc> + </field> + <field name="y" type="NX_FLOAT" units="NX_LENGTH"> + <doc>y position of the beamstop in relation to the detector</doc> + </field> + <field name="distance_to_detector" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance of the beamstop to the detector</doc> + </field> + <field name="status"> + <enumeration> + <item value="in"/> + <item value="out"/> + </enumeration> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXbending_magnet.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXbending_magnet.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..0331bce49f0080f6fd54ac5dbef2a052df732723 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXbending_magnet.nxdl.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXbending_magnet" + type="group" extends="NXobject"> + + <doc>A bending magnet</doc> + <field name="critical_energy" type="NX_FLOAT" units="NX_ENERGY"/> + <field name="bending_radius" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="magnetic_field" type="NX_FLOAT" units="NX_CURRENT"> + <doc>strength of magnetic field of dipole magnets</doc> + </field> + <field name="accepted_photon_beam_divergence" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + An array of four numbers giving X+, X-, Y+ and Y- half divergence + </doc> + </field> + <field name="source_distance_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Distance of source point from particle beam waist in X (horizontal) direction. + </doc> + </field> + <field name="source_distance_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Distance of source point from particle beam waist in Y (vertical) direction. + </doc> + </field> + <field name="divergence_x_plus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in X+ (horizontal outboard) direction. + Note that divergence_x_plus+divergence_x_minus is the total horizontal beam divergence. + </doc> + </field> + <field name="divergence_x_minus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in X- (horizontal inboard) direction. + Note that divergence_x_plus+divergence_x_minus is the total horizontal beam divergence. + </doc> + </field> + <field name="divergence_y_plus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in Y+ (vertical upward) direction. + Note that divergence_y_plus+divergence_y_minus is the total vertical beam divergence. + </doc> + </field> + <field name="divergence_y_minus" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Accepted photon beam divergence in Y- (vertical downward) direction. + Note that divergence_y_plus+divergence_y_minus is the total vertical beam divergence. + </doc> + </field> + <group name="spectrum" type="NXdata"><doc>bending magnet spectrum</doc></group> + <group type="NXgeometry"><doc>"Engineering" position of bending magnet</doc></group> + +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXcapillary.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXcapillary.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c42c1fee95d35149d4d1d7c8baa408cba35b9ce9 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXcapillary.nxdl.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcapillary" + type="group" extends="NXobject"> + + <doc> + A capillary lens to focus the X-ray beam. + + Based on information provided by Gerd Wellenreuther (DESY). + </doc> + <field name="type" type="NX_CHAR"> + <doc>Type of the capillary</doc> + <enumeration> + <item value="single_bounce"/> + <item value="polycapillary"/> + <item value="conical_capillary"/> + </enumeration> + </field> + <field name="manufacturer" type="NX_CHAR"> + <doc> + The manufacturer of the capillary. This is actually important as + it may have an impact on performance. + </doc> + </field> + <field name="maximum_incident_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="accepting_aperture" type="NX_FLOAT" units="NX_ANGLE"></field> + <group type="NXdata" name="gain"> + <doc> + The gain of the capillary as a function of energy + </doc> + </group> + <group type="NXdata" name="transmission"> + <doc> + The transmission of the capillary as a function of energy + </doc> + </group> + <field name="working_distance" type="NX_FLOAT" units="NX_LENGTH"></field> + <field name="focal_size" type="NX_FLOAT" > + <doc> + The focal size in FWHM + </doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXcite.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXcite.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..77d3843f3fd6824b0d4425829ca86ea1d079075e --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXcite.nxdl.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXcite" category="base" + extends="NXobject" xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + A literature reference + + Definition to include references for example for detectors, + manuals, instruments, acquisition or analysis software used. + + The idea would be to include this in the relevant NeXus object: + :ref:`NXdetector` for detectors, :ref:`NXinstrument` for instruments, etc. + </doc> + <field name="description" type="NX_CHAR"> + <doc> + This should describe the reason for including this reference. + For example: The dataset in this group was normalised using the method + which is described in detail in this reference. + </doc> + </field> + <field name="url" type="NX_CHAR"> + <doc>URL referencing the document or data.</doc> + </field> + <field name="doi" type="NX_CHAR"> + <doc>DOI referencing the document or data.</doc> + </field> + <field name="endnote" type="NX_CHAR"> + <doc>Bibliographic reference data in EndNote format.</doc> + </field> + <field name="bibtex" type="NX_CHAR"> + <doc>Bibliographic reference data in BibTeX format.</doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXcollection.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXcollection.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..10659038534b8c7abc986b944699d0896cdc1c51 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXcollection.nxdl.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" + category="base" + name="NXcollection" + type="group" + extends="NXobject" + ignoreExtraGroups="true" + ignoreExtraFields="true" + ignoreExtraAttributes="true" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <!-- + The ignoreExtra* attributes are used in the definition to + avoid warning messages that would be generated from + unexpected groups, fields, and attributes. + Since no groups or attributes are declared here, _every_ + child of this class would generate a warning message without this + attribute being set to "true". + --> + + <doc> + An unvalidated set of terms, such as the description of a beam line. + + Use :ref:`NXcollection` to gather together any set of terms. + The original suggestion is to use this as a container + class for the description of a beamline. + + For NeXus validation, :ref:`NXcollection` will always generate + a warning since it is always an optional group. + Anything (groups, fields, or attributes) placed in + an :ref:`NXcollection` group will not be validated. + </doc> + + <!-- any content is purely optional --> + <!-- + NOTE + ===== + + NXcollection is an unvalidated class, do not add any subgroups. + + See: https://github.com/nexusformat/definitions/issues/259 + --> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXcollimator.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXcollimator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c01ed2493c5c7eef0f6b46c5f87c8700d6712efb --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXcollimator.nxdl.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcollimator" + type="group" extends="NXobject"> + + <doc>A beamline collimator.</doc> + <group type="NXgeometry"> + <doc>position, shape and size</doc> + </group> + <field name="type"> + <enumeration> + <item value="Soller"/> + <item value="radial"/> + <item value="oscillating"/> + <item value="honeycomb"></item> + </enumeration> + </field> + <field name="soller_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Angular divergence of Soller collimator</doc> + </field> + <field name="divergence_x" type="NX_FLOAT" units="NX_ANGLE"> + <doc>divergence of collimator in local x direction</doc> + </field> + <field name="divergence_y" type="NX_FLOAT" units="NX_ANGLE"> + <doc>divergence of collimator in local y direction</doc> + </field> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>Frequency of oscillating collimator</doc> + </field> + <group type="NXlog" name="frequency_log"> + <doc>Log of frequency</doc> + </group> + <field name="blade_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>blade thickness</doc> + </field> + <field name="blade_spacing" type="NX_FLOAT" units="NX_LENGTH"> + <doc>blade spacing</doc> + </field> + <field name="absorbing_material"> + <doc>name of absorbing material</doc> + </field> + <field name="transmitting_material"> + <doc>name of transmitting material</doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXcrystal.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXcrystal.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..75e5bbad1b429c3e1b85a2f97549ccd9bb6a472a --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXcrystal.nxdl.xml @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcrystal" + type="group" extends="NXobject" + > + + <symbols> + <doc>These symbols will be used below to coordinate dimensions with the same lengths.</doc> + <symbol name="n_comp"><doc>number of different unit cells to be described</doc></symbol> + <symbol name="i"><doc>number of wavelengths</doc></symbol> + </symbols> + + <doc> + A crystal monochromator or analyzer. + + Permits double bent + monochromator comprised of multiple segments with anisotropic + Gaussian mosaic. + + If curvatures are set to zero or are absent, array + is considered to be flat. + + Scattering vector is perpendicular to surface. Crystal is oriented + parallel to beam incident on crystal before rotation, and lies in + vertical plane. + </doc> + + <group type="NXgeometry"> + <doc>Position of crystal</doc> + </group> + <field name="usage" type="NX_CHAR"> + <doc>How this crystal is used. Choices are in the list.</doc> + <enumeration> + <item value="Bragg"><doc>reflection geometry</doc></item> + <item value="Laue"> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + C, then H, then the other elements in alphabetical order of their symbol. + If carbon is not present, the elements are listed purely in alphabetic + order of their symbol. + This is the *Hill* system used by Chemical Abstracts. + See, for example: + http://www.iucr.org/__data/iucr/cif/standard/cifstd15.html, + http://www.cas.org/training/stneasytips/subinforformula1.html, + or + http://www.indiana.edu/~cheminfo/courses/471cnfs.html. + </doc> + </item> + </enumeration> + </field> + <field name="type"> + <doc> + Type or material of monochromating substance. + Chemical formula can be specified separately. + Use the "reflection" field to indicate the (hkl) orientation. + Use the "d_spacing" field to record the lattice plane spacing. + + This field was changed (2010-11-17) from an enumeration to + a string since common usage showed a wider variety of use + than a simple list. These are the items in the list at + the time of the change: PG (Highly Oriented Pyrolytic Graphite) | + Ge | Si | Cu | Fe3Si | CoFe | Cu2MnAl (Heusler) | Multilayer | + Diamond. + </doc> + </field> + <field name="chemical_formula"> + <!-- copied from NXsample --> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + C, then H, then the other elements in alphabetical order of their symbol. + If carbon is not present, the elements are listed purely in alphabetic + order of their symbol. + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="order_no" type="NX_INT"> + <doc> + A number which describes if this is the first, second,.. + :math:`n^{th}` crystal in a multi crystal monochromator + </doc> + </field> + <field name="cut_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Cut angle of reflecting Bragg plane and plane of crystal surface</doc> + </field> + <field name="space_group"> + <doc>Space group of crystal structure</doc> + </field> + <field name="unit_cell" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell parameters (lengths and angles)</doc> + <dimensions rank="2"> + <dim index="1" value="n_comp"/> + <dim index="2" value="6"/> + </dimensions> + </field> + <!-- NXfilter defines each unit cell parameter separately. Let's be consistent. --> + <field name="unit_cell_a" type="NX_FLOAT" units="NX_LENGTH"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: length of side a</doc> + </field> + <field name="unit_cell_b" type="NX_FLOAT" units="NX_LENGTH"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: length of side b</doc> + </field> + <field name="unit_cell_c" type="NX_FLOAT" units="NX_LENGTH"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: length of side c</doc> + </field> + <field name="unit_cell_alpha" type="NX_FLOAT" units="NX_ANGLE"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: angle alpha</doc> + </field> + <field name="unit_cell_beta" type="NX_FLOAT" units="NX_ANGLE"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: angle beta</doc> + </field> + <field name="unit_cell_gamma" type="NX_FLOAT" units="NX_ANGLE"><!-- as used in NXfilter --> + <doc>Unit cell lattice parameter: angle gamma</doc> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Volume of the unit cell</doc> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal sample using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="2"><!--3,3--> + <dim index="1" value="3"/> + <dim index="2" value="3"/> + </dimensions> + </field> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>Optimum diffracted wavelength</doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="d_spacing" type="NX_FLOAT" units="NX_LENGTH"> + <doc>spacing between crystal planes of the reflection</doc> + </field> + <field name="scattering_vector" type="NX_FLOAT" units="NX_WAVENUMBER"> + <doc>Scattering vector, Q, of nominal reflection</doc> + </field> + <field name="reflection" type="NX_INT" units="NX_UNITLESS"> + <doc>Miller indices (hkl) values of nominal reflection</doc> + <dimensions><dim index="1" value="3"/></dimensions> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of the crystal. (Required for Laue orientations - see "usage" field)</doc> + </field> + <field name="density" type="NX_NUMBER" units="NX_MASS_DENSITY"> + <doc>mass density of the crystal</doc> + </field> + <field name="segment_width" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Horizontal width of individual segment</doc> + </field> + <field name="segment_height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Vertical height of individual segment</doc> + </field> + <field name="segment_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of individual segment</doc> + </field> + <field name="segment_gap" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Typical gap between adjacent segments</doc> + </field> + <field name="segment_columns" type="NX_FLOAT" units="NX_LENGTH"> + <doc>number of segment columns in horizontal direction</doc> + </field> + <field name="segment_rows" type="NX_FLOAT" units="NX_LENGTH"> + <doc>number of segment rows in vertical direction</doc> + </field> + <field name="mosaic_horizontal" type="NX_FLOAT" units="NX_ANGLE"> + <doc>horizontal mosaic Full Width Half Maximum</doc> + </field> + <field name="mosaic_vertical" type="NX_FLOAT" units="NX_ANGLE"> + <doc>vertical mosaic Full Width Half Maximum</doc> + </field> + <field name="curvature_horizontal" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Horizontal curvature of focusing crystal</doc> + </field> + <field name="curvature_vertical" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Vertical curvature of focusing crystal</doc> + </field> + <field name="is_cylindrical" type="NX_BOOLEAN"> + <doc>Is this crystal bent cylindrically?</doc> + </field> + <field name="cylindrical_orientation_angle" type="NX_NUMBER" units="NX_ANGLE"> + <doc>If cylindrical: cylinder orientation angle</doc> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Polar (scattering) angle at which crystal assembly is positioned. + Note: some instrument geometries call this term 2theta. + </doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Azimuthal angle at which crystal assembly is positioned</doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="bragg_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Bragg angle of nominal reflection</doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>average/nominal crystal temperature</doc> + </field> + <field name="temperature_coefficient" type="NX_FLOAT" units="NX_ANY"> + <doc>how lattice parameter changes with temperature</doc> + </field> + <group type="NXlog" name="temperature_log"> + <doc>log file of crystal temperature</doc> + </group> + <group type="NXdata" name="reflectivity"> + <doc>crystal reflectivity versus wavelength</doc> + </group> + <group type="NXdata" name="transmission"> + <doc>crystal transmission versus wavelength</doc> + </group> + <group type="NXshape" name="shape"> + <doc>A NXshape group describing the shape of the crystal arrangement</doc> + </group> + <!-- TODO need more parameters here, such as ... + list from Rainer Gehrke, DESY (some items may already be present) + +Parameters for crystals ++ Field indicating whether it is Bragg or Laue see usage ++ The crystal structure (enumeration, e.g. Zincblende ..) see space_group ++ Lattice constant see unit_cell ++ Miller indices of reflection (h,k,l) see reflection ++ First (or only) element see order_no ++ Second element (if any) see order_no ++ Temperature factor (optional) see temperature_coefficient ++ Asymmetric angle (if applicable) see cut_angle ++ Mosaic angular spread (if applicable) see mosaic_horizontal and mosaic_vertical ++ Thickness (mandatory for Laue, else optional) see thickness + + +Figure for crystals and mirrors (to describe curved surfaces) ++ Field indicating whether concave or convex see curvature_horizontal and curvature_vertical ++ Field indicating whether cylindrical or not see is_cylindrical ++ If cylindrical: cylinder orientation angle see cylindrical_orientation_angle + + +Now come the different surface figures with the necessary parameters: +1. Flat +2. Spherical (spherical radius) +3. Elliptical and hyperbolical (semi-major axis, semi-minor axis, angle of major axis and pole) +4. Toroidal (major radius, minor radius) +5. Parabolical (parabolic parameter a) +6. Conical (cone half aperture) +7. Polynomial (degree of polynom, array with polynom coefficients) + + --> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXcylindrical_geometry.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXcylindrical_geometry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..234674c29833d79004edb50218a8c9edc751765e --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXcylindrical_geometry.nxdl.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcylindrical_geometry" + type="group" extends="NXobject"> + + <symbols> + <doc>These symbols will be used below.</doc> + <symbol name="i"> + <doc> + number of vertices required to define all cylinders in the shape + </doc> + </symbol> + <symbol name="j"><doc>number of cylinders in the shape</doc></symbol> + <symbol name="k"><doc>number cylinders which are detectors</doc></symbol> + </symbols> + + <doc> + Geometry description for cylindrical shapes. + This class can be used in place of ``NXoff_geometry`` when an exact + representation for cylinders is preferred. + For example, for Helium-tube, neutron detectors. + It can be used to describe the shape of any beamline component, including detectors. + In the case of detectors it can be used to define the shape of a single pixel, or, + if the pixel shapes are non-uniform, to describe the shape of the whole detector. + </doc> + + <field name="vertices" type="NX_NUMBER" units="NX_LENGTH"> + + <doc> + List of x,y,z coordinates for vertices. + The origin of the coordinates is the position of the parent component, for + example the NXdetector which the geometry describes. + If the shape describes a single pixel for a detector with uniform pixel shape + then the origin is the position of each pixel as described by the + ``x/y/z_pixel_offset`` datasets in ``NXdetector``. + </doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="3" /> + </dimensions> + + </field> + + <field name="cylinders" type="NX_INT"> + + <doc> + List of indices of vertices in the ``vertices`` dataset to form each cylinder. + Each cylinder is described by three vertices A, B, C. + First vertex A lies on the cylinder axis and circular face, second point B + on edge of the same face as A, and third point C at the other face and on axis. + </doc> + + <dimensions rank="2"> + <dim index="1" value="j" /> + <dim index="2" value="3" /> + </dimensions> + + </field> + + <field name="detector_number" type="NX_INT"> + + <doc>Maps cylinders in ``cylinder``, by index, with a detector id.</doc> + + <dimensions rank="1"> + <dim index="1" value="k" /> + </dimensions> + + </field> + +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXdata.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXdata.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4d869ef94df56c6e0dc057e4df11ddc1ca6649e2 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXdata.nxdl.xml @@ -0,0 +1,410 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXdata" + type="group" + extends="NXobject" + category="base" + ignoreExtraFields="true" + ignoreExtraAttributes="true" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <!-- + The ignoreExtra* attributes are used in the definition to + avoid warning messages that would be generated from unexpected fields or attributes. + Since common use of NXdata indicates field names of any value, _many_ + instances of this class would generate a warning message during validation + without this attribute being set to "true". + --> + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="dataRank"><doc>rank of the ``data`` field</doc></symbol> + <symbol name="n"><doc>length of the ``variable`` field</doc></symbol> + <symbol name="nx"><doc>length of the ``x`` field</doc></symbol> + <symbol name="ny"><doc>length of the ``y`` field</doc></symbol> + <symbol name="nz"><doc>length of the ``z`` field</doc></symbol> + </symbols> + + <attribute name="signal"> + <doc> + .. index:: plotting + + Declares which dataset is the default. + The value is the name of the dataset to be plotted. + A field of this name *must* exist (either as dataset + or as a link to a dataset). + + It is recommended (as of NIAC2014) to use this attribute + rather than adding a signal attribute to the dataset. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> + <attribute name="axes"> + <!-- http://www.nexusformat.org/2014_axes_and_uncertainties --> + <doc> + .. index:: plotting + + String array that defines the independent data fields used in + the default plot for all of the dimensions of the *signal* field + (the *signal* field is the field in this group that is named by + the ``signal`` attribute of this group). + One entry is provided for every dimension in the *signal* field. + + The field(s) named as values (known as "axes") of this attribute + *must* exist. An axis slice is specified using a field named + ``AXISNAME_indices`` as described below (where the text shown here + as ``AXISNAME`` is to be replaced by the actual field name). + + When no default axis is available for a particular dimension + of the plottable data, use a "." in that position. + Such as:: + + @axes=["time", ".", "."] + + Since there are three items in the list, the the *signal* field + must must be a three-dimensional array (rank=3). The first dimension + is described by the values of a one-dimensional array named ``time`` + while the other two dimensions have no fields to be used as dimension scales. + + See examples provided on the NeXus wiki: + http://www.nexusformat.org/2014_axes_and_uncertainties + + If there are no axes at all (such as with a stack of images), + the axes attribute can be omitted. + </doc> + </attribute> + <attribute name="AXISNAME_indices"> + <!-- + nxdl.xsd rules do not allow us to show this as a variable name + - we'll use ALL CAPS (see #562) + --> + <!-- AXISNAME_indices documentation copied from datarules.rst --> + <doc> + Each ``AXISNAME_indices`` attribute indicates the dependency + relationship of the ``AXISNAME`` field (where ``AXISNAME`` + is the name of a field that exists in this ``NXdata`` group) + with one or more dimensions of the plottable data. + + Integer array that defines the indices of the *signal* field + (that field will be a multidimensional array) + which need to be used in the *AXISNAME* dataset in + order to reference the corresponding axis value. + + The first index of an array is ``0`` (zero). + + Here, *AXISNAME* is to be replaced by the name of each + field described in the ``axes`` attribute. + An example with 2-D data, :math:`d(t,P)`, will illustrate:: + + data_2d:NXdata + @signal="data" + @axes=["time", "pressure"] + @time_indices=0 + @pressure_indices=1 + data: float[1000,20] + time: float[1000] + pressure: float[20] + + This attribute is to be provided in all situations. + However, if the indices attributes are missing + (such as for data files written before this specification), + file readers are encouraged to make their best efforts + to plot the data. + Thus the implementation of the + ``AXISNAME_indices`` attribute is based on the model of + "strict writer, liberal reader". + + .. note:: Attributes potentially containing multiple values + (axes and _indices) are to be written as string or integer arrays, + to avoid string parsing in reading applications. + </doc> + </attribute> + + <doc> + :ref:`NXdata` describes the plottable data and related dimension scales. + + .. index:: plotting + + It is mandatory that there is at least one :ref:`NXdata` group + in each :ref:`NXentry` group. + Note that the ``variable`` and ``data`` + can be defined with different names. + The ``signal`` and ``axes`` attributes of the + ``data`` group define which items + are plottable data and which are *dimension scales*, respectively. + + :ref:`NXdata` is used to implement one of the basic motivations in NeXus, + to provide a default plot for the data of this :ref:`NXentry`. The actual data + might be stored in another group and (hard) linked to the :ref:`NXdata` group. + + * Each :ref:`NXdata` group will define only one data set + containing plottable data, dimension scales, and + possibly associated standard deviations. + Other data sets may be present in the group. + * The plottable data may be of arbitrary rank up to a maximum + of ``NX_MAXRANK=32``. + * The plottable data will be named as the value of + the group ``signal`` attribute, such as:: + + data:NXdata + @signal = "counts" + @axes = "mr" + @mr_indices = 0 + counts: float[100] --> the default dependent data + mr: float[100] --> the default independent data + + The field named in the ``signal`` attribute **must** exist, either + directly as a dataset or defined through a link. + + * The group ``axes`` attribute will name the + *dimension scale* associated with the plottable data. + + If available, the standard deviations of the data are to be + stored in a data set of the same rank and dimensions, with the name ``errors``. + + * For each data dimension, there should be a one-dimensional array + of the same length. + * These one-dimensional arrays are the *dimension scales* of the + data, *i.e*. the values of the independent variables at which the data + is measured, such as scattering angle or energy transfer. + + .. index:: link + .. index:: axes (attribute) + + The preferred method to associate each data dimension with + its respective dimension scale is to specify the field name + of each dimension scale in the group ``axes`` attribute as a string list. + Here is an example for a 2-D data set *data* plotted + against *time*, and *pressure*. (An additional *temperature* data set + is provided and could be selected as an alternate for the *pressure* axis.):: + + data_2d:NXdata + @signal="data" + @axes=["time", "pressure"] + @pressure_indices=1 + @temperature_indices=1 + @time_indices=0 + data: float[1000,20] + pressure: float[20] + temperature: float[20] + time: float[1000] + + .. rubric:: Old methods to identify the plottable data + + There are two older methods of associating + each data dimension to its respective dimension scale. + Both are now out of date and + should not be used when writing new data files. + However, client software should expect to see data files + written with any of these methods. + + * One method uses the ``axes`` + attribute to specify the names of each *dimension scale*. + + * The oldest method uses the ``axis`` attribute on each + *dimension scale* to identify + with an integer the axis whose value is the number of the dimension. + </doc> + <field name="VARIABLE" type="NX_NUMBER" nameType="any"> + <doc> + Dimension scale defining an axis of the data. + Client is responsible for defining the dimensions of the data. + The name of this field may be changed to fit the circumstances. + Standard NeXus client tools will use the attributes to determine + how to use this field. + </doc> + <dimensions rank="1"> + <doc> + A *dimension scale* must have a rank of 1 and has length ``n``. + </doc> + <dim index="1" value="n"/> + </dimensions> + <attribute name="long_name"><doc>Axis label</doc></attribute> + <attribute name="distribution" type="NX_BOOLEAN"> + <doc> + ``0|false``: single value, + ``1|true``: multiple values + </doc> + </attribute> + <attribute name="first_good" type="NX_INT"><doc>Index of first good value</doc></attribute> + <attribute name="last_good" type="NX_INT"><doc>Index of last good value</doc></attribute> + <attribute name="axis" type="NX_POSINT" + deprecated="Use the group ``axes`` attribute (NIAC2014)"> + <doc> + Index (positive integer) identifying this specific set of numbers. + + N.B. The ``axis`` attribute is the old way of designating a link. + Do not use the ``axes`` attribute with the ``axis`` attribute. + The ``axes`` *group* attribute is now preferred. + </doc> + </attribute> + </field> + <field name="VARIABLE_errors" type="NX_NUMBER" nameType="any"> + <doc> + Errors (uncertainties) associated with axis ``VARIABLE``. + Client is responsible for defining the dimensions of the data. + The name of this field may be changed to fit the circumstances + but is matched with the *VARIABLE* + field with ``_errors`` appended. + </doc> + <dimensions rank="1"> + <doc> + A dimension scale must have a rank of 1 and has length ``n``, + same as ``variable``. + </doc> + <dim index="1" value="n"/> + </dimensions> + </field> + <field name="DATA" type="NX_NUMBER" nameType="any"> + <doc> + .. index:: plotting + + This field contains the data values to be used as the + NeXus *plottable data*. + Client is responsible for defining the dimensions of the data. + The name of this field may be changed to fit the circumstances. + Standard NeXus client tools will use the attributes to determine + how to use this field. + </doc> + <dimensions rank="dataRank"> + <doc> + The rank (``dataRank``) of the ``data`` must satisfy + ``1 <= dataRank <= NX_MAXRANK=32``. + At least one ``dim`` must have length ``n``. + </doc> + <dim index="0" value="n"><!-- index="0": cannot know to which dimension this applies a priori --></dim> + </dimensions> + <attribute name="signal" type="NX_POSINT" + deprecated="Use the group ``signal`` attribute (NIAC2014)"> + <doc> + .. index:: plotting + + Plottable (independent) axis, indicate index number. + Only one field in a :ref:`NXdata` group may have the + ``signal=1`` attribute. + Do not use the ``signal`` attribute with the ``axis`` attribute. + </doc> + </attribute> + <attribute name="axes" + deprecated="Use the group ``axes`` attribute (NIAC2014)"> + <doc> + Defines the names of the dimension scales + (independent axes) for this data set + as a colon-delimited array. + NOTE: The ``axes`` attribute is the preferred + method of designating a link. + Do not use the ``axes`` attribute with the ``axis`` attribute. + </doc> + </attribute> + <attribute name="uncertainties"> + <!-- + see http://wiki.nexusformat.org/2014_axes_and_uncertainties + not accepted at NIAC2014 + "NIAC will see a proposal when experience has been gained with all variations." + --> + <doc> + Specify the name (or names) of the uncertainties (errors) + of the dependent axes as plottable data. + NOTE: The ``uncertainties`` attribute uses the same syntax + as the ``axes`` attribute, a string or an array of strings + for multiple uncertainties. + + Examples:: + + @uncertainties="data_errors" + + @uncertainties="Idev" + + @uncertainties=["dQw", "dQl"] + + </doc> + </attribute> + <attribute name="long_name"> + <doc>data label</doc> + </attribute> + </field> + <field name="errors" type="NX_NUMBER"> + <doc> + Standard deviations of data values - + the data array is identified by the group attribute ``signal``. + The ``errors`` array must have the same dimensions as ``data``. + Client is responsible for defining the dimensions of the data. + </doc> + <dimensions rank="dataRank"> + <doc> + The ``errors`` must have + the same rank (``dataRank``) + as the ``data``. + At least one ``dim`` must have length "n". + </doc> + <dim index="0" value="n"><!-- index="0": cannot know to which dimension this applies a priori --></dim> + </dimensions> + </field> + <field name="scaling_factor" type="NX_FLOAT"> + <doc> + The elements in data are usually float values really. For + efficiency reasons these are usually stored as integers + after scaling with a scale factor. This value is the scale + factor. It is required to get the actual physical value, + when necessary. + </doc> + </field> + <field name="offset" type="NX_FLOAT"> + <doc> + An optional offset to apply to the values in data. + </doc> + </field> + <field name="x" type="NX_FLOAT" units="NX_ANY"> + <doc> + This is an array holding the values to use for the x-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nx" /> + </dimensions> + </field> + <field name="y" type="NX_FLOAT" units="NX_ANY"> + <doc> + This is an array holding the values to use for the y-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="ny" /> + </dimensions> + </field> + <field name="z" type="NX_FLOAT" units="NX_ANY"> + <doc> + This is an array holding the values to use for the z-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nz" /> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXdetector.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXdetector.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..cb680c0125a7c283f253c44b7e6368361c0803da --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXdetector.nxdl.xml @@ -0,0 +1,764 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition category="base" extends="NXobject" name="NXdetector" + type="group" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ns="http://definition.nexusformat.org/nxdl/@NXDL_RELEASE@" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="np"><doc>number of scan points (only present in scanning measurements)</doc></symbol> + <symbol name="i"><doc>number of detector pixels in the first (X, slowest) direction</doc></symbol> + <symbol name="j"><doc>number of detector pixels in the second (Y, faster) direction</doc></symbol> + <symbol name="k"><doc>number of detector pixels in the third (Z, if necessary, fastest) direction</doc></symbol> + <symbol name="tof"><doc>number of bins in the time-of-flight histogram</doc></symbol> + </symbols> + + <doc> + A detector, detector bank, or multidetector. + </doc> + + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME_OF_FLIGHT"> + <doc>Total time of flight</doc> + + <dimensions rank="1"> + <dim index="1" value="tof+1" /> + </dimensions> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="3"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>Total time of flight</doc> + </attribute> + </field> + + <field name="raw_time_of_flight" type="NX_INT" units="NX_PULSES"> + <doc>In DAQ clock pulses</doc> + + <dimensions rank="1"> + <dim index="1" value="tof+1" /> + </dimensions> + + <attribute name="frequency" type="NX_NUMBER"> + <doc>Clock frequency in Hz</doc> + </attribute> + </field> + + <field name="detector_number" type="NX_INT"> + <doc> + Identifier for detector (pixels) + Can be multidimensional, if needed + </doc> + </field> + + <field name="data" type="NX_NUMBER" units="NX_ANY"> + <doc>Data values from the detector.</doc> + + <dimensions rank="4"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + <dim index="4" value="tof" /> + </dimensions> + + <attribute name="long_name"> + <doc>Title of measurement</doc> + </attribute> + + <attribute name="check_sum" type="NX_INT"> + <doc>Integral of data as check of data integrity</doc> + </attribute> + + </field> + + <field name="data_error" type="NX_NUMBER" units="NX_ANY"> + <doc> + The best estimate of the uncertainty in the data value. Where + possible, this should be the standard deviation, which has the same units + as the data. + </doc> + + <dimensions rank="4"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + <dim index="4" value="tof" /> + </dimensions> + </field> + + <field name="x_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Offset from the detector center in x-direction. + Can be multidimensional when needed. + </doc> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>x-axis offset from detector center</doc> + </attribute> + </field> + + <field name="y_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Offset from the detector center in the y-direction. + Can be multidimensional when different values are required for each pixel. + </doc> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="2"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>y-axis offset from detector center</doc> + </attribute> + </field> + + + <field name="z_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Offset from the detector center in the z-direction. + Can be multidimensional when different values are required for each pixel. + </doc> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="3"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>y-axis offset from detector center</doc> + </attribute> + </field> + + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the distance to the previous component in the + instrument; most often the sample. The usage depends on the + nature of the detector: Most often it is the distance of the + detector assembly. But there are irregular detectors. In this + case the distance must be specified for each detector pixel. + </doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + This is the polar angle of the detector towards the previous + component in the instrument; most often the sample. + The usage depends on the + nature of the detector. + Most often it is the polar_angle of the detector assembly. + But there are irregular detectors. + In this + case, the polar_angle must be specified for each detector pixel. + </doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + This is the azimuthal angle angle of the detector towards + the previous component in the instrument; most often the sample. + The usage depends on the + nature of the detector. + Most often it is the azimuthal_angle of the detector assembly. + But there are irregular detectors. + In this + case, the azimuthal_angle must be specified for each detector pixel. + </doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="description"> + <doc>name/manufacturer/model/etc. information</doc> + </field> + + <field name="serial_number"> + <doc>Serial number for the detector</doc> + </field> + + <field name="local_name"> + <doc>Local name for the detector</doc> + </field> + + <group type="NXgeometry"> + <doc>Position and orientation of detector</doc> + </group> + + <field name="solid_angle" type="NX_FLOAT" units="NX_SOLID_ANGLE"> + <doc>Solid angle subtended by the detector at the sample</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Size of each detector pixel. If it is scalar all pixels are the same size. + </doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Size of each detector pixel. If it is scalar all pixels are the same size</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="dead_time" type="NX_FLOAT" units="NX_TIME"> + <doc>Detector dead time</doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="gas_pressure" type="NX_FLOAT" units="NX_PRESSURE"> + <doc>Detector gas pressure</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="detection_gas_path" type="NX_FLOAT" units="NX_LENGTH"> + <doc>maximum drift space dimension</doc> + </field> + + <field name="crate" type="NX_INT"> + <doc>Crate number of detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="local_name"> + <doc>Equivalent local term</doc> + </attribute> + </field> + + <field name="slot" type="NX_INT"> + <doc>Slot number of detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="local_name"> + <doc>Equivalent local term</doc> + </attribute> + </field> + + <field name="input" type="NX_INT"> + <doc>Input number of detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="local_name"> + <doc>Equivalent local term</doc> + </attribute> + </field> + + <field name="type"> + <doc> + Description of type such as He3 gas cylinder, He3 PSD, scintillator, + fission chamber, proportion counter, ion chamber, ccd, pixel, image plate, + CMOS, ... + </doc> + </field> + + <group name="efficiency" type="NXdata"> + <doc>Spectral efficiency of detector with respect to e.g. wavelength</doc> + <attribute name="signal"> + <enumeration> + <item value="efficiency" /> + </enumeration> + </attribute> + <attribute name="axes"> + <enumeration> + <!-- TODO: clarify the various use cases --> + <item value="." /> + <item value=". ." /> + <item value=". . ." /> + <item value=". . . ." /> + <item value="wavelength" /> + </enumeration> + </attribute> + <attribute name="wavelength_indices"> + <enumeration> + <!-- TODO: clarify the actual possibilities --> + <item value="0" /> + </enumeration> + </attribute> + + <field name="efficiency" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>efficiency of the detector</doc> + + <dimensions rank="3"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" /> + </dimensions> + </field> + + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc> + This field can be two things: + + #. For a pixel detector it provides the nominal wavelength + for which the detector has been calibrated. + + #. For other detectors this field has to be seen together with + the efficiency field above. + For some detectors, the efficiency is wavelength dependent. + Thus this field provides the wavelength axis for the efficiency field. + In this use case, the efficiency and wavelength arrays must + have the same dimensionality. + </doc> + + <dimensions rank="3"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" /> + </dimensions> + </field> + + <field name="start_time" type="NX_FLOAT" units="NX_TIME"> + <doc>start time for each frame, with the ``start`` attribute as absolute reference</doc> + <dimensions rank="1"> + <dim index="1" value="np"/> + </dimensions> + <attribute name="start" type="NX_DATE_TIME" /> + </field> + <field name="stop_time" type="NX_FLOAT" units="NX_TIME"> + <doc>stop time for each frame, with the ``start`` attribute as absolute reference</doc> + <dimensions rank="1"> + <dim index="1" value="np"/> + </dimensions> + <attribute name="start" type="NX_DATE_TIME" /> + </field> + + <field name="real_time" type="NX_NUMBER" units="NX_TIME"> + <doc> + real-time of the exposure (use this if exposure time varies for + each array element, otherwise use ``count_time`` field) + </doc> + + <dimensions rank="3"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" /> + </dimensions> + </field> + </group> + + <field name="calibration_date" type="NX_DATE_TIME"> + <doc> + date of last calibration (geometry and/or efficiency) measurements + </doc> + </field> + + <group name="calibration_method" type="NXnote"> + <doc> + summary of conversion of array data to pixels (e.g. polynomial + approximations) and location of details of the calibrations + </doc> + </group> + + <field name="layout"> + <doc>How the detector is represented</doc> + + <enumeration> + <item value="point"/> + <item value="linear"/> + <item value="area"/> + </enumeration> + </field> + + <field name="count_time" type="NX_NUMBER" units="NX_TIME"> + <doc>Elapsed actual counting time</doc> + + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + + <group name="data_file" type="NXnote"/> + + <group type="NXcollection"> + <doc> + Use this group to provide other data related to this NXdetector group. + </doc> + </group> + + <field name="sequence_number" type="NX_INT"> + <doc> + In order to properly sort the order of the images taken in (for + example) a tomography experiment, a sequence number is stored with each + image. + </doc> + + <dimensions rank="1"> + <dim index="1" value="nBrightFrames" /> + </dimensions> + </field> + + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. + </doc> + </field> + + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. + </doc> + </field> + + <field name="frame_start_number" type="NX_INT"> + <doc> + This is the start number of the first frame of a scan. In PX one + often scans a couple of frames on a give sample, then does something else, + then returns to the same sample and scans some more frames. Each time with + a new data file. This number helps concatenating such measurements. + </doc> + </field> + + <field name="diameter" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The diameter of a cylindrical detector</doc> + </field> + + <field name="acquisition_mode" type="NX_CHAR"> + <doc>The acquisition mode of the detector.</doc> + <enumeration> + <item value="gated"/> + <item value="triggered"/> + <item value="summed"/> + <item value="event"/> + <item value="histogrammed"/> + <item value="decimated"/> + </enumeration> + </field> + <field name="angular_calibration_applied" type="NX_BOOLEAN" > + <doc> + True when the angular calibration has been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="angular_calibration" type="NX_FLOAT" > + <doc>Angular calibration data.</doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="flatfield_applied" type="NX_BOOLEAN" > + <doc> + True when the flat field correction has been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="flatfield" type="NX_FLOAT" > + <doc>Flat field correction data.</doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="flatfield_error" type="NX_FLOAT" > + <doc>Errors of the flat field correction data.</doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="pixel_mask_applied" type="NX_BOOLEAN" > + <doc> + True when the pixel mask correction has been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="pixel_mask" type="NX_INT" > + <doc> + The 32-bit pixel mask for the detector. + Contains a bit field for each pixel to signal dead, + blind or high or otherwise unwanted or undesirable pixels. + They have the following meaning: + + .. can't make a table here, a bullet list will have to do for now + + * bit 0: gap (pixel with no sensor) + * bit 1: dead + * bit 2: under responding + * bit 3: over responding + * bit 4: noisy + * bit 5: -undefined- + * bit 6: pixel is part of a cluster of problematic pixels (bit set in addition to others) + * bit 7: -undefined- + * bit 8: user defined mask (e.g. around beamstop) + * bits 9-30: -undefined- + * bit 31: virtual pixel (corner pixel with interpolated value) + + The normal data analysis software would not take pixels into + account when a bit in (mask & 0x00FF) is set. + Tag bit in the upper two bytes would indicate special pixel + properties that normally would not be a sole reason to + reject the intensity value (unless lower bits are also set). + </doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="countrate_correction__applied" type="NX_BOOLEAN" > + <doc> + True when a count-rate correction has already been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="bit_depth_readout" type="NX_INT"> + <doc> + How many bits the electronics reads per pixel. + With CCD's and single photon counting detectors, + this must not align with traditional integer sizes. + This can be 4, 8, 12, 14, 16, ... + </doc> + </field> + <field name="detector_readout_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time it takes to read the detector (typically milliseconds). + This is important to know for time resolved experiments. + </doc> + </field> + <field name="trigger_delay_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time it takes to start exposure after a trigger signal has been received. + This is the reaction time of the detector firmware after receiving the trigger signal + to when the detector starts to acquire the exposure, including any user set delay.. + This is important to know for time resolved experiments. + </doc> + </field> + <field name="trigger_delay_time_set" type="NX_FLOAT" units="NX_TIME"> + <doc> + User-specified trigger delay. + </doc> + </field> + <field name="trigger_internal_delay_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time it takes to start exposure after a trigger signal has been received. + This is the reaction time of the detector hardware after receiving the + trigger signal to when the detector starts to acquire the exposure. + It forms the lower boundary of the trigger_delay_time when the user + does not request an additional delay. + </doc> + </field> + <field name="trigger_dead_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time during which no new trigger signal can be accepted. + Typically this is the + trigger_delay_time + exposure_time + readout_time. + This is important to know for time resolved experiments. + </doc> + </field> + <field name="frame_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + This is time for each frame. This is exposure_time + readout time. + </doc> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + <field name="gain_setting" type="NX_CHAR"> + <doc>The gain setting of the detector. This influences background etc.</doc> + <enumeration> + <item value="high"/> + <item value="standard"/> + <item value="fast"/> + <item value="auto"/> + </enumeration> + </field> + <field name="saturation_value" type="NX_INT"> + <doc> + The value at which the detector goes into saturation. + Especially common to CCD detectors, the data + is known to be invalid above this value. + </doc> + </field> + <field name="number_of_cycles" type="NX_INT"> + <doc> + CCD images are sometimes constructed by summing + together multiple short exposures in the + electronics. This reduces background etc. + This is the number of short exposures used to sum + images for an image. + </doc> + </field> + <field name="sensor_material" type="NX_CHAR"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter like a scintillator. + This is the name of this converter material. + </doc> + </field> + <field name="sensor_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter like a scintillator. + This is the thickness of this converter material. + </doc> + </field> + <field name="threshold_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc> + Single photon counter detectors can be adjusted + for a certain energy range in which they + work optimally. This is the energy setting for this. + </doc> + </field> + <group type="NXdetector_module"> + <doc> + For use in special cases where the data in NXdetector + is represented in several parts, each with a separate geometry. + + Use one or more instances of the NXdetector_module + group to declare regions of interest or some other + subdivision of a detector. + </doc> + </group> + <choice name="pixel_shape"> + <group type="NXoff_geometry"> + <doc> + Shape description of each pixel. Use only if all pixels in the detector + are of uniform shape. + </doc> + </group> + <group type="NXcylindrical_geometry"> + <doc> + Shape description of each pixel. Use only if all pixels in the detector + are of uniform shape and require being described by cylinders. + </doc> + </group> + </choice> + <choice name="detector_shape"> + <group type="NXoff_geometry"> + <doc> + Shape description of the whole detector. Use only if pixels in the + detector are not of uniform shape. + </doc> + </group> + <group type="NXcylindrical_geometry"> + <doc> + Shape description of the whole detector. Use only if pixels in the + detector are not of uniform shape and require being described by cylinders. + </doc> + </group> + </choice> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXdetector_group.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXdetector_group.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..05652e292a92fb224f53180b6a34b935aa166331 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXdetector_group.nxdl.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXdetector_group" + type="group" extends="NXobject"> + <doc> + Logical grouping of detector elements. + + This class is used to allow a logical + grouping of detector elements (e.g. which tube, bank or group of banks) to be + recorded in the file. As well as allowing you to e.g just select the "left" or + "east" detectors, it may also be useful for determining which elements belong to the + same PSD tube and hence have e.g. the same dead time. + + For example, if we had "bank1" composed + of "tube1", "tube2" and "tube3" then group_names would be the string "bank1, + bank1/tube1, bank1/tube2,bank1/tube3" group_index would be {1,2,3,4} group_parent + would be {-1,1,1,1} + + The mapping array is interpreted as + group 1 is a top level group containing groups 2, 3 and 4 + + A ``group_index`` array in + ``NXdetector`` gives the base group for a detector element. + </doc> + <field name="group_names"> + <doc>Comma separated list of name</doc> + </field> + <field name="group_index" type="NX_INT"> + <doc> + Unique ID for group. A group_index array + in ``NXdetector`` gives the base group for a detector element. + </doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + <field name="group_parent" type="NX_INT"> + <doc>Index of group parent in the hierarchy: -1 means no parent (i.e. a top level) group</doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> + <field name="group_type" type="NX_INT"> + <doc>Code number for group type, e.g. bank=1, tube=2 etc.</doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXdetector_module.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXdetector_module.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..0868fcc5fe7676943216e1afb040fdaf6493293d --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXdetector_module.nxdl.xml @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2013-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXdetector_module" + type="group" extends="NXobject"> + <doc> + Geometry and logical description of a detector module. + + Many detectors consist of multiple + smaller modules. Sometimes it is important to know the exact position of such + modules. + This is the purpose of this group. It is a child group to NXdetector. + + Note, the pixel size is given as values in the array fast_pixel_direction and slow_pixel_direction. + </doc> + <field name="data_origin" type="NX_INT"> + <doc> + A two value field which gives the index of the start of the + modules data in the + main area detector image in the underlying NXdetector module. + </doc> + </field> + <field name="data_size" type="NX_INT"> + <doc> + Two values for the size of the module in pixels in each direction. + </doc> + </field> + + <field name="module_offset" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Offset of the module in regards to the origin of the detector in an + arbitrary direction. + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation + </doc> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the next element in the geometry chain. + </doc> + </attribute> + </field> + <field name="fast_pixel_direction" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Values along the direction of fastest varying pixel direction. Each value in this + array is the size of a pixel in the units specified. Alternatively, if only one + value is given, all pixels in this direction have the same value. The direction + itself is given through the vector attribute. + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation + </doc> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the next element in the geometry chain. + </doc> + </attribute> + </field> + <field name="slow_pixel_direction" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Values along the direction of fastest varying pixel direction. Each value in this + array is the size of a pixel in the units specified. Alternatively, if only one + value is given, all pixels in this direction have the same value. The direction + itself is given through the vector attribute. + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation + </doc> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the next element in the geometry chain. + </doc> + </attribute> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXdisk_chopper.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXdisk_chopper.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a1afadf673cfab8f5cb642aa8d522212a77696df --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXdisk_chopper.nxdl.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXdisk_chopper" + type="group" extends="NXobject"> + + <doc> + A device blocking the beam in a temporal periodic pattern. + + TODO: need documentation + </doc> + + <field name="type"> + <doc>Type of the disk-chopper: only one from the enumerated list (match text exactly)</doc> + <enumeration> + <item value="Chopper type single" /> + <item value="contra_rotating_pair" /> + <item value="synchro_pair" /> + </enumeration> + </field> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="slits" type="NX_INT"> + <doc>Number of slits</doc> + </field> + <field name="slit_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>angular opening</doc> + </field> + <field name="pair_separation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>disc spacing in direction of beam</doc> + </field> + <field name="radius" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius to centre of slit</doc> + </field> + <field name="slit_height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>total slit height</doc> + </field> + <field name="phase" type="NX_FLOAT" units="NX_ANGLE"> + <doc>chopper phase angle</doc> + </field> + <field name="ratio" type="NX_INT"> + <doc> + pulse reduction factor of this chopper in relation to other + choppers/fastest pulse in the instrument + </doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Effective distance to the origin</doc> + </field> + <field name="wavelength_range" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>low and high values of wavelength range transmitted</doc> + <dimensions><dim index="1" value="2"/></dimensions> + </field> + <group type="NXgeometry" /> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXentry.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXentry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1453360a2021df8198d6a0d1d9fcec33c660f893 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXentry.nxdl.xml @@ -0,0 +1,218 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXentry" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` (or :ref:`NXsubentry`) group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + + It is recommended (as of NIAC2014 [#]_) to use this attribute + to help define the path to the default dataset to be plotted. + + .. [#] NIAC2014 discussion summary: + http://wiki.nexusformat.org/2014_How_to_find_default_data + </doc> + </attribute> + + <doc> + (**required**) :ref:`NXentry` describes the measurement. + + The top-level NeXus group which contains all the data and associated + information that comprise a single measurement. + It is mandatory that there is at least one + group of this type in the NeXus file. </doc> + + <group type="NXdata"> + <doc> + The data group + + .. note:: Before the NIAC2016 meeting [#]_, at least one + :ref:`NXdata` group was required in each :ref:`NXentry` group. + At the NIAC2016 meeting, it was decided to make :ref:`NXdata` + an optional group in :ref:`NXentry` groups for data files that + do not use an application definition. + It is recommended strongly that all NeXus data files provide + a NXdata group. + It is permissable to omit the NXdata group only when + defining the default plot is not practical or possible + from the available data. + + For example, neutron event data may not have anything that + makes a useful plot without extensive processing. + + Certain application definitions override this decision and + require an :ref:`NXdata` group + in the :ref:`NXentry` group. The ``minOccurs=0`` attribute + in the application definition will indicate the + :ref:`NXdata` group + is optional, otherwise, it is required. + + .. [#] NIAC2016: + http://wiki.nexusformat.org/NIAC2016, + https://github.com/nexusformat/NIAC/issues/16 + + </doc> + </group> + + <attribute name="IDF_Version"> + <!-- as ratified at NIAC2010 --> + <doc>ISIS Muon IDF_Version</doc> + </attribute> + <field name="title"> + <doc>Extended title for entry</doc> + </field> + <field name="experiment_identifier"> + <doc> + Unique identifier for the experiment, + defined by the facility, + possibly linked to the proposals + </doc> + </field> + <field name="experiment_description"> + <doc>Brief summary of the experiment, including key objectives.</doc> + </field> + <group type="NXnote" name="experiment_documentation"> + <doc>Description of the full experiment (document in pdf, latex, ...)</doc> + </group> + <field name="collection_identifier"> + <doc>User or Data Acquisition defined group of NeXus files or NXentry</doc> + </field> + <field name="collection_description"> + <doc>Brief summary of the collection, including grouping criteria.</doc> + </field> + <field name="entry_identifier"> + <doc>unique identifier for the measurement, defined by the facility.</doc> + </field> + <field name="features"> + <doc> + Reserved for future use by NIAC. + + See https://github.com/nexusformat/definitions/issues/382 + </doc> + </field> + <field name="definition"> + <doc> + (alternate use: see same field in :ref:`NXsubentry` for preferred) + + Official NeXus NXDL schema to which this entry conforms. + + This field is provided so that :ref:`NXentry` can be the overlay position + in a NeXus data file for an application definition and its + set of groups, fields, and attributes. + + *It is advised* to use :ref:`NXsubentry`, instead, as the overlay position. + </doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="definition_local" deprecated="see same field in :ref:`NXsubentry` for preferred use"> + <doc> + Local NXDL schema extended from the entry + specified in the ``definition`` field. + This contains any locally-defined, + additional fields in the entry. + </doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="start_time" type="NX_DATE_TIME"> + <doc>Starting time of measurement</doc> + </field> + <field name="end_time" type="NX_DATE_TIME"> + <doc>Ending time of measurement</doc> + </field> + <field name="duration" type="NX_INT" units="NX_TIME"> + <doc>Duration of measurement</doc> + </field> + <field name="collection_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time transpired actually collecting data i.e. taking out time when collection was + suspended due to e.g. temperature out of range + </doc> + </field> + <field name="run_cycle"> + <doc>Such as "2007-3". Some user facilities organize their beam time into run cycles.</doc> + </field> + <field name="program_name"> + <doc>Name of program used to generate this file</doc> + <attribute name="version"><doc>Program version number</doc></attribute> + <attribute name="configuration"><doc>configuration of the program</doc></attribute> + </field> + <field name="revision"> + <doc> + Revision id of the file due to re-calibration, reprocessing, new analysis, new + instrument definition format, ... + </doc> + <attribute name="comment"/> + </field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flightpath before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group name="notes" type="NXnote"> + <doc>Notes describing entry</doc> + </group> + <group name="thumbnail" type="NXnote"> + <doc> + A small image that is representative of the entry. An example of this is a 640x480 + jpeg image automatically produced by a low resolution plot of the NXdata. + </doc> + <attribute name="type"> + <doc>The mime type should be an ``image/*``</doc> + <enumeration> + <!-- + This is not perfect. + How do we set a default value for the type attribute? + --> + <item value="image/*" /> + </enumeration> + </attribute> + </group> + <group type="NXuser" /> + <group type="NXsample" /> + <group type="NXinstrument" /> + <group type="NXcollection" /> + <group type="NXmonitor" /> + <group type="NXparameters" /> + <group type="NXprocess" /> + <group type="NXsubentry" /> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXenvironment.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXenvironment.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f444eb7983641857373582becda8675c68175cc2 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXenvironment.nxdl.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXenvironment" + type="group" extends="NXobject"> + <doc>Parameters for controlling external conditions</doc> + <field name="name"> + <doc>Apparatus identification code/model number; e.g. OC100 011</doc> + </field> + <field name="short_name"> + <doc>Alternative short name, perhaps for dashboard display like a present Seblock name</doc> + </field> + <field name="type"> + <doc>Type of apparatus. This could be the SE codes in scheduling database; e.g. OC/100</doc> + </field> + <field name="description"> + <doc>Description of the apparatus; e.g. 100mm bore orange cryostat with Roots pump</doc> + </field> + <field name="program"> + <doc>Program controlling the apparatus; e.g. LabView VI name</doc> + </field> + <group name="position" type="NXgeometry"> + <doc>The position and orientation of the apparatus</doc> + </group> + <group type="NXnote"> + <doc>Additional information, LabView logs, digital photographs, etc</doc> + </group> + <group type="NXsensor"/> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXevent_data.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXevent_data.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c36cae5bbe53ac5b0633bb4fc5c6d48356cdeb8 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXevent_data.nxdl.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXevent_data" + type="group" extends="NXobject"> + <doc> + NXevent_data is a special group for storing data from neutron + detectors in event mode. In this mode, the detector electronics + emits a stream of detectorID, timestamp pairs. With detectorID + describing the detector element in which the neutron was detected + and timestamp the timestamp at which the neutron event was + detected. In NeXus detectorID maps to event_id, event_time_offset + to the timestamp. + + As this kind of data is common at pulsed neutron + sources, the timestamp is almost always relative to the start of a + neutron pulse. Thus the pulse timestamp is recorded too together + with an index in the event_id, event_time_offset pair at which data for + that pulse starts. At reactor source the same pulsed data effect + may be achieved through the use of choppers or in stroboscopic + measurement setups. + + In order to make random access to timestamped data + faster there is an optional array pair of + cue_timestamp_zero and cue_index. The cue_timestamp_zero will + contain courser timestamps then in the time array, say + every five minutes. The cue_index will then contain the + index into the event_id,event_time_offset pair of arrays for that + courser cue_timestamp_zero. + </doc> + <field name="event_time_offset" type="NX_NUMBER" units="NX_TIME_OF_FLIGHT"> + <doc> + A list of timestamps for each event as it comes in. + </doc> + <dimensions rank="1"><dim index="1" value="i"/></dimensions> + </field> + <field name="event_id" type="NX_INT" units="NX_DIMENSIONLESS"> + <doc> + There will be extra information in the NXdetector to convert + event_id to detector_number. + </doc> + <dimensions rank="1"><dim index="1" value="i"/></dimensions> + </field> + <field name="event_time_zero" type="NX_NUMBER" units="NX_TIME"> + <doc> + The time that each pulse started with respect to the offset + </doc> + <dimensions rank="1"><dim index="1" value="j"/></dimensions> + <attribute name="offset" type="NX_DATE_TIME"> + <doc>ISO8601</doc> + </attribute> + </field> + <field name="event_index" type="NX_INT" units="NX_DIMENSIONLESS"> + <doc> + The index into the event_time_offset, event_id pair for + the pulse occurring at the matching entry in event_time_zero. + </doc> + <dimensions rank="1"><dim index="1" value="j"/></dimensions> + </field> + <field name="pulse_height" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc> + If voltages from the ends of the detector are read out this + is where they go. This list is for all events with information + to attach to a particular pulse height. The information to + attach to a particular pulse is located in events_per_pulse. + </doc> + <dimensions rank="2"><!--i,k?--> + <dim index="1" value="i"/> + <dim index="2" value="k"/> + </dimensions> + </field> + <field name="cue_timestamp_zero" type="NX_DATE_TIME" + units="NX_TIME"> + <doc> + Timestamps matching the corresponding cue_index into the + event_id, event_time_offset pair. + </doc> + <attribute name="start" type="NX_DATE_TIME" /> + </field> + <field name="cue_index" type="NX_INT"> + <doc> + Index into the event_id, event_time_offset pair matching the corresponding + cue_timestamp. + </doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXfermi_chopper.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXfermi_chopper.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d27d84ac2650f104ff383bd0eadcd8abf0df2ec1 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXfermi_chopper.nxdl.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXfermi_chopper" + type="group" extends="NXobject"> + <doc>A Fermi chopper, possibly with curved slits.</doc> + <field name="type"> + <doc>Fermi chopper type</doc> + </field> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>chopper rotation speed</doc> + </field> + <field name="radius" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius of chopper</doc> + </field> + <field name="slit" type="NX_FLOAT" units="NX_LENGTH"> + <doc>width of an individual slit</doc> + </field> + <field name="r_slit" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius of curvature of slits</doc> + </field> + <field name="number" type="NX_INT" units="NX_UNITLESS"> + <doc>number of slits</doc> + </field> + <field name="height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam height</doc> + </field> + <field name="width" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam width</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>distance</doc> + </field> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <!-- should have units of angstroms or nm or pm --> + <doc>Wavelength transmitted by chopper</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + <group type="NXgeometry"> + <doc>geometry of the fermi chopper</doc> + </group> + <field name="absorbing_material"> + <doc>absorbing material</doc> + </field> + <field name="transmitting_material"> + <doc>transmitting material</doc> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXfilter.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXfilter.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..2d50e12c532757933a3d4d9426d2d562a75b9655 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXfilter.nxdl.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXfilter" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + For band pass beam filters. + + If uncertain whether to use :ref:`NXfilter` (band-pass filter) + or :ref:`NXattenuator` (reduces beam intensity), then use + :ref:`NXattenuator`. + </doc> + <group type="NXgeometry"> + <doc>Geometry of the filter</doc> + </group> + <field name="description"> + <doc> + Composition of the filter. Chemical formula can be specified separately. + + This field was changed (2010-11-17) from an enumeration to + a string since common usage showed a wider variety of use + than a simple list. These are the items in the list at + the time of the change: Beryllium | Pyrolytic Graphite | + Graphite | Sapphire | Silicon | Supermirror. + </doc> + </field> + <field name="status"> + <doc>position with respect to in or out of the beam (choice of only "in" or "out")</doc> + <enumeration> + <item value="in"><doc>in the beam</doc></item> + <item value="out"><doc>out of the beam</doc></item> + </enumeration> + </field> + <group name="transmission" type="NXdata"> + <doc>Wavelength transmission profile of filter</doc> + </group> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>average/nominal filter temperature</doc> + </field> + <group name="temperature_log" type="NXlog"> + <doc>Linked temperature_log for the filter</doc> + </group> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of the filter</doc> + </field> + <field name="density" type="NX_NUMBER" units="NX_MASS_DENSITY"> + <doc>mass density of the filter</doc> + </field> + <field name="chemical_formula"> + <!-- copied from NXsample --> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + + * C, then H, then the other elements in alphabetical order of their symbol. + * If carbon is not present, the elements are listed purely in alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <group name="sensor_type" type="NXsensor"> + <doc>Sensor(s)used to monitor the filter temperature</doc> + </group> + <field name="unit_cell_a" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell lattice parameter: length of side a</doc> + </field> + <field name="unit_cell_b" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell lattice parameter: length of side b</doc> + </field> + <field name="unit_cell_c" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell lattice parameter: length of side c</doc> + </field> + <field name="unit_cell_alpha" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Unit cell lattice parameter: angle alpha</doc> + </field> + <field name="unit_cell_beta" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Unit cell lattice parameter: angle beta</doc> + </field> + <field name="unit_cell_gamma" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Unit cell lattice parameter: angle gamma</doc> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Unit cell</doc> + <dimensions rank="1"><dim index="1" value="n_comp"/></dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal filter using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="3"><!--n_comp,3,3--> + <dim index="1" value="n_comp"/><!-- TODO n_comp is number of different compositions? --> + <dim index="2" value="3"/> + <dim index="3" value="3"/> + </dimensions> + </field> + <field name="m_value" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>m value of supermirror filter</doc> + </field> + <field name="substrate_material"> + <doc>substrate material of supermirror filter</doc> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>substrate thickness of supermirror filter</doc> + </field> + <field name="coating_material"> + <doc>coating material of supermirror filter</doc> + </field> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>substrate roughness (RMS) of supermirror filter</doc> + </field> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>coating roughness (RMS) of supermirror filter</doc> + <dimensions rank="1"><dim index="1" incr="1" value="nsurf"/></dimensions> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXflipper.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXflipper.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..ac33476e5002cde61b543b60cfc182b40cf07747 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXflipper.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXflipper" + type="group" extends="NXobject"> + <doc>A spin flipper.</doc> + <field name="type"> + <enumeration> + <item value="coil"/> + <item value="current-sheet"></item> + </enumeration> + </field> + <field name="flip_turns" type="NX_FLOAT" units="NX_PER_LENGTH"> + <doc>Linear density of turns (such as number of turns/cm) in flipping field coils</doc> + </field> + <field name="comp_turns" type="NX_FLOAT" units="NX_PER_LENGTH"> + <doc>Linear density of turns (such as number of turns/cm) in compensating field coils</doc> + </field> + <field name="guide_turns" type="NX_FLOAT" units="NX_PER_LENGTH"> + <doc>Linear density of turns (such as number of turns/cm) in guide field coils</doc> + </field> + <field name="flip_current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Flipping field coil current in "on" state"</doc> + </field> + <field name="comp_current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Compensating field coil current in "on" state"</doc> + </field> + <field name="guide_current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Guide field coil current in "on" state"</doc> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>thickness along path of neutron travel</doc> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXfresnel_zone_plate.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXfresnel_zone_plate.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..ce35913928f0d26af3e3a60f21a91659a175a639 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXfresnel_zone_plate.nxdl.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXfresnel_zone_plate" type="group" extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" +> + + <doc>A fresnel zone plate</doc> + <field name="focus_parameters" type="NX_FLOAT"> + <doc> + list of polynomial coefficients describing the focal length of the zone plate, in increasing powers of photon energy, + that describes the focal length of the zone plate (in microns) at an X-ray photon energy (in electron volts). + </doc> + <dimensions rank="1"/> + </field> + <field name="outer_diameter" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="outermost_zone_width" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="central_stop_diameter" type="NX_FLOAT" units="NX_LENGTH"/> + + <field name="fabrication"> + <doc>how the zone plate was manufactured</doc> + <enumeration> + <item value="etched" /> + <item value="plated" /> + <item value="zone doubled" /> + <item value="other" /> + </enumeration> + </field> + <field name="zone_height" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="zone_material"> + <doc>Material of the zones themselves</doc> + </field> + <field name="zone_support_material"> + <doc>Material present between the zones. This is usually only present for the "zone doubled" fabrication process</doc> + </field> + <field name="central_stop_material"/> + <field name="central_stop_thickness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mask_thickness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mask_material"> + <doc>If no mask is present, set mask_thickness to 0 and omit the mask_material field</doc> + </field> + <field name="support_membrane_material"/> + <field name="support_membrane_thickness" type="NX_FLOAT" units="NX_LENGTH"/> + + <group type="NXtransformations"><doc>"Engineering" position of the fresnel zone plate</doc></group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXgeometry.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXgeometry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..387dd712f2811060e7d94398f514bd9fc49c6f64 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXgeometry.nxdl.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXgeometry" + type="group" extends="NXobject" + deprecated="as decided at 2014 NIAC meeting, convert to use :ref:`NXtransformations`" + > + <doc> + legacy class - recommend to use :ref:`NXtransformations` now + + It is recommended that instances of :ref:`NXgeometry` be converted to + use :ref:`NXtransformations`. + + This is the description for a general position of a component. + It is recommended to name an instance of :ref:`NXgeometry` as "geometry" + to aid in the use of the definition in simulation codes such as McStas. + Also, in HDF, linked items must share the same name. + However, it might not be possible or practical in all situations. + </doc> + <group type="NXshape"> + <doc>shape/size information of component</doc> + </group> + <group type="NXtranslation"> + <doc>translation of component</doc> + </group> + <group type="NXorientation"> + <doc>orientation of component</doc> + </group> + <field name="description"> + <doc> + Optional description/label. Probably only present if we are + an additional reference point for components rather than the + location of a real component. + </doc> + </field> + <field name="component_index" type="NX_INT"> + <doc> + Position of the component along the beam path. The sample is at 0, components upstream + have negative component_index, components downstream have positive + component_index. + </doc> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXgrating.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXgrating.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..e5f6639488abff4c3baff6b6363fefb98eb00c3d --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXgrating.nxdl.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXgrating" type="group" extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc>A diffraction grating, as could be used in a soft X-ray monochromator</doc> + <field name="angles" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Blaze or trapezoidal angles, with the angle of the upstream facing edge listed first. Blazed gratings can be identified by the low value of the first-listed angle.</doc> + <dimensions rank="1"> + <dim index="1" value="2" /> + </dimensions> + </field> + <field name="period" type="NX_FLOAT" units="NX_LENGTH"> + <doc>List of polynomial coefficients describing the spatial separation of lines/grooves as a function of position along the grating, in increasing powers of position. Gratings which do not have variable line spacing will only have a single coefficient (constant).</doc> + <dimensions rank="1"/> + </field> + <field name="duty_cycle" type="NX_FLOAT" units="NX_UNITLESS"/> + <field name="depth" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="diffraction_order" type="NX_INT" units="NX_UNITLESS"/> + <field name="deflection_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Angle between the incident beam and the utilised outgoing beam.</doc> + </field> + <field name="interior_atmosphere"> + <enumeration> + <item value="vacuum"/> + <item value="helium"/> + <item value="argon"/> + </enumeration> + </field> + <field name="substrate_material"> + <doc></doc> + </field> + <field name="substrate_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="coating_material"/> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="layer_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc> An array describing the thickness of each layer</doc> + </field> + <group type="NXshape" name="shape"> + <doc>A NXshape group describing the shape of the mirror</doc> + </group> + <group name="figure_data" type="NXdata"> + <doc>Numerical description of the surface figure of the mirror.</doc> + </group> + <group type="NXtransformations"><doc>"Engineering" position of the grating</doc></group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXguide.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXguide.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..95c8c15ca1b715de11530958fef9dc96bcbed58e --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXguide.nxdl.xml @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXguide" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <symbol name="nsurf"><doc>number of reflecting surfaces</doc></symbol> + <symbol name="nwl"><doc>number of wavelengths</doc></symbol> + </symbols> + + <doc> + A neutron optical element to direct the path of the beam. + + :ref:`NXguide` is used by neutron instruments to describe + a guide consists of several mirrors building a shape through which + neutrons can be guided or directed. The simplest such form is box shaped + although elliptical guides are gaining in popularity. + The individual parts of a guide usually have common characteristics + but there are cases where they are different. + For example, a neutron guide might consist of 2 or 4 coated walls or + a supermirror bender with multiple, coated vanes. + + To describe polarizing supermirrors such as used in neutron reflection, + it may be necessary to revise this definition of :ref:`NXguide` + to include :ref:`NXpolarizer` and/or :ref:`NXmirror`. + + When even greater complexity exists in the definition of what + constitutes a *guide*, it has been suggested that :ref:`NXguide` + be redefined as a :ref:`NXcollection` of :ref:`NXmirror` each + having their own :ref:`NXgeometry` describing their location(s). + + For the more general case when describing mirrors, consider using + :ref:`NXmirror`. + + NOTE: The NeXus International Advisory Committee welcomes + comments for revision and improvement of + this definition of :ref:`NXguide`. + + </doc> + + <group type="NXgeometry"> + <doc>TODO: Explain what this NXgeometry group means. What is intended here?</doc> + </group> + <field name="description"> + <doc>A description of this particular instance of ``NXguide``.</doc> + </field> + <field name="incident_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc>TODO: documentation needed</doc> + </field> + <group type="NXdata" name="reflectivity"> + <doc>Reflectivity as function of reflecting surface and wavelength</doc> + <attribute name="signal"> + <enumeration> + <item value="data" /> + </enumeration> + </attribute> + <attribute name="axes"> + <enumeration> + <item value="surface wavelength" /> + </enumeration> + </attribute> + <attribute name="surface_indices"> + <enumeration> + <item value="0" /> + </enumeration> + </attribute> + <attribute name="wavelength_indices"> + <enumeration> + <item value="1" /> + </enumeration> + </attribute> + <field name="data" type="NX_NUMBER"> + <doc>reflectivity of each surface as a function of wavelength</doc> + <dimensions rank="2"><!-- was [nsurf,i] --> + <dim index="1" value="nsurf"/> + <dim index="2" value="nwl"/> + </dimensions> + </field> + <field name="surface" type="NX_NUMBER" units="NX_ANY"> + <doc> + List of surfaces. Probably best to use index + numbers but the specification is very loose. + </doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="wavelength" type="NX_NUMBER" units="NX_WAVELENGTH"> + <doc>wavelengths at which reflectivity was measured</doc> + <dimensions rank="1"> + <dim index="1" value="nwl"/> + </dimensions> + </field> + </group> + <field name="bend_angle_x" type="NX_FLOAT" units="NX_ANGLE"> + <doc>TODO: documentation needed</doc> + </field> + <field name="bend_angle_y" type="NX_FLOAT" units="NX_ANGLE"> + <doc>TODO: documentation needed</doc> + </field> + <field name="interior_atmosphere"> + <doc><!-- TODO --></doc> + <enumeration> + <item value="vacuum"/> + <item value="helium"/> + <item value="argon"/> + </enumeration> + </field> + <field name="external_material"> + <doc>external material outside substrate</doc> + </field> + <field name="m_value" type="NX_FLOAT"> + <doc> + The ``m`` value for a supermirror, which defines the supermirror + regime in multiples of the critical angle of Nickel. + </doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="substrate_material" type="NX_FLOAT"> + <doc>TODO: documentation needed</doc><!-- Why is this field a "float"? --> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>TODO: documentation needed</doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="coating_material" type="NX_FLOAT"> + <doc>TODO: documentation needed</doc><!-- Why is this field a "float"? --> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>TODO: documentation needed</doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>TODO: documentation needed</doc> + <dimensions rank="1"> + <dim index="1" value="nsurf"/> + </dimensions> + </field> + <field name="number_sections" type="NX_INT" units="NX_UNITLESS"> + <doc> + number of substrate sections (also called ``nsurf`` as an + index in the ``NXguide`` specification) + </doc> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXinsertion_device.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXinsertion_device.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..8166d236a51ef33c7408eab58256f863ec49f33e --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXinsertion_device.nxdl.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXinsertion_device" + type="group" extends="NXobject"> + <doc>An insertion device, as used in a synchrotron light source.</doc> + <field name="type"> + <enumeration> + <item value="undulator"/> + <item value="wiggler"></item> + </enumeration> + </field> + <field name="gap" type="NX_FLOAT" units="NX_LENGTH"> + <doc>separation between opposing pairs of magnetic poles</doc> + </field> + <field name="taper" type="NX_FLOAT" units="NX_ANGLE"> + <doc>angular of gap difference between upstream and downstream ends of the insertion device</doc> + </field> + <field name="phase" type="NX_FLOAT" units="NX_ANGLE"/> + <field name="poles" type="NX_INT" units="NX_UNITLESS"> + <doc>number of poles</doc> + </field> + <field name="magnetic_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + <field name="k" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>beam displacement parameter</doc> + </field> + <field name="length" type="NX_FLOAT" units="NX_LENGTH"> + <doc>length of insertion device</doc> + </field> + <field name="power" type="NX_FLOAT" units="NX_POWER"> + <doc>total power delivered by insertion device</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy of peak intensity in output spectrum</doc> + </field> + <field name="bandwidth" type="NX_FLOAT" units="NX_ENERGY"> + <doc>bandwidth of peak energy</doc><!-- What are the best units here? --> + </field> + <field name="harmonic" type="NX_INT" units="NX_UNITLESS"> + <doc>harmonic number of peak</doc> + </field> + <group type="NXdata" name="spectrum"> + <doc>spectrum of insertion device</doc> + </group> + <group type="NXgeometry"> + <doc>"Engineering" position of insertion device</doc> + </group> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXinstrument.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXinstrument.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..497601103511dbe4ea016f83badef8d6ce7adbb9 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXinstrument.nxdl.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXinstrument" + type="group" extends="NXobject"> + <doc> + Collection of the components of the instrument or beamline. + + Template of instrument descriptions comprising various beamline components. + Each component will also be a NeXus group defined by its distance from the + sample. Negative distances represent beamline components that are before the + sample while positive distances represent components that are after the sample. + This device allows the unique identification of beamline components in a way + that is valid for both reactor and pulsed instrumentation. + </doc> + <field name="name"> + <doc>Name of instrument</doc> + <attribute name="short_name"> + <doc>short name for instrument, perhaps the acronym</doc> + </attribute> + </field> + <group type="NXaperture" /> + <group type="NXattenuator" /> + <group type="NXbeam" /> + <group type="NXbeam_stop" /> + <group type="NXbending_magnet" /> + <group type="NXcollimator" /> + <group type="NXcollection" /> + <group type="NXcapillary" /> + <group type="NXcrystal" /> + <group type="NXdetector" /> + <group type="NXdetector_group" /> + <group type="NXdisk_chopper" /> + <group type="NXevent_data" /> + <group type="NXfermi_chopper" /> + <group type="NXfilter" /> + <group type="NXflipper" /> + <group type="NXguide" /> + <group type="NXinsertion_device" /> + <group type="NXmirror" /> + <group type="NXmoderator" /> + <group type="NXmonochromator" /> + <group type="NXpolarizer" /> + <group type="NXpositioner" /> + <group type="NXsource" /> + <group type="NXvelocity_selector" /> + <group type="NXxraylens" /> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXlog.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXlog.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..043e9413fc46966e81c95ec4d58ed16a1159f2f9 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXlog.nxdl.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXlog" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Information recorded as a function of time. + + Description of information that is recorded against + time. There are two common use cases for this: + + - When logging data such as temperature during a run + - When data is taken in streaming mode data acquisition, + i.e. just timestamp, value pairs are stored and + correlated later in data reduction with other data, + + + In both cases, NXlog contains + the logged or streamed values and the times at which they were measured as elapsed time since a starting + time recorded in ISO8601 format. The time units are + specified in the units attribute. An optional scaling attribute + can be used to accomodate non standard clocks. + + + This method of storing logged data helps to distinguish + instances in which a variable is a dimension scale of the data, in which case it is stored + in an :ref:`NXdata` group, and instances in which it is logged during the + run, when it should be stored in an :ref:`NXlog` group. + + In order to make random access to timestamped data faster there is an optional array pair of + ``cue_timestamp_zero`` and ``cue_index``. The ``cue_timestamp_zero`` will + contain coarser timestamps than in the time array, say + every five minutes. The ``cue_index`` will then contain the + index into the time,value pair of arrays for that + coarser ``cue_timestamp_zero``. + + </doc> + <field name="time" type="NX_NUMBER" units="NX_TIME"> + <doc> + Time of logged entry. The times are relative to the "start" attribute + and in the units specified in the "units" + attribute. Please note that absolute + timestamps under unix are relative to ``1970-01-01T:00:00``. + + The scaling_factor, when present, has to be applied to the time values in order + to arrive at the units specified in the units attribute. The scaling_factor allows + for arbitrary time units such as ticks of some hardware clock. + </doc> + <attribute name="start" type="NX_DATE_TIME" /> + <attribute name="scaling_factor" type="NX_NUMBER" /> + </field> + <field name="value" units="NX_ANY" type="NX_NUMBER"> + <doc> + Array of logged value, such as temperature. If this is + a single value the dimensionality is + nEntries. However, NXlog can also be used to store + multi dimensional time stamped data such as images. In + this example the dimensionality of values would be value[nEntries,xdim,ydim]. + </doc> + </field> + <field name="raw_value" units="NX_ANY" type="NX_NUMBER"> + <doc>Array of raw information, such as thermocouple voltage</doc> + </field> + <field name="description"> + <doc>Description of logged value</doc> + </field> + <field name="average_value" type="NX_FLOAT" units="NX_ANY"/> + <field name="average_value_error" type="NX_FLOAT" units="NX_ANY"> + <doc>estimated uncertainty (often used: standard deviation) of average_value</doc> + </field> + <field name="minimum_value" type="NX_FLOAT" units="NX_ANY"/> + <field name="maximum_value" type="NX_FLOAT" units="NX_ANY"/> + <field name="duration" type="NX_FLOAT" units="NX_ANY"> + <doc>Total time log was taken</doc> + </field> + <field name="cue_timestamp_zero" type="NX_NUMBER" units="NX_TIME"> + <doc> + Timestamps matching the corresponding cue_index into the + time, value pair. + </doc> + <attribute name="start" type="NX_DATE_TIME"> + <doc>If missing start is assumed to be the same as for "time".</doc> + </attribute> + <attribute name="scaling_factor" type="NX_NUMBER"> + <doc>If missing start is assumed to be the same as for "time".</doc> + </attribute> + </field> + <field name="cue_index" type="NX_INT"> + <doc> + Index into the time, value pair matching the corresponding + cue_timestamp. + </doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXmirror.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXmirror.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..75d38c6b17ef0975aeac0afef1a8077393331c71 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXmirror.nxdl.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmirror" + type="group" extends="NXobject"> + <doc>A beamline mirror or supermirror.</doc> + + <group type="NXgeometry"><doc><!-- TODO explain what this group means --></doc> + </group> + <field name="type"> + <enumeration> + <item value="single"><doc>mirror with a single material as a reflecting surface</doc></item> + <item value="multi"><doc>mirror with stacked, multiple layers as a reflecting surface</doc></item> + </enumeration> + </field> + <field name="description"> + <doc>description of this mirror</doc> + </field> + <field name="incident_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc></doc> + </field> + <group type="NXdata" name="reflectivity"> + <!-- + TODO Trac ticket #45 applies here. + https://github.com/nexusformat/definitions/issues/45 + + TODO Solution of ticket #41 will apply here, as well. + https://github.com/nexusformat/definitions/issues/41 + --> + <doc>Reflectivity as function of wavelength</doc> + </group> + <!-- TODO need more documentation throughout --> + <field name="bend_angle_x" type="NX_FLOAT" units="NX_ANGLE"> + <doc></doc> + </field> + <field name="bend_angle_y" type="NX_FLOAT" units="NX_ANGLE"> + <doc></doc> + </field> + <field name="interior_atmosphere"> + <enumeration> + <item value="vacuum"/> + <item value="helium"/> + <item value="argon"/> + </enumeration> + </field> + <field name="external_material"> + <doc>external material outside substrate</doc> + </field> + <field name="m_value" type="NX_FLOAT" units="NX_UNITLESS"> + <doc> + The m value for a supermirror, which defines the supermirror + regime in multiples of the critical angle of Nickel. + </doc> + </field> + <field name="substrate_material"> + <doc></doc> + </field> + <field name="substrate_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="substrate_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="coating_material"> + <doc></doc> + </field> + <field name="substrate_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="coating_roughness" type="NX_FLOAT" units="NX_LENGTH"> + <doc></doc> + </field> + <field name="even_layer_material"> + <doc></doc> + </field> + <field name="even_layer_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="odd_layer_material"> + <doc></doc> + </field> + <field name="odd_layer_density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc></doc> + </field> + <field name="layer_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc> An array describing the thickness of each layer</doc> + </field> + <group type="NXshape" name="shape"> + <doc>A NXshape group describing the shape of the mirror</doc> + </group> + <group name="figure_data" type="NXdata"> + <doc>Numerical description of the surface figure of the mirror.</doc> + </group> + <!-- TODO need more parameters here, such as ... + list from Rainer Gehrke, DESY (some items may already be present) + +Parameters for mirrors + Field indicating whether simple or multilayer + Substrate element or compound + Substrate density + In case of multilayer: Even layer material (element or compound) + Even layer density + Odd layer material (element or compound) + Odd layer density + Number of layer pairs + Layer thickness (array) + + +Figure for crystals and mirrors (to describe curved surfaces) + Field indicating whether concave or convex + Field indicating whether cylindrical or not + If cylindrical: cylinder orientation angle + +Now come the different surface figures with the necessary parameters: +1. Flat +2. Spherical (spherical radius) +3. Elliptical and hyperbolical (semi-major axis, semi-minor axis, angle of major axis and pole) +4. Toroidal (major radius, minor radius) +5. Parabolical (parabolic parameter a) +6. Conical (cone half aperture) +7. Polynomial (degree of polynom, array with polynom coefficients) + + --> + +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXmoderator.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXmoderator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..389ce26f9321c938fbbb853d6eda04b88d0487ca --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXmoderator.nxdl.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmoderator" + type="group" extends="NXobject"> + <doc>A neutron moderator</doc> + <group type="NXgeometry"> + <doc>"Engineering" position of moderator</doc> + </group> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Effective distance as seen by measuring radiation</doc> + </field> + <field name="type"> + <enumeration> + <item value="H20"/> + <item value="D20"/> + <item value="Liquid H2"/> + <item value="Liquid CH4"/> + <item value="Liquid D2"/> + <item value="Solid D2"/> + <item value="C"/> + <item value="Solid CH4"/> + <item value="Solid H2"/> + </enumeration> + </field> + <field name="poison_depth" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="coupled" type="NX_BOOLEAN"> + <doc>whether the moderator is coupled</doc> + </field> + <field name="coupling_material"> + <doc>The material used for coupling. Usually Cd.</doc> + </field> + <field name="poison_material"> + <enumeration> + <item value="Gd"/> + <item value="Cd"/> + </enumeration> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>average/nominal moderator temperature</doc> + </field> + <group type="NXlog" name="temperature_log"> + <doc>log file of moderator temperature</doc> + </group> + <group type="NXdata" name="pulse_shape"> + <doc>moderator pulse shape</doc> + </group> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXmonitor.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXmonitor.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..84aa84ad47fa6c739701dbc6b3b09f08bafbffa8 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXmonitor.nxdl.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmonitor" + type="group" extends="NXobject"> + <doc> + A monitor of incident beam data. + + It is similar to the :ref:`NXdata` groups containing + monitor data and its associated dimension scale, e.g. time_of_flight or + wavelength in pulsed neutron instruments. However, it may also include + integrals, or scalar monitor counts, which are often used in both in both + pulsed and steady-state instrumentation. + </doc> + <field name="mode"> + <doc> + Count to a preset value based on either clock time (timer) + or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="start_time" type="NX_DATE_TIME"> + <doc>Starting time of measurement</doc> + </field> + <field name="end_time" type="NX_DATE_TIME"> + <doc>Ending time of measurement</doc> + </field> + <field name="preset" type="NX_NUMBER" units="NX_ANY"> + <doc>preset value for time or monitor</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Distance of monitor from sample</doc> + </field> + <field name="range" type="NX_FLOAT" units="NX_ANY"> + <doc>Range (X-axis, Time-of-flight, etc.) over which the integral was calculated</doc> + <dimensions><dim index="1" value="2"/></dimensions> + </field> + <field name="nominal" type="NX_NUMBER" units="NX_ANY"> + <doc>Nominal reading to be used for normalisation purposes.</doc> + </field> + <field name="integral" type="NX_NUMBER" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + <group name="integral_log" type="NXlog"> + <doc>Time variation of monitor counts</doc> + </group> + <field name="type"> + <enumeration> + <item value="Fission Chamber"/> + <item value="Scintillator"/> + </enumeration> + </field> + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME_OF_FLIGHT"> + <doc>Time-of-flight</doc> + <dimensions> + <dim index="1" ref="efficiency"/> + </dimensions> + </field> + <field name="efficiency" type="NX_NUMBER" units="NX_DIMENSIONLESS"> + <doc>Monitor efficiency</doc> + <dimensions><dim index="1" ref="i"/></dimensions> + </field> + <field name="data" type="NX_NUMBER" units="NX_ANY"> + <doc> + Monitor data + </doc> + <dimensions rank="dataRank"> + <doc> + The rank (``dataRank``) of the ``data`` must satisfy + ``1 <= dataRank <= NX_MAXRANK=32``. + At least one ``dim`` must have length ``n``. + </doc> + <dim index="0" value="n"><!-- index="0": cannot know to which dimension this applies a priori --></dim> + </dimensions> + </field> + <field name="sampled_fraction" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>Proportion of incident beam sampled by the monitor (0<x<1)</doc> + </field> + <group type="NXgeometry"> + <doc>Geometry of the monitor</doc> + </group> + <field name="count_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Elapsed actual counting time, can be an array of size ``np`` + when scanning. This is not the difference of the calendar time + but the time the instrument was really counting, without + pauses or times lost due beam unavailability + </doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXmonochromator.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXmonochromator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..7fff9cc5b57b3779415cdef58740fbb85522c532 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXmonochromator.nxdl.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXmonochromator" + type="group" extends="NXobject"> + <doc> + A wavelength defining device. + + This is a base class for everything which + selects a wavelength or energy, be it a + monochromator crystal, a velocity selector, + an undulator or whatever. + + The expected units are: + + * wavelength: angstrom + * energy: eV + + </doc> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>wavelength selected</doc> + </field> + <field name="wavelength_error" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>wavelength standard deviation</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy selected</doc> + </field> + <field name="energy_error" type="NX_FLOAT" units="NX_ENERGY"> + <doc>energy standard deviation</doc> + </field> + <group type="NXdata" name="distribution"/> + <group type="NXgeometry" name="geometry"/> + <group type="NXcrystal"><doc>Use as many crystals as necessary to describe</doc></group> + <group type="NXvelocity_selector"/> + <group type="NXgrating"><doc>For diffraction grating based monochromators</doc></group> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXnote.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXnote.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a9cbe0121297fcf93bd66271c6e8e60bf5919869 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXnote.nxdl.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXnote" + type="group" extends="NXobject"> + <doc> + Any additional freeform information not covered by the other base classes. + + This class can be used to store additional information in a + NeXus file e.g. pictures, movies, audio, additional text logs + </doc> + <field name="author"> + <doc>Author or creator of note</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date note created/added</doc> + </field> + <field name="type"> + <doc>Mime content type of note data field e.g. image/jpeg, text/plain, text/html</doc> + </field> + <field name="file_name"> + <doc>Name of original file name if note was read from an external source</doc> + </field> + <field name="description"> + <doc>Title of an image or other details of the note</doc> + </field> + <field name="sequence_index" type="NX_POSINT"> + <doc> + Sequence index of note, for placing a sequence of + multiple **NXnote** groups in an order. Starts with 1. + </doc> + </field> + <field name="data" type="NX_BINARY"> + <doc>Binary note data - if text, line terminator is [CR][LF].</doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXobject.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXobject.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..768ae7c0dced0ef9bfd928244cad75436c033bac --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXobject.nxdl.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXobject" + type="group"> + <doc> + This is the base object of NeXus + </doc> + <!--attribute name="name"><doc>name of instance</doc></attribute--> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXoff_geometry.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXoff_geometry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..94ff937cffe6ab9c1b10cdd8fdb229287166c329 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXoff_geometry.nxdl.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXoff_geometry" + type="group" extends="NXobject"> + + <symbols> + <doc>These symbols will be used below.</doc> + <symbol name="i"><doc>number of vertices in the shape</doc></symbol> + <symbol name="k"><doc>number of faces in the shape</doc></symbol> + <symbol name="l"> + <doc> + number faces which are detecting surfaces or form the boundary of + detecting volumes + </doc> + </symbol> + </symbols> + + <doc> + Geometry (shape) description. + The format closely matches the Object File Format (OFF) which can be output + by most CAD software. + It can be used to describe the shape of any beamline component, including detectors. + In the case of detectors it can be used to define the shape of a single pixel, or, + if the pixel shapes are non-uniform, to describe the shape of the whole detector. + </doc> + + <field name="vertices" type="NX_NUMBER" units="NX_LENGTH"> + + <doc> + List of x,y,z coordinates for vertices. + The origin of the coordinates is the position of the parent component, for + example the NXdetector which the geometry describes. + If the shape describes a single pixel for a detector with uniform pixel + shape then the origin is the position of each pixel as described by the + ``x/y/z_pixel_offset`` datasets in ``NXdetector``. + </doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="3" /> + </dimensions> + + </field> + + <field name="winding_order" type="NX_INT"> + + <doc> + List of indices of vertices in the ``vertices`` dataset to form each face, + right-hand rule for face normal. + </doc> + + <dimensions rank="1"> + <dim index="1" value="j" /> + </dimensions> + + </field> + + <field name="faces" type="NX_INT"> + + <doc>The start index in ``winding_order`` for each face.</doc> + + <dimensions rank="1"> + <dim index="1" value="k" /> + </dimensions> + + </field> + + <field name="detector_faces" type="NX_INT"> + + <doc> + List of pairs of index in the "faces" dataset and detector id. Face IDs in + the first column, and corresponding detector IDs in the second column. + This dataset should only be used only if the ``NXoff_geometry`` group is + describing a detector. + Note, the face indices must be in ascending order but need not be + consecutive as not every face in faces need be a detecting surface or + boundary of detecting volume. + Can use multiple entries with the same detector id to define detector volumes. + </doc> + + <dimensions rank="2"> + <dim index="1" value="l" /> + <dim index="2" value="2" /> + </dimensions> + + </field> + +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXorientation.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXorientation.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..2fe02d6831090241f5c1e97b2ec2403357b52534 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXorientation.nxdl.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org + +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXorientation" + type="group" extends="NXobject"> + <doc> + legacy class - recommend to use :ref:`NXtransformations` now + + Description for a general orientation of a component - used by :ref:`NXgeometry` + </doc> + <group type="NXgeometry"> + <doc>Link to another object if we are using relative positioning, else absent</doc> + </group> + <field name="value" type="NX_FLOAT" units="NX_UNITLESS"> + <doc> + The orientation information is stored as direction cosines. The direction cosines will + be between the local coordinate directions and the reference directions (to origin or + relative NXgeometry). Calling the local unit vectors (x',y',z') and the reference unit + vectors (x,y,z) the six numbers will be [x' dot x, x' dot y, x' dot z, y' dot x, y' dot + y, y' dot z] where "dot" is the scalar dot product (cosine of the angle between the unit + vectors). The unit vectors in both the local and reference coordinates are right-handed + and orthonormal. + + The pair of groups NXtranslation and NXorientation together + describe the position of a component. + </doc> + <dimensions><!--numobj,6--> + <dim index="1" value="numobj"/> + <dim index="2" value="6"/> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXparameters.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXparameters.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b21a376d4c00b5504357fde05c93c3ce00ae90aa --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXparameters.nxdl.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXparameters" + type="group" extends="NXobject"> + <doc>Container for parameters, usually used in processing or analysis.</doc> + <field name="term" minOccurs="0" maxOccurs="unbounded" type="NX_CHAR"> + <!-- maxOccurs="unbounded" is intended but is not allowed by current syntax --> + <doc>A parameter (also known as a term) that is used in or results from processing.</doc> + <attribute name="units"/> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXpinhole.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXpinhole.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..9c6d5f8742bbc93a9a4a3101932dacf5bf44141b --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXpinhole.nxdl.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXpinhole" + type="group" extends="NXobject"> + <doc> + A simple pinhole. + + For more complex geometries, :ref:`NXaperture` should be used. + </doc> + <field name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the last element in the geometry chain that places + this object in space. + When followed through that chain is supposed to end at an element depending + on "." i.e. the origin of the coordinate system. + If desired the location of the slit can also be described relative to + an NXbeam, which will allow a simple description of a non-centred pinhole. + </doc> + </field> + <field name="diameter" type="NX_NUMBER" units="NX_LENGTH"> + <doc>Size of the circular hole defining the transmitted beam size.</doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXpolarizer.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXpolarizer.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..652a67db99103ac9c5bdcf7dc30b4eef6d675850 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXpolarizer.nxdl.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXpolarizer" + type="group" extends="NXobject"> + <doc> + A spin polarizer. + </doc> + <field name="type"> + <doc>one of these values: "crystal", "supermirror", "3He"</doc> + </field> + <field name="composition"> + <doc>description of the composition of the polarizing material</doc> + </field> + <field name="reflection" type="NX_INT" units="NX_UNITLESS"> + <doc>[hkl] values of nominal reflection</doc> + <dimensions> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="efficiency" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>polarizing efficiency</doc> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXpositioner.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXpositioner.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c802a9791eb39a416d59fe98aadbae2ce031f0f0 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXpositioner.nxdl.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXpositioner" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + A generic positioner such as a motor or piezo-electric transducer. + </doc> + <field name="name"> + <doc>symbolic or mnemonic name (one word)</doc> + </field> + <field name="description"> + <doc>description of positioner</doc> + </field> + <field name="value" type="NX_NUMBER" units="NX_ANY"> + <doc>best known value of positioner - need [n] as may be scanned</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="raw_value" type="NX_NUMBER" units="NX_ANY"> + <doc>raw value of positioner - need [n] as may be scanned</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="target_value" type="NX_NUMBER" units="NX_ANY"> + <doc>targeted (commanded) value of positioner - need [n] as may be scanned</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="tolerance" type="NX_NUMBER" units="NX_ANY"> + <doc>maximum allowable difference between target_value and value</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="soft_limit_min" type="NX_NUMBER" units="NX_ANY"> + <doc>minimum allowed limit to set value</doc> + </field> + <field name="soft_limit_max" type="NX_NUMBER" units="NX_ANY"> + <doc>maximum allowed limit to set value</doc> + </field> + <field name="velocity" type="NX_NUMBER" units="NX_ANY"> + <doc>velocity of the positioner (distance moved per unit time)</doc> + </field> + <field name="acceleration_time" type="NX_NUMBER" units="NX_ANY"> + <doc>time to ramp the velocity up to full speed</doc> + </field> + <!-- TODO other parameters: settling time, backlash, link to readback channel --> + <field name="controller_record"> + <doc>Hardware device record, e.g. EPICS process variable, taco/tango ...</doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXprocess.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXprocess.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..bc745780c7af4a123cc99ef6bbef17e5ca97a74c --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXprocess.nxdl.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXprocess" + type="group" extends="NXobject"> + <doc>Document an event of data processing, reconstruction, or analysis for this data.</doc> + <field name="program" type="NX_CHAR"> + <doc>Name of the program used</doc> + </field> + <field name="sequence_index" type="NX_POSINT"> + <doc> + Sequence index of processing, + for determining the order of multiple **NXprocess** steps. + Starts with 1. + </doc> + </field> + <field name="version" type="NX_CHAR"> + <doc>Version of the program used</doc> + </field> + <field name="date" type="NX_DATE_TIME"> + <doc>Date and time of processing.</doc> + </field> + <group type="NXnote"> + <doc> + The note will contain information about how the data was processed + or anything about the data provenance. + The contents of the note can be anything that the processing code + can understand, or simple text. + + The name will be numbered to allow for ordering of steps. + </doc> + </group> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXreflections.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXreflections.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b7f2509b28de2834be558aa8ed75824b36627d4 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXreflections.nxdl.xml @@ -0,0 +1,555 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NXreflections: candidate NeXus definition for reflection data +--> +<definition type="group" name="NXreflections" category="base" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <symbols> + <symbol name="n"><doc>number of reflections</doc></symbol> + <symbol name="m"><doc>number of experiments</doc></symbol> + </symbols> + <doc>This is a definition for reflection data from diffraction experiments </doc> + <group type="NXentry" minOccurs="1"> + + <field name="definition"> + <doc>NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXreflections" /> + </enumeration> + </field> + + <field name="experiments" minOccurs="1"> + <doc>The experiments from which the reflection data derives </doc> + <dimensions rank="1"> + <dim index="1" value="m" /> + </dimensions> + </field> + + <field name="h" type="NX_NUMBER" minOccurs="1"> + <doc>The h component of the miller index </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="k" type="NX_NUMBER" minOccurs="1"> + <doc>The k component of the miller index </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="l" type="NX_NUMBER" minOccurs="1"> + <doc>The l component of the miller index </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="id" type="NX_INT" minOccurs="1"> + <doc> + The id of the experiment which resulted in the reflection. If the value + is greater than 0, the experiments must link to a multi-experiment NXmx + group + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="reflection_id" type="NX_INT" minOccurs="1"> + <doc> + The id of the reflection. Multiple partials from the same reflection + should all have the same id + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + <field name="entering" type="NX_BOOLEAN" minOccurs="1"> + <doc>Is the reflection entering or exiting the Ewald sphere </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="det_module" type="NX_INT" minOccurs="1"> + <doc>The detector module on which the reflection was recorded </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="flags" type="NX_INT" minOccurs="1"> + <doc> + Status flags describing the reflection. + + This is a bit mask. The bits in the mask follow the convention + used by DIALS, and have the following names: + + === ========================================== + bit name + === ========================================== + 0 ``predicted`` + 1 ``observed`` + 2 ``indexed`` + 3 ``used_in_refinement`` + 4 ``strong`` + 5 ``reference_spot`` + 6 ``dont_integrate`` + 7 ``integrated_sum`` + 8 ``integrated_prf`` + 9 ``integrated`` + 10 ``overloaded`` + 11 ``overlapped`` + 12 ``overlapped_fg`` + 13 ``in_powder_ring`` + 14 ``foreground_includes_bad_pixels`` + 15 ``background_includes_bad_pixels`` + 16 ``includes_bad_pixels`` + 17 ``bad_shoebox`` + 18 ``bad_spot`` + 19 ``used_in_modelling`` + 20 ``centroid_outlier`` + 21 ``failed_during_background_modelling`` + 22 ``failed_during_summation`` + 23 ``failed_during_profile_fitting`` + 24 ``bad_reference`` + === ========================================== + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="d" type="NX_FLOAT" minOccurs="1"> + <doc>The resolution of the reflection </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="partiality" type="NX_FLOAT" minOccurs="1"> + <doc> + The partiality of the reflection. + Dividing by this number will inflate the measured + intensity to the full reflection equivalent. + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_frame" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The frame on which the bragg peak of the reflection is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The x position at which the bragg peak of the reflection + is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The y position at which the bragg peak of the reflection + is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_phi" type="NX_FLOAT" units="NX_ANGLE" minOccurs="1"> + <doc> + The phi angle at which the bragg peak of the reflection is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_px_x" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The x pixel position at which the bragg peak of the reflection is + predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_px_y" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The y pixel position at which the bragg peak of the reflection is + predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_frame" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The estimate of the frame at which the central impact of the + reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_frame_var" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The variance on the estimate of the frame at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_x" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The estimate of the pixel x position at which the central impact of + the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_x_var" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The variance on the estimate of the pixel x position at which the + central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_y" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The estimate of the pixel y position at which the central impact of + the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_y_var" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The variance on the estimate of the pixel y position at which the + central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_phi" type="NX_FLOAT" units="NX_ANGLE" minOccurs="1"> + <doc> + The estimate of the phi angle at which the central impact of the + reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_phi_var" type="NX_FLOAT" units="NX_ANGLE" minOccurs="1"> + <doc> + The variance on the estimate of the phi angle at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The estimate of the x position at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_x_var" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The variance on the estimate of the x position at which + the central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The estimate of the y position at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_y_var" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The variance on the estimate of the y position at which + the central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="bounding_box" type="NX_INT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The bounding box around the recorded recorded reflection. + Should be an integer array of length 6, where the 6 values + are pixel positions or frame numbers, as follows: + + ===== =========================== + index meaning + ===== =========================== + 0 The lower pixel x position + 1 The upper pixel x position + 2 The lower pixel y position + 3 The upper pixel y position + 4 The lower frame number + 5 The upper frame number + ===== =========================== + </doc> + <dimensions rank="2"> + <dim index="1" value="n" /> + <dim index="2" value="6" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="background_mean" type="NX_FLOAT" minOccurs="1"> + <doc> + The mean background under the reflection peak + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_prf" type="NX_FLOAT" minOccurs="0"> + <doc> + The estimate of the reflection intensity by profile fitting + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_prf_var" type="NX_FLOAT" minOccurs="0"> + <doc> + The variance on the estimate of the reflection intensity by profile + fitting + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_sum" type="NX_FLOAT" minOccurs="1"> + <doc>The estimate of the reflection intensity by summation </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_sum_var" type="NX_FLOAT" minOccurs="1"> + <doc> + The variance on the estimate of the reflection intensity by + summation + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="lp" type="NX_FLOAT" minOccurs="1"> + <doc> + The LP correction factor to be applied to the reflection intensities + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="prf_cc" type="NX_FLOAT" minOccurs="0"> + <doc> + The correlation of the reflection profile with the reference profile + used in profile fitting + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="overlaps" type="NX_INT" minOccurs="0"> + <doc> + An adjacency list specifying the spatial overlaps of reflections. The + adjacency list is specified using an array data type where the elements + of the array are the indices of the adjacent overlapped reflection + </doc> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" minOccurs="0"> + <doc> + Polar angle of reflection centroid, following the NeXus simple (spherical polar) coordinate system + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE" minOccurs="0"> + <doc> + Azimuthal angle of reflection centroid, following the NeXus simple (spherical polar) coordinate system + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + </field> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXroot.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXroot.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..2162e05fc55a51c92637f1617f1e74cf333d4568 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXroot.nxdl.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXroot" + type="group" extends="NXobject"> + <doc>Definition of the root NeXus group.</doc> + <attribute name="NX_class"> + <doc> + The root of any NeXus data file is an ``NXroot`` class + (no other choice is allowed for a valid NeXus data file). + This attribute cements that definition. + </doc> + <enumeration> + <item value="NXroot"></item> + </enumeration> + </attribute> + <attribute name="file_time"> + <doc>Date and time file was originally created</doc> + </attribute> + <attribute name="file_name"> + <doc>File name of original NeXus file</doc> + </attribute> + <attribute name="file_update_time"> + <doc>Date and time of last file change at close</doc> + </attribute> + <attribute name="NeXus_version"> + <doc> + Version of NeXus API used in writing the file. + + Only used when the NAPI has written the file. + Note that this is different from the version of the + base class or application definition version number. + </doc> + </attribute> + <attribute name="HDF_version"> + <doc>Version of HDF (version 4) library used in writing the file</doc> + </attribute> + <attribute name="HDF5_Version"> + <doc> + Version of HDF5 library used in writing the file. + + Note this attribute is spelled with uppercase "V", + different than other version attributes. + </doc> + </attribute> + <attribute name="XML_version"> + <doc>Version of XML support library used in writing the XML file</doc> + </attribute> + <attribute name="h5py_version"> + <doc>Version of h5py Python package used in writing the file</doc> + </attribute> + <attribute name="creator"> + <doc>facility or program where file originated</doc> + </attribute> + <group type="NXentry" minOccurs="1" > + <doc>entries</doc> + </group> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXentry` group contains + the data to be shown by default. + It is needed to resolve ambiguity when + more than one :ref:`NXentry` group exists. + The value is the name of the default :ref:`NXentry` group. + + It is recommended (as of NIAC2014) to use this attribute + to help define the path to the default dataset to be plotted. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXsample.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXsample.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..80f4ab4e819fff9c42f93d31658f6fd35ae49776 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXsample.nxdl.xml @@ -0,0 +1,373 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsample" + type="group" extends="NXobject" + > + + <symbols> + <doc>symbolic array lengths to be coordinated between various fields</doc> + <symbol name="n_comp"><doc>number of compositions</doc></symbol> + <symbol name="n_Temp"><doc>number of temperatures</doc></symbol> + <symbol name="n_eField"><doc>number of values in applied electric field</doc></symbol> + <symbol name="n_mField"><doc>number of values in applied magnetic field</doc></symbol> + <symbol name="n_pField"><doc>number of values in applied pressure field</doc></symbol> + <symbol name="n_sField"><doc>number of values in applied stress field</doc></symbol> + </symbols> + + <doc> + Any information on the sample. + + This could include scanned variables that + are associated with one of the data dimensions, e.g. the magnetic field, or + logged data, e.g. monitored temperature vs elapsed time. + </doc> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="chemical_formula"> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + + - C, then H, then the other elements in alphabetical order of their symbol. + - If carbon is not present, the elements are listed purely in alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"> + <doc>Sample temperature. This could be a scanned variable</doc> + <dimensions rank="anyRank"> + <dim index="1" value="n_Temp"/><!-- could be any length --> + </dimensions> + </field> + <field name="electric_field" type="NX_FLOAT" units="NX_VOLTAGE"> + <doc>Applied electric field</doc> + <dimensions> + <dim index="1" value="n_eField"/><!-- could be any length --> + </dimensions> + <attribute name="direction"> + <enumeration> + <item value="x"/> + <item value="y"/> + <item value="z"/> + </enumeration> + </attribute> + </field> + <field name="magnetic_field" type="NX_FLOAT" units="NX_ANY"> + <doc>Applied magnetic field</doc> + <dimensions> + <dim index="1" value="n_mField"/><!-- could be any length --> + </dimensions> + <attribute name="direction"> + <enumeration> + <item value="x"/> + <item value="y"/> + <item value="z"/> + </enumeration> + </attribute> + </field> + <field name="stress_field" type="NX_FLOAT" units="NX_ANY"> + <doc>Applied external stress field</doc> + <dimensions> + <dim index="1" value="n_sField"/><!-- could be any length --> + </dimensions> + <attribute name="direction"> + <enumeration> + <item value="x"/> + <item value="y"/> + <item value="z"/> + </enumeration> + </attribute> + </field> + <field name="pressure" type="NX_FLOAT" units="NX_PRESSURE"> + <doc>Applied pressure</doc> + <dimensions> + <dim index="1" value="n_pField"/><!-- could be any length --> + </dimensions> + </field> + <field name="changer_position" type="NX_INT" units="NX_UNITLESS"> + <doc>Sample changer position</doc> + </field> + <field name="unit_cell_abc" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Crystallography unit cell parameters a, b, and c</doc> + <dimensions> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="unit_cell_alphabetagamma" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Crystallography unit cell parameters alpha, beta, and gamma</doc> + <dimensions> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="unit_cell" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Unit cell parameters (lengths and angles)</doc> + <dimensions rank="2"> + <dim index="1" value="n_comp"/> + <dim index="2" value="6"/> + </dimensions> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Volume of the unit cell</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="sample_orientation" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + This will follow the Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal sample using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464 + </doc> + <dimensions rank="3"> + <dim index="1" value="n_comp"/> + <dim index="2" value="3"/> + <dim index="3" value="3"/> + </dimensions> + </field> + <field name="ub_matrix" type="NX_FLOAT"> + <doc> + UB matrix of single crystal sample using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464. This is + the multiplication of the orientation_matrix, given above, + with the :math:`B` matrix which + can be derived from the lattice constants. + </doc> + <dimensions rank="3"> + <dim index="1" value="n_comp"/> + <dim index="2" value="3"/> + <dim index="3" value="3"/> + </dimensions> + </field> + <field name="mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Mass of sample</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc>Density of sample</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="relative_molecular_mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Relative Molecular Mass of sample</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="type"> + <enumeration> + <item value="sample" /> + <item value="sample+can" /> + <item value="can" /> + <item value="sample+buffer" /> + <item value="buffer" /> + <item value="calibration sample" /> + <item value="normalisation sample" /> + <item value="simulated data" /> + <item value="none" /> + <item value="sample environment" /> + </enumeration> + </field> + <field name="situation"> + <doc> + The atmosphere will be one of the components, which is where + its details will be stored; the relevant components will be + indicated by the entry in the sample_component member. + </doc> + <enumeration> + <item value="air" /> + <item value="vacuum" /> + <item value="inert atmosphere" /> + <item value="oxidising atmosphere" /> + <item value="reducing atmosphere" /> + <item value="sealed can" /> + <item value="other" /> + </enumeration> + </field> + <field name="description"> + <doc> + Description of the sample + </doc> + </field> + <field name="preparation_date" type="NX_DATE_TIME"> + <doc>Date of preparation of the sample</doc> + </field> + <group name="geometry" type="NXgeometry"> + <doc>The position and orientation of the center of mass of the sample</doc> + </group> + <group type="NXbeam"> + <doc>Details of beam incident on sample - used to calculate sample/beam interaction point</doc> + </group> + <group type="NXsample_component"> + <doc> + One group per sample component + This is the perferred way of recording per component information over the n_comp arrays + </doc> + </group> + <field name="component"> + <doc>Details of the component of the sample and/or can</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="sample_component"> + <doc>Type of component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + <enumeration> + <item value="sample" /> + <item value="can" /> + <item value="atmosphere" /> + <item value="kit" /> + </enumeration> + </field> + <field name="concentration" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc>Concentration of each component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="volume_fraction" type="NX_FLOAT"> + <doc>Volume fraction of each component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="scattering_length_density" type="NX_FLOAT" units="NX_SCATTERING_LENGTH_DENSITY"> + <doc>Scattering length density of each component</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="unit_cell_class"> + <doc> + In case it is all we know and we want to record/document it + </doc> + <enumeration> + <item value="triclinic" /> + <item value="monoclinic" /> + <item value="orthorhombic" /> + <item value="tetragonal" /> + <item value="rhombohedral" /> + <item value="hexagonal" /> + <item value="cubic" /> + </enumeration> + </field> + <field name="space_group"> + <doc>Crystallographic space group</doc> + <dimensions> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="point_group"> + <doc>Crystallographic point group, deprecated if space_group present</doc> + <dimensions> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="path_length" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Path length through sample/can for simple case when + it does not vary with scattering direction + </doc> + </field> + <field name="path_length_window" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Thickness of a beam entry/exit window on the can (mm) + - assumed same for entry and exit + </doc> + </field> + <field name="thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>sample thickness</doc> + </field> + <group name="transmission" type="NXdata"> + <doc>As a function of Wavelength</doc> + </group> + <group name="temperature_log" type="NXlog"> + <doc>temperature_log.value is a link to e.g. temperature_env.sensor1.value_log.value</doc> + </group> + <group name="temperature_env" type="NXenvironment"> + <doc>Additional sample temperature environment information</doc> + </group> + <group name="magnetic_field_log" type="NXlog"> + <doc>magnetic_field_log.value is a link to e.g. magnetic_field_env.sensor1.value_log.value</doc> + </group> + <group name="magnetic_field_env" type="NXenvironment"> + <doc>Additional sample magnetic environment information</doc> + </group> + <field name="external_DAC" type="NX_FLOAT" units="NX_ANY"> + <doc>value sent to user's sample setup</doc> + </field> + <group name="external_ADC" type="NXlog"> + <doc>logged value (or logic state) read from user's setup</doc> + </group> + <field name="short_title"> + <doc>20 character fixed length sample description for legends</doc> + <!-- How is the string length limitation imposed by the XSD? --> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + Optional rotation angle for the case when the powder diagram has + been obtained through an omega-2theta scan like from a traditional + single detector powder diffractometer + </doc> + </field> + <field name="x_translation" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the X-direction of the laboratory coordinate system</doc> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Translation of the sample along the Z-direction of the laboratory coordinate system</doc> + </field> + <group type="NXpositioner"> + <doc>Any positioner (motor, PZT, ...) used to locate the sample</doc> + </group> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXsample_component.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXsample_component.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..160b7dedc87260e50f5d3a6c4857fbcb339ff05f --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXsample_component.nxdl.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2016-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsample_component" + type="group" extends="NXobject" + > + + <symbols> + <doc>symbolic array lengths to be coordinated between various fields</doc> + <symbol name="n_Temp"><doc>number of temperatures</doc></symbol> + <symbol name="n_eField"><doc>number of values in applied electric field</doc></symbol> + <symbol name="n_mField"><doc>number of values in applied magnetic field</doc></symbol> + <symbol name="n_pField"><doc>number of values in applied pressure field</doc></symbol> + <symbol name="n_sField"><doc>number of values in applied stress field</doc></symbol> + </symbols> + + <doc> + One group like this per component can be recorded For a sample consisting of multiple components. + </doc> + <field name="name"> + <doc>Descriptive name of sample component</doc> + </field> + <field name="chemical_formula"> + <doc> + The chemical formula specified using CIF conventions. + Abbreviated version of CIF standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of '1' may be omitted. + * A space or parenthesis must separate each cluster of (element symbol + count). + * Where a group of elements is enclosed in parentheses, the multiplier for the + group must follow the closing parentheses. That is, all element and group + multipliers are assumed to be printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to their chemical + structure, the order of the elements within any group or moiety depends on + whether or not carbon is present. + * If carbon is present, the order should be: + + - C, then H, then the other elements in alphabetical order of their symbol. + - If carbon is not present, the elements are listed purely in alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="unit_cell_abc" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Crystallography unit cell parameters a, b, and c</doc> + <dimensions> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="unit_cell_alphabetagamma" type="NX_FLOAT" units="NX_ANGLE"> + <doc>Crystallography unit cell parameters alpha, beta, and gamma</doc> + <dimensions> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="unit_cell_volume" type="NX_FLOAT" units="NX_VOLUME"> + <doc>Volume of the unit cell</doc> + </field> + <field name="sample_orientation" type="NX_FLOAT" units="NX_ANGLE"> + <doc>This will follow the Busing and Levy convention from Acta.Crysta v22, p457 (1967)</doc> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + Orientation matrix of single crystal sample component. + This will follow the Busing and Levy convention from Acta.Crysta v22, p457 (1967) + </doc> + <dimensions rank="2"> + <dim index="1" value="3"/> + <dim index="2" value="3"/> + </dimensions> + </field> + <field name="mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Mass of sample component</doc> + </field> + <field name="density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc>Density of sample component</doc> + </field> + <field name="relative_molecular_mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Relative Molecular Mass of sample component</doc> + </field> + <field name="description"> + <doc> + Description of the sample component + </doc> + </field> + <field name="volume_fraction" type="NX_FLOAT"> + <doc>Volume fraction of component</doc> + </field> + <field name="scattering_length_density" type="NX_FLOAT" units="NX_SCATTERING_LENGTH_DENSITY"> + <doc>Scattering length density of component</doc> + </field> + <field name="unit_cell_class"> + <doc> + In case it is all we know and we want to record/document it + </doc> + <enumeration> + <item value="triclinic" /> + <item value="monoclinic" /> + <item value="orthorhombic" /> + <item value="tetragonal" /> + <item value="rhombohedral" /> + <item value="hexagonal" /> + <item value="cubic" /> + </enumeration> + </field> + <field name="space_group"> + <doc>Crystallographic space group</doc> + </field> + <field name="point_group"> + <doc>Crystallographic point group, deprecated if space_group present</doc> + </field> + <group name="transmission" type="NXdata"> + <doc>As a function of Wavelength</doc> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXsensor.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXsensor.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d20d7d6199d167dc0da1edce6af8bb0804e95c06 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXsensor.nxdl.xml @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsensor" + type="group" extends="NXobject"> + <doc> + A sensor used to monitor an external condition + + The condition itself is described in :ref:`NXenvironment`. + </doc> + <field name="model"> + <doc>Sensor identification code/model number</doc> + </field> + <field name="name"> + <doc>Name for the sensor</doc> + </field> + <field name="short_name"> + <doc>Short name of sensor used e.g. on monitor display program</doc> + </field> + <field name="attached_to"> + <doc>where sensor is attached to ("sample" | "can")</doc> + </field> + <group name="geometry" type="NXgeometry"> + <doc>Defines the axes for logged vector quantities if they are not the global instrument axes</doc> + </group> + <field name="measurement"> + <doc>name for measured signal</doc> + <enumeration> + <item value="temperature" /> + <item value="pH" /> + <item value="magnetic_field" /> + <item value="electric_field" /> + <item value="conductivity" /> + <item value="resistance" /> + <item value="voltage" /> + <item value="pressure" /> + <item value="flow" /> + <item value="stress" /> + <item value="strain" /> + <item value="shear" /> + <item value="surface_pressure" /> + </enumeration> + </field> + <field name="type"> + <doc> + The type of hardware used for the measurement. + Examples (suggestions but not restrictions): + + :Temperature: + J | K | T | E | R | S | Pt100 | Rh/Fe + :pH: + Hg/Hg2Cl2 | Ag/AgCl | ISFET + :Ion selective electrode: + specify species; e.g. Ca2+ + :Magnetic field: + Hall + :Surface pressure: + wilhelmy plate + </doc> + </field> + <field name="run_control" type="NX_BOOLEAN"> + <doc> + Is data collection controlled or synchronised to this quantity: + 1=no, 0=to "value", 1=to "value_deriv1", etc. + </doc> + </field> + <field name="high_trip_value" type="NX_FLOAT" units="NX_ANY"> + <doc> + Upper control bound of sensor reading if using run_control + </doc> + </field> + <field name="low_trip_value" type="NX_FLOAT" units="NX_ANY"> + <doc> + Lower control bound of sensor reading if using run_control + </doc> + </field> + <field name="value" type="NX_FLOAT" units="NX_ANY"> + <doc> + nominal setpoint or average value + - need [n] as may be a vector + </doc> + <dimensions> + <dim index="1" value="n"/> + </dimensions> + </field> + <field name="value_deriv1" type="NX_FLOAT" units="NX_ANY"> + <doc> + Nominal/average first derivative of value + e.g. strain rate + - same dimensions as "value" (may be a vector) + </doc> + <dimensions> + <dim index="1" ref="value"/> + </dimensions> + </field> + <field name="value_deriv2" type="NX_FLOAT" units="NX_ANY"> + <doc> + Nominal/average second derivative of value + - same dimensions as "value" (may be a vector) + </doc> + <dimensions> + <dim index="1" ref="value"/> + </dimensions> + </field> + <group name="value_log" type="NXlog"> + <doc>Time history of sensor readings</doc> + </group> + <group name="value_deriv1_log" type="NXlog"> + <doc>Time history of first derivative of sensor readings</doc> + </group> + <group name="value_deriv2_log" type="NXlog"> + <doc>Time history of second derivative of sensor readings</doc> + </group> + <field name="external_field_brief"> + <enumeration> + <item value="along beam" /> + <item value="across beam" /> + <item value="transverse" /> + <item value="solenoidal" /> + <item value="flow shear gradient" /> + <item value="flow vorticity" /> + </enumeration> + </field> + <group name="external_field_full" type="NXorientation"> + <doc>For complex external fields not satisfied by External_field_brief</doc> + </group> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXshape.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXshape.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4ee83d74e4fa9b6e500869387c044cc078d3f9ff --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXshape.nxdl.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXshape" + type="group" extends="NXobject"> + <doc> + legacy class - (used by :ref:`NXgeometry`) - the shape and size of a component. + + This is the description of the general shape and size of a + component, which may be made up of ``numobj`` separate + elements - it is used by the :ref:`NXgeometry` class + </doc> + <field name="shape"> + <doc>general shape of a component</doc> + <enumeration> + <item value="nxflat"/> + <item value="nxcylinder"/> + <item value="nxbox"/> + <item value="nxsphere"/> + <item value="nxcone"/> + <item value="nxelliptical"/> + <item value="nxtoroidal"/> + <item value="nxparabolic"/> + <item value="nxpolynomial"/> + </enumeration> + + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + physical extent of the object along its local axes (after NXorientation) + with the center of mass at the local origin (after NXtranslation). + The meaning and location of these axes will vary according to the value + of the "shape" variable. + ``nshapepar`` defines how many parameters: + + - For "nxcylinder" type the parameters are (diameter,height) and a three value orientation vector of the cylinder. + - For the "nxbox" type the parameters are (length,width,height). + - For the "nxsphere" type the parameters are (diameter). + - For nxcone cone half aperture + - For nxelliptical, semi-major axis, semi-minor-axis, angle of major axis and pole + - For nxtoroidal, major radius, minor radius + - For nxparabolic, parabolic parameter a + - For nxpolynomial, an array of polynom coefficients, the dimension of the array + encodes the degree of the polynom + </doc> + <dimensions> + <dim index="1" value="numobj"/> + <dim index="2" value="nshapepar"/> + </dimensions> + </field> + <field name="direction"> + <enumeration> + <item value="concave"></item> + <item value="convex"></item> + </enumeration> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXslit.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXslit.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..886b816f2e112d41aec5fbb1f333c6d0feee9f0f --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXslit.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXslit" + type="group" extends="NXobject"> + <doc> + A simple slit. + + For more complex geometries, :ref:`NXaperture` should be used. + </doc> + <field name="depends_on" type="NX_CHAR"> + <doc> + Points to the path of the last element in the geometry chain that places + this object in space. + When followed through that chain is supposed to end at an element depending + on "." i.e. the origin of the coordinate system. + If desired the location of the slit can also be described relative to + an NXbeam, which will allow a simple description of a non-centred slit. + </doc> + </field> + <field name="x_gap" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Size of the gap opening in the first dimension of the local + coordinate system. + </doc> + </field> + <field name="y_gap" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Size of the gap opening in the second dimension of the local + coordinate system. + </doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXsource.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXsource.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c3e8c740f6db1ccb539bbb8e445123e35eb3597b --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXsource.nxdl.xml @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXsource" + type="group" extends="NXobject"> + <doc>The neutron or x-ray storage ring/facility.</doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Effective distance from sample + Distance as seen by radiation from sample. This number should be negative + to signify that it is upstream of the sample. + </doc> + </field> + <field name="name"> + <doc>Name of source</doc> + <attribute name="short_name"> + <doc>short name for source, perhaps the acronym</doc> + </attribute> + </field> + <field name="type"> + <doc>type of radiation source (pick one from the enumerated list and spell exactly)</doc> + <enumeration> + <item value="Spallation Neutron Source" /> + <item value="Pulsed Reactor Neutron Source" /> + <item value="Reactor Neutron Source" /> + <item value="Synchrotron X-ray Source" /> + <item value="Pulsed Muon Source" /> + <item value="Rotating Anode X-ray" /> + <item value="Fixed Tube X-ray" /> + <item value="UV Laser" /> + <item value="Free-Electron Laser" /> + <item value="Optical Laser" /> + <item value="Ion Source" /> + <item value="UV Plasma Source" /> + </enumeration> + </field> + <field name="probe"> + <doc>type of radiation probe (pick one from the enumerated list and spell exactly)</doc> + <enumeration> + <item value="neutron" /> + <item value="x-ray" /> + <item value="muon" /> + <item value="electron" /> + <item value="ultraviolet" /> + <item value="visible light" /> + <item value="positron" /> + <item value="proton" /> + </enumeration> + </field> + <field name="power" type="NX_FLOAT" units="NX_POWER"> + <doc>Source power</doc> + </field> + <field name="emittance_x" type="NX_FLOAT" units="NX_EMITTANCE"> + <doc>Source emittance (nm-rad) in X (horizontal) direction.</doc> + </field> + <field name="emittance_y" type="NX_FLOAT" units="NX_EMITTANCE"> + <doc>Source emittance (nm-rad) in Y (horizontal) direction.</doc> + </field> + <field name="sigma_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc>particle beam size in x</doc> + </field> + <field name="sigma_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc>particle beam size in y</doc> + </field> + <field name="flux" type="NX_FLOAT" units="NX_FLUX"> + <doc>Source intensity/area (example: s-1 cm-2)</doc> + </field> + <field name="energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc> + Source energy. + For storage rings, this would be the particle beam energy. + For X-ray tubes, this would be the excitation voltage. + </doc> + </field> + <field name="current" type="NX_FLOAT" units="NX_CURRENT"> + <doc>Accelerator, X-ray tube, or storage ring current</doc> + </field> + <field name="voltage" type="NX_FLOAT" units="NX_VOLTAGE"> + <doc>Accelerator voltage</doc> + </field> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>Frequency of pulsed source</doc> + </field> + <field name="period" type="NX_FLOAT" units="NX_PERIOD"> + <doc>Period of pulsed source</doc> + </field> + <field name="target_material"> + <doc>Pulsed source target material</doc> + <enumeration> + <item value="Ta" /> + <item value="W" /> + <item value="depleted_U" /> + <item value="enriched_U" /> + <item value="Hg" /> + <item value="Pb" /> + <item value="C" /> + </enumeration> + </field> + <group name="notes" type="NXnote"> + <doc> + any source/facility related messages/events that + occurred during the experiment + </doc> + </group> + <group name="bunch_pattern" type="NXdata"> + <doc> + For storage rings, description of the bunch pattern. + This is useful to describe irregular bunch patterns. + </doc> + <field name="title"><doc>name of the bunch pattern</doc></field> + </group> + <field name="number_of_bunches" type="NX_INT"> + <doc>For storage rings, the number of bunches in use.</doc> + </field> + <field name="bunch_length" type="NX_FLOAT" units="NX_TIME"> + <doc>For storage rings, temporal length of the bunch</doc> + </field> + <field name="bunch_distance" type="NX_FLOAT" units="NX_TIME"> + <doc>For storage rings, time between bunches</doc> + </field> + <field name="pulse_width" type="NX_FLOAT" units="NX_TIME"> + <doc>temporal width of source pulse</doc><!-- pulsed sources or storage rings could use this --> + </field> + <group name="pulse_shape" type="NXdata"> + <doc>source pulse shape</doc><!-- pulsed sources or storage rings could use this --> + </group> + <field name="mode"> + <doc>source operating mode</doc> + <enumeration> + <item value="Single Bunch"><doc>for storage rings</doc></item> + <item value="Multi Bunch"><doc>for storage rings</doc></item> + <!-- other sources could add to this --> + </enumeration> + </field> + <field name="top_up" type="NX_BOOLEAN"> + <doc>Is the synchrotron operating in top_up mode?</doc> + </field> + <field name="last_fill" type="NX_NUMBER" units="NX_CURRENT"> + <doc>For storage rings, the current at the end of the most recent injection.</doc> + <attribute name="time" type="NX_DATE_TIME"><doc>date and time of the most recent injection.</doc></attribute> + </field> + <group name="geometry" type="NXgeometry"> + <doc>"Engineering" location of source</doc> + </group> + <group type="NXdata" name="distribution"> + <doc>The wavelength or energy distribution of the source</doc> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXsubentry.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXsubentry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d9a994c80800231e3d7685848eabce317df2d1e --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXsubentry.nxdl.xml @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsubentry" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` group contains the data + to be shown by default. + It is needed to resolve ambiguity when more than + one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + + It is recommended (as of NIAC2014) to use this attribute + to help define the path to the default dataset to be plotted. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> + + <doc> + Group of multiple application definitions for "multi-modal" (e.g. SAXS/WAXS) measurements. + + ``NXsubentry`` is a base class virtually identical to :ref:`NXentry` + and is used as the (overlay) location for application definitions. + Use a separate ``NXsubentry`` for each application definition. + + To use ``NXsubentry`` with a hypothetical application definition + called ``NXmyappdef``: + + * Create a group with attribute ``NX_class="NXsubentry"`` + * Within that group, create a field called ``definition="NXmyappdef"``. + * There are two optional attributes of definition: ``version`` and ``URL`` + + The intended use is to define application definitions for a + multi-modal (a.k.a. multi-technique) :ref:`NXentry`. + Previously, an application definition + replaced :ref:`NXentry` with its own definition. + With the increasing popularity of instruments combining + multiple techniques for data collection (such as SAXS/WAXS instruments), + it was recognized the application definitions must be entered in the NeXus + data file tree as children of :ref:`NXentry`. + </doc> + + <attribute name="IDF_Version"> + <!-- as ratified at NIAC2010 --> + <doc>ISIS Muon IDF_Version</doc> + </attribute> + + <field name="title"> + <doc>Extended title for entry</doc> + </field> + <field name="experiment_identifier"> + <doc> + Unique identifier for the experiment, defined by + the facility, possibly linked to the proposals + </doc> + </field> + <field name="experiment_description"> + <doc>Brief summary of the experiment, including key objectives.</doc> + </field> + <group type="NXnote" name="experiment_documentation"> + <doc>Description of the full experiment (document in pdf, latex, ...)</doc> + </group> + <field name="collection_identifier"> + <doc>User or Data Acquisition defined group of NeXus files or :ref:`NXentry`</doc> + </field> + <field name="collection_description"> + <doc>Brief summary of the collection, including grouping criteria.</doc> + </field> + <field name="entry_identifier"> + <doc>unique identifier for the measurement, defined by the facility.</doc> + </field> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this subentry conforms</doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="definition_local"> + <doc> + Local NXDL schema extended from the subentry + specified in the ``definition`` field. + This contains any locally-defined, + additional fields in the subentry. + </doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="start_time" type="NX_DATE_TIME"> + <doc>Starting time of measurement</doc> + </field> + <field name="end_time" type="NX_DATE_TIME"> + <doc>Ending time of measurement</doc> + </field> + <field name="duration" type="NX_INT" units="NX_TIME"> + <doc>Duration of measurement</doc> + </field> + <field name="collection_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time transpired actually collecting data i.e. taking out time when collection was + suspended due to e.g. temperature out of range + </doc> + </field> + <field name="run_cycle"> + <doc>Such as "2007-3". Some user facilities organize their beam time into run cycles.</doc> + </field> + <field name="program_name"> + <doc>Name of program used to generate this file</doc> + <attribute name="version"><doc>Program version number</doc></attribute> + <attribute name="configuration"><doc>configuration of the program</doc></attribute> + </field> + <field name="revision"> + <doc> + Revision id of the file due to re-calibration, reprocessing, new analysis, new + instrument definition format, ... + </doc> + <attribute name="comment"/> + </field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flightpath before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group name="notes" type="NXnote"> + <doc>Notes describing entry</doc> + </group> + <group name="thumbnail" type="NXnote"> + <doc> + A small image that is representative of the entry. An example of this is a 640x480 + jpeg image automatically produced by a low resolution plot of the NXdata. + </doc> + <attribute name="mime_type"> + <doc>The value should be an ``image/*``</doc> + <enumeration> + <!-- + This is not perfect. + How do we set a default value for the mime_type attribute? + --> + <item value="image/*" /> + </enumeration> + </attribute> + </group> + <group type="NXuser" /> + <group type="NXsample" /> + <group type="NXinstrument" /> + <group type="NXcollection" /> + <group type="NXmonitor" /> + <group type="NXdata" /> + <group type="NXparameters" /> + <group type="NXprocess" /> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXtransformations.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXtransformations.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1bbb23b096b2c74d9ccf21cf389eeb879df2d433 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXtransformations.nxdl.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" + category="base" + name="NXtransformations" + type="group" + extends="NXobject" + ignoreExtraGroups="true" + ignoreExtraFields="true" + ignoreExtraAttributes="true" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc> + Collection of axis-based translations and rotations to describe a geometry. + May also contain axes that do not move and therefore do not have a transformation + type specified, but are useful in understanding coordinate frames within which + transformations are done, or in documenting important directions, such as the + direction of gravity. + + A nested sequence of transformations lists the offset and rotation steps + needed to describe the position and orientation of any movable or fixed device. + + There will be one or more transformations (axes) defined by one or more fields + for each transformation. The all-caps name ``AXISNAME`` designates the + particular axis generating a transformation (e.g. a rotation axis or a translation + axis or a general axis). The attribute ``units="NX_TRANSFORMATION"`` designates the + units will be appropriate to the ``transformation_type`` attribute: + + * ``NX_LENGTH`` for ``translation`` + * ``NX_ANGLE`` for ``rotation`` + * ``NX_UNITLESS`` for axes for which no transformation type is specified + + This class will usually contain all axes of a sample stage or goniometer or + a detector. The NeXus default McSTAS coordinate frame is assumed, but additional + useful coordinate axes may be defined by using axes for which no transformation + type has been specified. + + The entry point (``depends_on``) will be outside of this class and point to a + field in here. Following the chain may also require following ``depends_on`` + links to transformations outside, for example to a common base table. If + a relative path is given, it is relative to the group enclosing the ``depends_on`` + specification. + + For a chain of three transformations, where :math:`T_1` depends on :math:`T_2` + and that in turn depends on :math:`T_3`, the final transformation :math:`T_f` is + + .. math:: T_f = T_3 T_2 T_1 + + In explicit terms, the transformations are a subset of affine transformations + expressed as 4x4 matrices that act on homogeneous coordinates, :math:`w=(x,y,z,1)^T`. + + For rotation and translation, + + .. math:: T_r &= \begin{pmatrix} R & o \\ 0_3 & 1 \end{pmatrix} \\ T_t &= \begin{pmatrix} I_3 & t + o \\ 0_3 & 1 \end{pmatrix} + + where :math:`R` is the usual 3x3 rotation matrix, :math:`o` is an offset vector, + :math:`0_3` is a row of 3 zeros, :math:`I_3` is the 3x3 identity matrix and + :math:`t` is the translation vector. + + :math:`o` is given the ``offset`` attribute, :math:`t` is given by the ``vector`` + attribute multiplied by the field value, and :math:`R` is defined as a rotation + about an axis in the direction of ``vector``, of angle of the field value. + </doc> + <field name="AXISNAME" nameType="any" units="NX_TRANSFORMATION" type="NX_NUMBER" maxOccurs="unbounded"> + <doc> + Units need to be appropriate for translation or rotation + + The name of this field is not forced. The user is free to use any name + that does not cause confusion. When using more than one ``AXISNAME`` field, + make sure that each field name is unique in the same group, as required + by HDF5. + + The values given should be the start points of exposures for the corresponding + frames. The end points should be given in ``AXISNAME_end``. + </doc> + <attribute name="transformation_type" optional="true"> + <doc> + The transformation_type may be ``translation``, in which case the + values are linear displacements along the axis, ``rotation``, + in which case the values are angular rotations around the axis. + + If this attribute is omitted, this is an axis for which there + is no motion to be specifies, such as the direction of gravity, + or the direction to the source, or a basis vector of a + coordinate frame. + </doc> + <enumeration> + <item value="translation" /> + <item value="rotation" /> + <!-- <item value="general" /> --> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation. + The axis should be normalized to unit length, making it + dimensionless. For ``rotation`` axes, the direction should be + chosen for a right-handed rotation with increasing angle. + For ``translation`` axes the direction should be chosen for + increasing displacement. + </doc> + <dimensions rank="1"> + <dim index="1" value="3" /> + </dimensions> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + <dimensions rank="1"> + <dim index="1" value="3" /> + </dimensions> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. Values should be consistent with NX_LENGTH. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path to a field defining the axis on which this + depends or the string ".". + </doc> + </attribute> + </field> + <field name="AXISNAME_end" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0"> + <doc> + ``AXISNAME_end`` is a placeholder for a name constructed from the actual + name of an axis to which ``_end`` has been appended. + + The values in this field are the end points of the motions that start + at the corresponding positions given in the ``AXISNAME`` field. + </doc> + </field> + <field name="AXISNAME_increment_set" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0"> + <doc> + ``AXISNAME_increment_set`` is a placeholder for a name constructed from the actual + name of an axis to which ``_increment_set`` has been appended. + + The value of this optional field is the intended average range through which + the corresponding axis moves during the exposure of a frame. Ideally, the + value of this field added to each value of ``AXISNAME`` would agree with the + corresponding values of ``AXISNAME_end``, but there is a possibility of significant + differences. Use of ``AXISNAME_end`` is recommended. + </doc> + </field> +</definition> diff --git a/src/punx/cache/v2018.5/base_classes/NXtranslation.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXtranslation.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..019db17296937acaaa9fa155bccd7146860a1822 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXtranslation.nxdl.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXtranslation" + type="group" extends="NXobject"> + <doc> + legacy class - (used by :ref:`NXgeometry`) - general spatial location of a component. + </doc> + <group name="geometry" type="NXgeometry"> + <doc>Link to other object if we are relative, else absent</doc> + </group> + <field name="distances" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + (x,y,z) + This field describes the lateral movement of a component. + The pair of groups NXtranslation and NXorientation together + describe the position of a component. + For absolute position, the origin is the scattering center (where a perfectly + aligned sample would be) with the z-axis pointing downstream and the y-axis + pointing gravitationally up. For a relative position the NXtranslation is + taken into account before the NXorientation. The axes are right-handed and + orthonormal. + </doc> + <dimensions> + <dim index="1" value="numobj"/> + <dim index="2" value="3"/> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXuser.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXuser.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..e57af25d6703db5435f65fb82362786b650e1165 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXuser.nxdl.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXuser" + type="group" extends="NXobject"> + <doc> + Contact information for a user. + + The format allows more + than one user with the same affiliation and contact information, + but a second :ref:`NXuser` group should be used if they have different + affiliations, etc. + </doc> + <field name="name"> + <doc>Name of user responsible for this entry</doc> + </field> + <field name="role"> + <doc> + Role of user responsible for this entry. + Suggested roles are "local_contact", + "principal_investigator", and "proposer" + </doc> + </field> + <field name="affiliation"> + <doc>Affiliation of user</doc> + </field> + <field name="address"> + <doc>Address of user</doc> + </field> + <field name="telephone_number"> + <doc>Telephone number of user</doc> + </field> + <field name="fax_number"> + <doc>Fax number of user</doc> + </field> + <field name="email"> + <doc>Email of user</doc> + </field> + <field name="facility_user_id"> + <doc> + facility based unique identifier for this person + e.g. their identification code on the facility + address/contact database + </doc> + </field> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXvelocity_selector.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXvelocity_selector.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..77d6e1e5ab1005cc21a58c9d608eb50ad90d0658 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXvelocity_selector.nxdl.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXvelocity_selector" + type="group" extends="NXobject"> + <doc>A neutron velocity selector</doc> + <field name="type"> + <doc>velocity selector type</doc> + </field> + <field name="rotation_speed" type="NX_FLOAT" units="NX_FREQUENCY"> + <doc>velocity selector rotation speed</doc> + </field> + <field name="radius" type="NX_FLOAT" units="NX_LENGTH"> + <doc>radius at beam centre</doc> + </field> + <field name="spwidth" type="NX_FLOAT" units="NX_LENGTH"> + <doc>spoke width at beam centre</doc> + </field> + <field name="length" type="NX_FLOAT" units="NX_LENGTH"> + <doc>rotor length</doc> + </field> + <field name="num" type="NX_INT" units="NX_UNITLESS"> + <doc>number of spokes/lamella</doc> + </field> + <field name="twist" type="NX_FLOAT" units="NX_ANGLE"> + <doc>twist angle along axis</doc> + </field> + <field name="table" type="NX_FLOAT" units="NX_ANGLE"> + <doc>offset vertical angle</doc> + </field> + <field name="height" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam height</doc> + </field> + <field name="width" type="NX_FLOAT" units="NX_LENGTH"> + <doc>input beam width</doc> + </field> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>wavelength</doc> + </field> + <field name="wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc>deviation FWHM /Wavelength</doc> + </field> + <group type="NXgeometry" name="geometry"/> +</definition> + diff --git a/src/punx/cache/v2018.5/base_classes/NXxraylens.nxdl.xml b/src/punx/cache/v2018.5/base_classes/NXxraylens.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..2ffeb1d7982687957589af2b71f775bf46aced54 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/NXxraylens.nxdl.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" category="base" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXxraylens" + type="group" extends="NXobject"> + + <doc> + An X-ray lens, typically at a synchrotron X-ray beam line. + + Based on information provided by Gerd Wellenreuther (DESY). + </doc> + <field name="lens_geometry" type="NX_CHAR"> + <doc>Geometry of the lens</doc> + <enumeration> + <item value="paraboloid"/> + <item value="spherical"/> + <item value="elliptical"/> + <item value="hyperbolical"/> + </enumeration> + </field> + <field name="symmetric" type="NX_BOOLEAN"> + <doc> + Is the device symmetric? + </doc> + </field> + <field name="cylindrical" type="NX_BOOLEAN"> + <doc> + Is the device cylindrical? + </doc> + </field> + <group name="cylinder_orientation" type="NXnote"> + <doc> + Orientation of the cylinder axis. + </doc> + </group> + <field name="focus_type" type="NX_CHAR"> + <doc> + The type of focus of the lens + </doc> + <enumeration> + <item value="line"/> + <item value="point"/> + </enumeration> + </field> + <field name="lens_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Thickness of the lens</doc> + </field> + <field name="lens_length" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Length of the lens</doc> + </field> + <field name="curvature" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Radius of the curvature as measured in the middle of the lens</doc> + </field> + <field name="aperture" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Diameter of the lens.</doc> + </field> + <field name="number_of_lenses" type="NX_INT"> + <doc>Number of lenses that make up the compound lens.</doc> + </field> + <field name="lens_material" type="NX_CHAR"> + <doc>Material used to make the lens.</doc> + </field> + <field name="gas" type="NX_CHAR"> + <doc>Gas used to fill the lens</doc> + </field> + <field name="gas_pressure" type="NX_FLOAT" units="NX_PRESSURE"> + <doc>Gas pressure in the lens</doc> + </field> + </definition> diff --git a/src/punx/cache/v2018.5/base_classes/nxdlformat.xsl b/src/punx/cache/v2018.5/base_classes/nxdlformat.xsl new file mode 100644 index 0000000000000000000000000000000000000000..d9a097568134e4e11a9b5e861caf79008a793656 --- /dev/null +++ b/src/punx/cache/v2018.5/base_classes/nxdlformat.xsl @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Stylesheet to provide a condensed view of a NeXus NXDL specification. + (see https://github.com/nexusformat/definitions/issues/181) + + The nxdlformat.xsl stylesheets differ between the directories + because of the rule regarding either /definition/NXentry or + /definition/NXsubentry for application and contributed definitions. + (see https://github.com/nexusformat/definitions/issues/179) + + Modify <xsl:template match="nx:definition">...</xsl:template> + for each directory. + +line breaks are VERY TRICKY here, be careful how you edit! +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" version="1.0"> + + <xsl:output method="text"/> + <xsl:variable name="indent_step" select="' '"/> + + + <xsl:template match="/"> + <xsl:apply-templates select="nx:definition"/> + </xsl:template> + + + <!-- + Modify ONLY this section for each directory: + base_classes/nxdlformat.xsl no rule for NXentry or NXsubentry + applications/nxdlformat.xsl required rule for NXentry or NXsubentry + contributed_definitions/nxdlformat.xsl optional rule for NXentry or NXsubentry + --> + <xsl:template match="nx:definition"> + <xsl:call-template name="showClassName"/> + <xsl:call-template name="startFieldsGroups"/> + </xsl:template> + + + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + <!-- +++ From this point on, the code is the same for, +++ --> + <!-- +++ base_classes applications/, and contributed/ +++ --> + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + + <xsl:template match="nx:field"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/>:<xsl:choose> + <xsl:when test="count(@type)"><xsl:value-of select="@type" + /><xsl:apply-templates select="nx:dimensions" + ><xsl:sort select="@name"/></xsl:apply-templates></xsl:when> + <xsl:otherwise>NX_CHAR</xsl:otherwise> + </xsl:choose> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template match="nx:dimensions"><!-- + -->[<xsl:apply-templates select="nx:dim"/>]<!-- + --></xsl:template> + + + <xsl:template match="nx:dim"> + <xsl:choose> + <xsl:when test="position()=1"><xsl:value-of select="@value"/></xsl:when> + <xsl:otherwise>,<xsl:value-of select="@value"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="nx:link"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/><xsl:text + > --> </xsl:text><xsl:value-of select="@target"/><xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:attribute"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/>@<xsl:value-of select="@name"/> + <xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:group"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:if test="count(@name)"><xsl:value-of select="@name"/>:</xsl:if> + <xsl:value-of select="@type"/> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template name="startFieldsGroups"> + <xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:choose> + <!-- Two ways to render. + 1=1: write fields, links, then groups, each sorted alphabetically + 1!=1: order of appearance in NXDL + --> + <xsl:when test="1=1"><!-- write fields, links, then groups --> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise><!-- write in order of appearance in NXDL --> + <xsl:apply-templates select="nx:field|nx:link|nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="showClassName"> + <xsl:value-of select="@name"/> (<xsl:choose> + <xsl:when test="@category='base'">base class</xsl:when> + <xsl:when test="@category='application'">application definition</xsl:when> + <xsl:when test="@category='contributed'">contributed definition</xsl:when> + </xsl:choose>)<xsl:text><!-- tricky line break here --> +</xsl:text></xsl:template> + +</xsl:stylesheet> + +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXcontainer.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXcontainer.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1a1f0ab3dc470ee01a6b17ecde03f90793df12c7 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXcontainer.nxdl.xml @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + name="NXcontainer" + category="contributed" + type="group" + extends="NXobject" + > + + <doc> + State of a container holding the sample under investigation. + + A container is any object in the beam path which absorbs the beam and + whose contribution to the overall attenuation/scattering needs to be + determined to process the experimental data. Examples of containers + include glass capillary tubes, vanadium cans, windows in furnaces or + diamonds in a Diamond Anvil Cell. The following figures show a complex + example of a container: + + .. figure:: container/ComplexExampleContainer.png + + A hypothetical capillary furnace. The beam passes from left to right + (blue dashes), passing through window 1, then window 2, before + passing through the downstream wall of the capillary. It is then + scattered by the sample with scattered beams passing through the + upstream wall of the capillary, then windows 4 and 5. As part of the + corrections for a PDF experiment it is necessary to subtract the PDF + of the empty container (i.e. each of the windows and the capillary). + To calculate the PDF of the empty container it is necessary to have + the measured scattering data and to know the nature (e.g. density, + elemental composition, etc.) of the portion of the container which + the beam passed through. + + .. figure:: container/ComplexContainerBeampath.png + + A complete description of the shapes of the container elements with + their orientation relative to the beam and also information on + whether they are upstream or downstream of the sample is also + therefore important. For example, although the windows 2 and 4 have + the same shape, the path taken through them by the beam is very + different and this needs to be modelled. Furthermore, it is not + inconceivable that windows might move during an experiment and thus + the changes to the beampath would need to be accounted for. + + This class encodes the position of the container with respect to the + sample and allows the calculation of the beampath through the container. + It also includes sufficient data to model beam absorption of the + container and a link to a dataset containing a measurement of the + container with nothing inside, to allow data corrections (at a specific + beam energy/measurement time) to be made. + </doc> + <field name="name"> + <doc> + Descriptive name of container. + </doc> + </field> + <field name="description"> + <doc> + Verbose description of container and how it fits into the wider + experimental set up. + </doc> + </field> + <field name="chemical_formula"> + <doc> + Chemical composition of the material the container is made from. + Specified using CIF conventions. Abbreviated version of CIF + standard: + + * Only recognized element symbols may be used. + * Each element symbol is followed by a 'count' number. A count of + '1' may be omitted. + * A space or parenthesis must separate each cluster of (element + symbol + count). + * Where a group of elements is enclosed in parentheses, the + multiplier for the group must follow the closing parentheses. + That is, all element and group multipliers are assumed to be + printed as subscripted numbers. + * Unless the elements are ordered in a manner that corresponds to + their chemical structure, the order of the elements within any + group or moiety depends on whether or not carbon is present. + * If carbon is present, the order should be: + + - C, then H, then the other elements in alphabetical order of + their symbol. + - If carbon is not present, the elements are listed purely in + alphabetic order of their symbol. + + * This is the *Hill* system used by Chemical Abstracts. + </doc> + </field> + <field name="density" type="NX_FLOAT" units="NX_MASS_DENSITY"> + <doc> + Density of the material the container is made from. + </doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="packing_fraction" type="NX_FLOAT" units="NX_UNITLESS"> + <doc> + Fraction of the volume of the container occupied by the material + forming the container. + </doc> + <dimensions> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <field name="relative_molecular_mass" type="NX_FLOAT" units="NX_MASS"> + <doc>Relative molecular mass of container.</doc> + <dimensions rank="1"> + <dim index="1" value="n_comp"/> + </dimensions> + </field> + <group name="beam" type="NXbeam"> + <doc> + Details of beam incident on container, including the position + relative to the sample (to determine whether the container is + upstream or downstream of the sample). + </doc> + </group> + <group name="shape" type="NXshape"> + <doc> + Shape of the container. In combination with orientation this + should allow the beampath through the container to be modelled to + allow the adsorption to be calculated. + </doc> + </group> + <group name="orientation" type="NXtransformations"> + <doc> + The angle the container makes to the beam and how it may change + during the experiment.In combination with shape this should allow + the beampath through the container to be modelled to allow the + adsorption of the container to be calculated. + </doc> + </group> + <link name="reference_measurement" target="/NXentry"> + <doc> + A link to a full data collection which contains the actual + measured data for this container within the experimental set up + (with no sample or inner container(s)). This data set will also + include the wavelength/energy, measurement time and intensity for + which these data are valid. + </doc> + </link> +</definition> + diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXelectrostatic_kicker.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXelectrostatic_kicker.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..bab685a45b4f5eed935dd039f6af2dfb5397113b --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXelectrostatic_kicker.nxdl.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXelectrostatic_kicker" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > +<doc>definition for a electrostatic kicker.</doc> +<field name="description" type="NX_CHAR"> +<doc>extended description of the kicker.</doc> +</field> +<field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> +<doc>define position of beamline element relative to production target</doc> +</field> +<field name="timing" type="NX_FLOAT" units="NX_TIME" + minOccurs="0" maxOccurs="1"> +<doc>kicker timing as defined by ``description`` attribute</doc> +<attribute name="description" type="NX_CHAR" /> +</field> +<field name="set_current" type="NX_FLOAT" units="NX_CURRENT" + minOccurs="0" maxOccurs="1"> +<doc>current set on supply.</doc> +</field> +<group name="read_current" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT"></field> +</group> +<field name="set_voltage" type="NX_FLOAT" units="NX_VOLTAGE" + minOccurs="0" maxOccurs="1"> +<doc>volage set on supply.</doc> +</field> +<group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE"></field> +</group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXmagnetic_kicker.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXmagnetic_kicker.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..730c8157e52bca1d12ac88f9f8d55dcff60d88a6 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXmagnetic_kicker.nxdl.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXmagnetic_kicker" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>definition for a magnetic kicker.</doc> + <field name="description" type="NX_CHAR"> + <doc>extended description of the kicker.</doc> + </field> + <field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> + <doc>define position of beamline element relative to production target</doc> + </field> + <field name="timing" type="NX_FLOAT" units="NX_TIME" minOccurs="0" maxOccurs="1"> + <doc>kicker timing as defined by ``description`` attribute</doc> + <attribute name="description" type="NX_CHAR"/> + </field> + <field name="set_current" type="NX_FLOAT" units="NX_CURRENT" minOccurs="0" maxOccurs="1"> + <doc>current set on supply.</doc> + </field> + <group name="read_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT" /> + </group> + <field name="set_voltage" type="NX_FLOAT" units="NX_VOLTAGE" + minOccurs="0" maxOccurs="1" > + <doc>voltage set on supply.</doc> + </field> + <group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> + <doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE" /> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXquadrupole_magnet.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXquadrupole_magnet.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..207767c490c268af8e28ed5a140032aea45ee1af --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXquadrupole_magnet.nxdl.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXquadrupole_magnet" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>definition for a quadrupole magnet.</doc> +<field name="description" type="NX_CHAR"> +<doc>extended description of the magnet.</doc> +</field> +<field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> +<doc>define position of beamline element relative to production target</doc> +</field> +<field name="set_current" type="NX_FLOAT" units="NX_CURRENT" + minOccurs="0" maxOccurs="1"> +<doc>current set on supply.</doc> +</field> +<group name="read_current" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT" /> +</group> +<group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE" /> +</group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXseparator.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXseparator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6e016a1e6d265a160e5b7245d8f9e0b94e995ba --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXseparator.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXseparator" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>definition for an electrostatic separator.</doc> + <field name="description" type="NX_CHAR"> + <doc>extended description of the separator.</doc> + </field> + <field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>define position of beamline element relative to production target</doc> + </field> + <field name="set_Bfield_current" type="NX_FLOAT" units="NX_CURRENT" minOccurs="0" maxOccurs="1"> + <doc>current set on magnet supply.</doc> + </field> + <group name="read_Bfield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from magnet supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Bfield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from magnet supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> + <field name="set_Efield_voltage" type="NX_FLOAT" units="NX_VOLTAGE" minOccurs="0" maxOccurs="1"> + <doc>current set on HT supply.</doc> + </field> + <group name="read_Efield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from HT supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Efield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from HT supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXsnsevent.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXsnsevent.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..7e9c9279813597165ad9929713bac47d24cf0d77 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXsnsevent.nxdl.xml @@ -0,0 +1,324 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NXsnsevent: candidate NeXus definition for event data from Spallation Neutron Source (SNS) at ORNL. +--> +<definition type="group" name="NXsnsevent" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is a definition for event data from Spallation Neutron Source (SNS) at ORNL.</doc> + <group type="NXentry" minOccurs="1"> + <group type="NXcollection" name="DASlogs"> + <doc> + Details of all logs, both from cvinfo file and from HistoTool (frequency and proton_charge). + </doc> + <group type="NXlog" minOccurs="1"> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"/> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"/> + </dimensions> + </field> + </group> + <group type="NXpositioner" minOccurs="0"> + <doc> + Motor logs from cvinfo file. + </doc> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + </group> + </group> + <group type="NXnote" name="SNSHistoTool"> + <field name="SNSbanking_file_name"/> + <field name="SNSmapping_file_name"/> + <field name="author"/> + <field name="command1"> + <doc> + Command string for event2nxl. + </doc> + </field> + <field name="date"/> + <field name="description"/> + <field name="version"/> + </group> + <group type="NXdata" minOccurs="1"> + <!-- for all NXdata/banks --> + <link name="data_x_y" target="/NXentry/NXinstrument/NXdetector/data_x_y"></link> + <link name="x_pixel_offset" target="/NXentry/NXinstrument/NXdetector/x_pixel_offset"></link> + <link name="y_pixel_offset" target="/NXentry/NXinstrument/NXdetector/y_pixel_offset"></link> + </group> + <group type="NXevent_data" minOccurs="1"> + <!-- for all NXdata/banks --> + <link name="event_index" target="/NXentry/NXinstrument/NXdetector/event_index"></link> + <link name="event_pixel_id" target="/NXentry/NXinstrument/NXdetector/event_pixel_id"></link> + <link name="event_time_of_flight" target="/NXentry/NXinstrument/NXdetector/event_time_of_flight"></link> + <link name="pulse_time" target="/NXentry/NXinstrument/NXdetector/pulse_time"></link> + </group> + <field name="collection_identifier"/> + <field name="collection_title"/> + <field name="definition"> + <doc> + Official NXDL schema after this file goes to applications. + </doc> + <enumeration> + <item value="NXsnsevent"></item> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT" units="NX_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="entry_identifier"/> + <field name="experiment_identifier"/> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="SNS"> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"/> + <field name="name"/> + <field name="probe"/> + <field name="type"/> + </group> + <field name="SNSdetector_calibration_id"> + <doc> + Detector calibration id from DAS. + </doc> + </field> + <field name="SNSgeometry_file_name"/> + <!-- SNSnxtranslate --> + <field name="SNStranslation_service"/> + <group type="NXdetector" minOccurs="1"> + <!-- for all NXdetector/banks --> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="data_x_y" type="NX_UINT"> + <doc>expect ``signal=2 axes="x_pixel_offset,y_pixel_offset``"</doc> + <!-- axes are set in data files --> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="event_index" type="NX_UINT"> + <dimensions rank="1"> + <dim index="1" value="numpulses"/> + </dimensions> + </field> + <field name="event_pixel_id" type="NX_UINT"> + <dimensions rank="1"> + <dim index="1" value="numevents"/> + </dimensions> + </field> + <field name="event_time_of_flight" type="NX_FLOAT" units="NX_TIME_OF_FLIGHT"> + <dimensions rank="1"> + <dim index="1" value="numevents"/> + </dimensions> + </field> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="pixel_id" type="NX_UINT"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="pulse_time" type="NX_FLOAT" units="NX_TIME"> + <dimensions rank="1"> + <dim index="1" value="numpulses"/> + </dimensions> + </field> + <field name="total_counts" type="NX_UINT"/> + <field name="x_pixel_offset" type="NX_FLOAT" axis="1" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numx"/> + </dimensions> + </field> + <field name="y_pixel_offset" type="NX_FLOAT" axis="2" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numy"/> + </dimensions> + </field> + </group> + <field name="beamline"/> + <group type="NXdisk_chopper" minOccurs="0"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + </group> + <group type="NXmoderator" name="moderator"> + <field name="coupling_material"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"/> + <field name="type"/> + </group> + <field name="name"/> + <group type="NXaperture" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="x_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXattenuator" minOccurs="0"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <!-- motor links from DASlogs when exist --> + </group> + <group type="NXpolarizer" minOccurs="0"/> + <!-- motor links from DASlogs when exist --> + <group type="NXcrystal" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <field name="description"/> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="type"/> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + </group> + <group type="NXmonitor" minOccurs="0"> + <field name="data" type="NX_UINT"> + <doc>expect ``signal=1 axes="time_of_flight"``</doc> + <dimensions rank="1"> + <dim index="1" value="numtimechannels"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mode"/> + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME"> + <dimensions rank="1"> + <dim index="1" value="numtimechannels + 1"/> + </dimensions> + </field> + </group> + <field name="notes"/> + <field name="proton_charge" type="NX_FLOAT" units="NX_CHARGE"/> + <field name="raw_frames" type="NX_INT"/> + <field name="run_number"/> + <group type="NXsample" name="sample"> + <field name="changer_position"/> + <field name="holder"/> + <field name="identifier"/> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature"/> + </group> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="title"/> + <field name="total_counts" type="NX_UINT" units="NX_UNITLESS"/> + <field name="total_uncounted_counts" type="NX_UINT" units="NX_UNITLESS"/> + <group type="NXuser" minOccurs="1"> + <field name="facility_user_id"/> + <field name="name"/> + <field name="role"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXsnshisto.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXsnshisto.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..5dfcb0efa8478f87fc15bd8e0fa8fe1049f29631 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXsnshisto.nxdl.xml @@ -0,0 +1,337 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NXsnshisto: candidate NeXus definition for histogram data from Spallation Neutron Source (SNS) at ORNL. +--> +<definition type="group" name="NXsnshisto" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>This is a definition for histogram data from Spallation Neutron Source (SNS) at ORNL.</doc> + <group type="NXentry" minOccurs="1"> + <group type="NXcollection" name="DASlogs"> + <doc> + Details of all logs, both from cvinfo file and from HistoTool (frequency and proton_charge). + </doc> + <group type="NXlog" minOccurs="1"> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"></dim> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"/> + </dimensions> + </field> + </group> + <group type="NXpositioner" minOccurs="0"> + <doc> + Motor logs from cvinfo file. + </doc> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + </group> + </group> + <group type="NXnote" name="SNSHistoTool"> + <field name="SNSbanking_file_name"/> + <field name="SNSmapping_file_name"/> + <field name="author"/> + <field name="command1"> + <doc> + Command string for event2histo_nxl. + </doc> + </field> + <field name="date"/> + <field name="description"/> + <field name="version"/> + </group> + <group type="NXdata" minOccurs="1"> + <!-- for all NXdata/banks --> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + <link name="data_x_time_of_flight" target="/NXentry/NXinstrument/NXdetector/data_x_time_of_flight"/> + <link name="data_x_y" target="/NXentry/NXinstrument/NXdetector/data_x_y"/> + <link name="data_y_time_of_flight" target="/NXentry/NXinstrument/NXdetector/data_y_time_of_flight"/> + <link name="pixel_id" target="/NXentry/NXinstrument/NXdetector/pixel_id"/> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"/> + <link name="total_counts" target="/NXentry/NXinstrument/NXdetector/total_counts"/> + <link name="x_pixel_offset" target="/NXentry/NXinstrument/NXdetector/x_pixel_offset"/> + <link name="y_pixel_offset" target="/NXentry/NXinstrument/NXdetector/y_pixel_offset"/> + </group> + <field name="collection_identifier"/> + <field name="collection_title"/> + <field name="definition"> + <doc> + Official NXDL schema after this file goes to applications. + </doc> + <enumeration> + <item value="NXsnshisto"/> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT" units="NX_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="entry_identifier"/> + <field name="experiment_identifier"/> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="SNS"> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"/> + <field name="name"/> + <field name="probe"/> + <field name="type"/> + </group> + <field name="SNSdetector_calibration_id"> + <doc> + Detector calibration id from DAS. + </doc> + </field> + <field name="SNSgeometry_file_name"/> + <!-- SNSnxtranslate --> + <field name="SNStranslation_service"/> + <group type="NXdetector" minOccurs="1"> + <!-- for all NXdetector/banks --> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="data" type="NX_UINT" signal="1" axes="x_pixel_offset,y_pixel_offset,time_of_flight"> + <dimensions rank="3"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + <dim index="3" value="numtof"/> + </dimensions> + </field> + <field name="data_x_time_of_flight" type="NX_UINT" signal="3" axes="x_pixel_offset,time_of_flight"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numtof"/> + </dimensions> + </field> + <field name="data_x_y" type="NX_UINT" signal="2" axes="x_pixel_offset,y_pixel_offset"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="data_y_time_of_flight" type="NX_UINT" signal="4" axes="y_pixel_offset,time_of_flight"> + <dimensions rank="2"> + <dim index="1" value="numy"/> + <dim index="2" value="numtof"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="pixel_id" type="NX_UINT"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="time_of_flight" type="NX_FLOAT" axis="3" primary="1" units="NX_TIME_OF_FLIGHT"> + <dimensions rank="1"> + <dim index="1" value="numtof + 1"/> + </dimensions> + </field> + <field name="total_counts" type="NX_UINT"/> + <field name="x_pixel_offset" type="NX_FLOAT" axis="1" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numx"/> + </dimensions> + </field> + <field name="y_pixel_offset" type="NX_FLOAT" axis="2" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numy"/> + </dimensions> + </field> + </group> + <field name="beamline"/> + <group type="NXdisk_chopper" minOccurs="0"> + <doc> + Original specification called for NXchopper, + which is not a valid NeXus base class. + Select either NXdisk_chopper or NXfermi_chopper, as appropriate. + </doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + </group> + <group type="NXfermi_chopper" minOccurs="0"> + <doc> + Original specification called for NXchopper, + which is not a valid NeXus base class. + Select either NXdisk_chopper or NXfermi_chopper, as appropriate. + </doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + </group> + <group type="NXmoderator" name="moderator"> + <field name="coupling_material"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"/> + <field name="type"/> + </group> + <field name="name"/> + <group type="NXaperture" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="x_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXattenuator" minOccurs="0"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <!-- motor links from DASlogs when exist --> + </group> + <group type="NXpolarizer" minOccurs="0"/> + <!-- motor links from DASlogs when exist --> + <group type="NXcrystal" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <field name="description"/> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="type"/> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + </group> + <group type="NXmonitor" minOccurs="0"> + <field name="data" type="NX_UINT" signal="1" axes="time_of_flight"> + <dimensions rank="1"> + <dim index="1" value="numtimechannels"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mode"/> + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME"> + <dimensions rank="1"> + <dim index="1" value="numtimechannels + 1"/> + </dimensions> + </field> + </group> + <field name="notes"/> + <field name="proton_charge" type="NX_FLOAT" units="NX_CHARGE"/> + <field name="raw_frames" type="NX_INT"/> + <field name="run_number"/> + <group type="NXsample" name="sample"> + <field name="changer_position"/> + <field name="holder"/> + <field name="identifier"/> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature"/> + </group> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="title"/> + <field name="total_counts" type="NX_UINT" units="NX_UNITLESS"/> + <field name="total_uncounted_counts" type="NX_UINT" units="NX_UNITLESS"/> + <group type="NXuser" minOccurs="1"> + <field name="facility_user_id"/> + <field name="name"/> + <field name="role"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXsolenoid_magnet.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXsolenoid_magnet.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..1a0d5aae1979c9708d5e2fbfad25e67b7e080326 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXsolenoid_magnet.nxdl.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXsolenoid_magnet" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > +<doc>definition for a solenoid magnet.</doc> +<field name="description" type="NX_CHAR"> +<doc>extended description of the magnet.</doc> +</field> +<field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0" maxOccurs="1"> +<doc>define position of beamline element relative to production target</doc> +</field> +<field name="set_current" type="NX_FLOAT" units="NX_CURRENT" + minOccurs="0" maxOccurs="1"> +<doc>current set on supply.</doc> +</field> +<group name="read_current" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>current read from supply.</doc> + <field name="value" units="NX_CURRENT" /> +</group> +<group name="read_voltage" type="NXlog" + minOccurs="0" maxOccurs="1"> +<doc>voltage read from supply.</doc> + <field name="value" units="NX_VOLTAGE" /> +</group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXspecdata.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXspecdata.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..6864298facc1c59c311207983620e6926352a040 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXspecdata.nxdl.xml @@ -0,0 +1,460 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2012-2018 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> + +<definition name="NXspecdata" extends="NXobject" type="group" + category="contributed" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + Data collected by SPEC control and data acquisition software + + SPEC [#]_ is software for instrument control + and data acquisition in X-ray diffraction experiments. + + .. [#] SPEC: https://certif.com + </doc> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXentry` group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXentry` group exists. + The value is the name of the default :ref:`NXentry` group. + </doc> + </attribute> + <attribute name="HDF5_Version" optional="false"> + <doc> + Version of HDF5 library used in writing the file (as specified in :ref:`NXroot`). + + Note this attribute is spelled with uppercase "V", + different than other version attributes. + </doc> + </attribute> + <attribute name="h5py_version" optional="true"> + <doc> + version of h5py Python package used to write this HDF5 file + </doc> + </attribute> + <attribute name="SPEC_file" optional="true"> + <doc> + original SPEC data file name from **#F** line in file header + </doc> + </attribute> + <attribute name="SPEC_date" optional="true"> + <doc> + date from **#D** line in file header, in ISO8601 format + </doc> + </attribute> + <attribute name="SPEC_epoch" type="NX_INT"> + <doc> + UNIX time epoch from **#E** line in file header + </doc> + </attribute> + <!-- + place SPEC_user into NXentry/NXuser group + <attribute name="SPEC_user"> + <doc> + user name from first **#C** line in file header + </doc> + </attribute> + --> + <attribute name="SPEC_comments" optional="true"> + <doc> + any **#C** lines in file header, stored as one string with newlines between comments + </doc> + </attribute> + <attribute name="SPEC_num_headers" type="NX_INT" optional="true"> + <doc> + Number of header sections found in the spec file + </doc> + </attribute> + + <group type="NXentry"> + <doc> + one scan from a SPEC data file, starts with a **#S** line + </doc> + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` group + contains the data to be shown by default. + It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + </doc> + </attribute> + + <field name="definition"> + <doc>Official NeXus NXDL schema to which this subentry conforms.</doc> + <enumeration> + <item value="NXspecdata" /> + </enumeration> + </field> + + <field name="scan_number" type="NX_NUMBER"> + <doc> + SPEC scan number + </doc> + </field> + + <field name="title"> + <doc> + SPEC scan number and command, from **#S** line + + SPEC data file line:: + + #S 1 cscan en 690 750 60 0 + + *title*:: + + 1 cscan en 690 750 60 0 + + </doc> + </field> + + <field name="command"> + <doc> + SPEC scan command, from **#S** line, after the scan number. + + :SPEC data file line: ``#S 1 cscan en 690 750 60 0`` + + :command*: ``cscan en 690 750 60 0`` + </doc> + </field> + + <field name="date" type="NX_DATE_TIME"> + <doc> + date from **#D** line in scan header, in ISO8601 format + </doc> + </field> + + <group type="NXmonitor"> + <attribute name="description" /> + + <field name="mode"> + <doc> + Count to a preset value based on either clock time + (timer) or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor" /> + <item value="timer" /> + </enumeration> + </field> + + <field name="preset" type="NX_NUMBER"> + <doc> + preset value for time or monitor + + * **#M** -- counting against this constant monitor count (see #T) + * **#T** -- counting against this constant number of seconds (see #M) + </doc> + <attribute name="units" /> + </field> + + <field name="data" type="NX_NUMBER" nameType="any"> + <doc> + array(s) of monitor data + </doc> + </field> + + <field name="count_time" type="NX_NUMBER" nameType="any"> + <doc> + array(s) of monitor data + </doc> + </field> + </group> + + <!-- moved to NXmonitor + <field name="counting_basis"> + <doc> + describes if counts are referenced to time or a detector + </doc> + </field> + + <field name="M" type="NX_NUMBER"> + <doc> + **#M** - - counting against this constant monitor count (see #T) + </doc> + </field> + + <field name="T" type="NX_NUMBER"> + <doc> + **#T** - - counting against this constant number of seconds (see #M) + </doc> + </field> + --> + + <field name="comments"> + <doc> + Any **#C** lines in this scan, stored as one string with newlines between comments + </doc> + </field> + + <field name="Q" type="NX_NUMBER"> + <doc> + **#Q** -- :math:`Q` (:math:`hkl`) at start of scan + + array of [:math:`h` :math:`k` :math:`l`] + </doc> + </field> + + <field name="TEMP_SP" type="NX_NUMBER"> + <doc> + **#X** -- temperature set point + </doc> + </field> + + <field name="DEGC_SP" type="NX_NUMBER"> + <doc> + **#X** -- temperature set point (C) + </doc> + </field> + + + <group name="data" type="NXdata"> + <doc> + detector (and MCA) data from this scan + </doc> + <attribute name="description" /> + <attribute name="signal"> + <doc> + name of the field with the plottable data, typically the last column for 1-D scans + + This is the primary dependent axis, such as two-theta detector. + This field must exist (or be linked) in this :ref:`NXdata` group. + </doc> + </attribute> + <attribute name="axes"> + <doc> + name(s) of the field(s) for plotting the data, typically the first column for 1-D scans + + These are the independent axes, such as positioners. For 2-D or higher + dimension data, there will be a field named for each dimension, + separated by ":" (preferred) or "," or " " (whitespace). + + Such as for 2-D data plotted against *energy* and *th*:: + + @axes = energy:th + + This(these) field(s) must exist (or be linked) in this :ref:`NXdata` group. + </doc> + </attribute> + <attribute name="AXISNAME_indices" type="NX_NUMBER"> + <doc> + For each field named in *@axes*, there will be an instance of this attribute, + defining into which dimensions of the *@signal* data this field applies. + The value of this attribute is a list of index numbers using 0-based indexing + (first dimension is 0, seconds i 1, ...). + + Such as for 2-D data plotted against *energy* and *th*:: + + @energy_indices = [0] + @th_indices = [1] + + </doc> + </attribute> + + <!-- scan data --> + <field name="data" nameType="any" type="NX_NUMBER"> + <doc> + one column of data from the scan + + HDF5 requires that each member of a group must have a unique name. + + Pick the name of column from **#L** but make it unique which means if the same + name is used in more than one column, append a number to the extra instances + to make them unique yet preserve their content, just in case they might be different. + + Example: ``seconds seconds`` becomes ``seconds`` and ``seconda_1``. + </doc> + <attribute name="spec_name"> + <doc> + name as specified in **#L** line, before it was made unique for HDF5 + </doc> + </attribute> + <attribute name="units"> + <doc> + Unless stated otherwise, units (not declared in the SPEC data file) + are assumed to be *counts* for detectors and "unknown" for + positioners or other scan columns. + </doc> + </attribute> + </field> + + <!-- scaling factor defined in SPEC --> + <field name="intensity_factor" type="NX_NUMBER"> + <doc> + **#I** -- intensity normalizing factor + </doc> + </field> + + <!-- MCA (multi-channel analyzer) spectra --> + <field name="_mca_" type="NX_NUMBER" /> + <field name="_mca_channel_" type="NX_NUMBER" /> + <field name="_mca1_" type="NX_NUMBER" /> + <field name="_mca1_channel_" type="NX_NUMBER" /> + </group> + + + <group name="counter_cross_reference" type="NXnote"> + <doc> + associates values declared in **#J** and **#j** scan header lines + </doc> + <attribute name="comment" /> + <attribute name="description" /> + </group> + + + <group name="positioner_cross_reference" type="NXnote"> + <doc> + associates values declared in **#O** and **#o** scan header lines + </doc> + <attribute name="comment" /> + <attribute name="description" /> + </group> + + + <group name="spec" type="NXinstrument"> + <doc> + various metadata from the SPEC scan header that have well-known NeXus base clases + </doc> + + <group name="UB" type="NXcrystal"> + <doc> + Orientation matrix of single crystal sample using Busing-Levy convention + </doc> + <field name="orientation_matrix" type="NX_FLOAT"> + <doc> + **#G3** line in scan header + </doc> + <dimensions rank="2"><!--3,3--> + <dim index="1" value="3"/> + <dim index="2" value="3"/> + </dimensions> + </field> + </group> + + </group> + + + <group name="G" type="NXnote"> + <doc> + SPEC geometry variables for this diffractometer geometry (instrument specific) + + TODO: give interpreted name for each array value (need to figure out how to get the names) + </doc> + <attribute name="comment" /> + <attribute name="description" /> + <field name="G0" type="NX_NUMBER"><doc>geometry parameters from G[] array (geo mode, sector, etc)</doc></field> + <field name="G1" type="NX_NUMBER"><doc>geometry parameters from U[] array (lattice constants, orientation reflections)</doc></field> + <field name="G2" type="NX_NUMBER"><doc>not used, although some files has a single zero value</doc></field> + <!-- G3 data placed into /NXentry/NXinstrument/NXcrystal/orientation_matrix --> + <field name="G4" type="NX_NUMBER"><doc>geometry parameters from Q[] array (lambda, frozen angles, cut points, etc)</doc></field> + </group> + + + <group name="positioners" type="NXnote"> <!-- TODO: consider as NXpositioner --> + <doc> + names and values of all positioners (**#O** and **#P** lines) in scan header + </doc> + <attribute name="description" /> + <field name="positioner" nameType="any" type="NX_NUMBER"> + <doc> + one positioner from the scan header + + HDF5 requires that each member of a group must have a unique name. + + SPEC assigns a unique name to each positioner, no extra work is neccesary + to comply with the HDF5 rule for unique names in a group. + </doc> + </field> + </group> + + + <group name="MCA" type="NXnote"> <!-- TODO: change to NXdetector --> + <doc> + **#@CALIB** -- coefficients to compute a scale based on the MCA channel number + </doc> + <attribute name="description" /> + <field name="preset_time" type="NX_NUMBER" /> + <field name="elapsed_live_time" type="NX_NUMBER" /> + <field name="elapsed_real_time" type="NX_NUMBER" /> + <field name="number_saved" type="NX_NUMBER" /> + <field name="first_saved" type="NX_INT" /> + <field name="last_saved" type="NX_INT" /> + <field name="reduction_coef" type="NX_NUMBER" /> + <field name="calib_a" type="NX_NUMBER" /> + <field name="calib_b" type="NX_NUMBER" /> + <field name="calib_c" type="NX_NUMBER" /> + <group name="ROI" type="NXnote"> + <field name="roiN"> + <doc> + numbered regions of interest, use an index number as part of the name + </doc> + <attribute name="description"><doc>``first_channel, last_channel``</doc></attribute> + <attribute name="first_channel" type="NX_INT" /> + <attribute name="last_channel" type="NX_INT" /> + </field> + </group> + </group> + + + <group name="metadata" type="NXnote"> + <doc> + SPEC metadata (UNICAT-style #H and #V lines) + + This is a block that may be unique to SPEC files acquired at certain + APS beam lines. Other facilities or instruments may use this block + for storing key:value pairs of data where the values have suitable + attributes (such as units). + </doc> + <attribute name="description" /> + </group> + + + <group name="SPEC_user" type="NXuser"> + <field name="SPEC_user"> + <doc> + user name from first **#C** line in file header + </doc> + </field> + </group> + + + <group name="_unrecognized" type="NXnote"> + <doc> + Fallback for any SPEC data file control lines not otherwise placed + into groups or fields elsewhere in this specification. + </doc> + <attribute name="comment" /> + <attribute name="description" /> + </group> + + </group> + +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/NXspin_rotator.nxdl.xml b/src/punx/cache/v2018.5/contributed_definitions/NXspin_rotator.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b07f0ae0eb06a5390e5aa7552ee80550dc4ce299 --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/NXspin_rotator.nxdl.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition type="group" name="NXspin_rotator" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc>definition for a spin rotator.</doc> + <field name="description" type="NX_CHAR"> + <doc>extended description of the spin rotator.</doc> + </field> + <field name="beamline_distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0" maxOccurs="1"> + <doc>define position of beamline element relative to production target</doc> + </field> + <field name="set_Bfield_current" type="NX_FLOAT" units="NX_CURRENT" minOccurs="0" maxOccurs="1"> + <doc>current set on magnet supply.</doc> + </field> + <group name="read_Bfield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from magnet supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Bfield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from magnet supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> + <field name="set_Efield_voltage" type="NX_FLOAT" units="NX_VOLTAGE" minOccurs="0" maxOccurs="1"> + <doc>current set on HT supply.</doc> + </field> + <group name="read_Efield_current" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>current read from HT supply.</doc> + <field name="value" units="NX_CURRENT"/> + </group> + <group name="read_Efield_voltage" type="NXlog" minOccurs="0" maxOccurs="1"> + <doc>voltage read from HT supply.</doc> + <field name="value" units="NX_VOLTAGE"/> + </group> +</definition> diff --git a/src/punx/cache/v2018.5/contributed_definitions/nxdlformat.xsl b/src/punx/cache/v2018.5/contributed_definitions/nxdlformat.xsl new file mode 100644 index 0000000000000000000000000000000000000000..cbee52bc355745e3e6ac145e26184e50b905d42b --- /dev/null +++ b/src/punx/cache/v2018.5/contributed_definitions/nxdlformat.xsl @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Stylesheet to provide a condensed view of a NeXus NXDL specification. +(see https://github.com/nexusformat/definitions/issues/181) + +The nxdlformat.xsl stylesheets differ between the directories +because of the rule regarding either /definition/NXentry or +/definition/NXsubentry for application and contributed definitions. +(see https://github.com/nexusformat/definitions/issues/179) + +Modify <xsl:template match="nx:definition">...</xsl:template> +for each directory. + +line breaks are VERY TRICKY here, be careful how you edit! +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" version="1.0"> + + <xsl:output method="text"/> + <xsl:variable name="indent_step" select="' '"/> + + + <xsl:template match="/"> + <xsl:apply-templates select="nx:definition"/> + </xsl:template> + + + <!-- + Modify ONLY this section for each directory: + base_classes/nxdlformat.xsl no rule for NXentry or NXsubentry + applications/nxdlformat.xsl required rule for NXentry or NXsubentry + contributed_definitions/nxdlformat.xsl optional rule for NXentry or NXsubentry + --> + <xsl:template match="nx:definition"> + <xsl:call-template name="showClassName"/> + <xsl:choose> + <xsl:when test="count(nx:group[@type='NXentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:when test="count(nx:group[@type='NXsubentry'])=1"><!-- + assume this is a candidate for an application definition + --> (overlays NXsubentry)<xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates><xsl:call-template name="startFieldsGroups"/></xsl:when> + <xsl:otherwise><!-- optional rule for NXentry or NXsubentry + --> (base class definition, NXentry or NXsubentry not found)<!-- + --><xsl:text><!-- tricky line break here --> +</xsl:text><xsl:call-template name="startFieldsGroups"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + <!-- +++ From this point on, the code is the same for, +++ --> + <!-- +++ base_classes applications/, and contributed/ +++ --> + <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + + <xsl:template match="nx:field"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/>:<xsl:choose> + <xsl:when test="count(@type)"><xsl:value-of select="@type" + /><xsl:apply-templates select="nx:dimensions" + ><xsl:sort select="@name"/></xsl:apply-templates></xsl:when> + <xsl:otherwise>NX_CHAR</xsl:otherwise> + </xsl:choose> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template match="nx:dimensions"><!-- + -->[<xsl:apply-templates select="nx:dim"/>]<!-- + --></xsl:template> + + + <xsl:template match="nx:dim"> + <xsl:choose> + <xsl:when test="position()=1"><xsl:value-of select="@value"/></xsl:when> + <xsl:otherwise>,<xsl:value-of select="@value"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="nx:link"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/><xsl:value-of select="@name"/><xsl:text + > --> </xsl:text><xsl:value-of select="@target"/><xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:attribute"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/>@<xsl:value-of select="@name"/> + <xsl:text><!-- tricky line break here --> +</xsl:text> + </xsl:template> + + + <xsl:template match="nx:group"> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:if test="count(@name)"><xsl:value-of select="@name"/>:</xsl:if> + <xsl:value-of select="@type"/> + <xsl:text><!-- tricky line break here --> +</xsl:text><!-- +--><xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template name="startFieldsGroups"> + <xsl:apply-templates select="nx:attribute"> + <xsl:with-param name="indent"> + <xsl:value-of select="$indent_step"/> + </xsl:with-param> + </xsl:apply-templates> + <xsl:choose> + <!-- Two ways to render. + 1=1: write fields, links, then groups, each sorted alphabetically + 1!=1: order of appearance in NXDL + --> + <xsl:when test="1=1"><!-- write fields, links, then groups --> + <xsl:apply-templates select="nx:field"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:link"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@name"/> + </xsl:apply-templates> + <xsl:apply-templates select="nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise><!-- write in order of appearance in NXDL --> + <xsl:apply-templates select="nx:field|nx:link|nx:group"> + <xsl:with-param name="indent"><xsl:value-of select="$indent_step"/></xsl:with-param> + <xsl:sort select="@type"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="showClassName"> + <xsl:value-of select="@name"/> (<xsl:choose> + <xsl:when test="@category='base'">base class</xsl:when> + <xsl:when test="@category='application'">application definition</xsl:when> + <xsl:when test="@category='contributed'">contributed definition</xsl:when> + </xsl:choose>)<xsl:text><!-- tricky line break here --> +</xsl:text></xsl:template> + +</xsl:stylesheet> + +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> diff --git a/src/punx/cache/v2018.5/nxdl.xsd b/src/punx/cache/v2018.5/nxdl.xsd new file mode 100644 index 0000000000000000000000000000000000000000..d45c410daa66219fb15d95744d5ad7ce66b25988 --- /dev/null +++ b/src/punx/cache/v2018.5/nxdl.xsd @@ -0,0 +1,1316 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://definition.nexusformat.org/nxdl/3.1" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" + elementFormDefault="qualified"> + + <xs:annotation> + <xs:documentation> + .. + NeXus - Neutron and X-ray Common Data Format + + Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + + This library is free software; you can redistribute it and/osr + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information, see http://www.nexusformat.org + </xs:documentation> + </xs:annotation> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:include schemaLocation="nxdlTypes.xsd"> + <xs:annotation> + <xs:documentation> + Definitions of the basic data types and unit types + allowed in NXDL instance files. + </xs:documentation> + </xs:annotation> + </xs:include> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <!-- define the document root element --> + <xs:element name="definition" type="nx:definitionType"> + <xs:annotation> + <xs:documentation> + A ``definition`` element + is the ``group`` at the + root of every NXDL specification. + It may *only* appear + at the root of an NXDL file and must only appear + **once** for the NXDL to be *well-formed*. + </xs:documentation> + </xs:annotation> + </xs:element> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:simpleType name="validItemName"> + <xs:annotation> + <xs:documentation> + Used for allowed names of elements and attributes. + Need to be restricted to valid program variable names. + Note: This means no "-" or "." characters can be allowed and + you cannot start with a number. + HDF4 had a 64 character limit on names + (possibly including NULL) and NeXus enforces this + via the ``NX_MAXNAMELEN`` variable with + a **64** character limit (which + may be 63 on a practical basis if one considers a NULL + terminating byte). + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:pattern value="[A-Za-z_][\w_]*" /> + <xs:maxLength value="63" /> <!-- enforce via NX_MAXNAMELEN --> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="validNXClassName"> + <xs:annotation> + <xs:documentation> + Used for allowed names of NX class types (e.g. NXdetector) + not the instance (e.g. bank1) which is covered by validItemName. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="nx:validItemName"> + <xs:pattern value="NX.+"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="validTargetName"> + <xs:annotation> + <xs:documentation> + This is a valid link target - currently it must be an absolute path + made up of valid names with the ``/`` character delimiter. But we may + want to consider allowing "``..``" (parent of directory) at some point. + If the ``name`` attribute is helpful, then use it in the path + with the syntax of *name:type* as in these examples:: + + /NXentry/NXinstrument/analyzer:NXcrystal/ef + /NXentry/NXinstrument/monochromator:NXcrystal/ei + /NX_other + + Must also consider use of ``name`` attribute in resolving ``link`` targets. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:annotation> + <xs:documentation> + From the HDF5 documentation + (http://www.hdfgroup.org/HDF5/doc/UG/UG_frame09Groups.html): + + *Note that relative path names in HDF5 do not employ the ``../`` notation, + the UNIX notation indicating a parent directory, to indicate a parent group.* + + Thus, if we only consider the case of + ``[name:]type``, the matching regular expression syntax + is written: ``/[a-zA-Z_][\w_]*(:[a-zA-Z_][\w_]*)?)+``. + Note that HDF5 also permits relative path names, such as: + ``GroupA/GroupB/Dataset1`` + but this is not permitted in the matching regular expression and not supported in NAPI. + </xs:documentation> + </xs:annotation> + <xs:pattern value="(/[a-zA-Z_][\w_]*(:[a-zA-Z_][\w_]*)?)+" /> + </xs:restriction> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:attributeGroup name="deprecatedAttributeGroup"> + <xs:attribute name="deprecated" use="optional"> + <xs:annotation> + <xs:documentation> + The presence of the ``deprecated`` attribute + indicates to the data file validation process that + an advisory message (specified as the content of the + ``deprecated`` attribute) will be reported. + Future versions of the NXDL file might + not define (or even re-use) the component marked with this attribute. + + The value of the attribute will be printed in the documentation. + Make it descriptive (limited to no line breaks). + For example:: + + deprecated="as of release MAJOR.MINOR" + + Note: because ``deprecated`` is an attribute, + the XML rules do not permit it to have any + element content. + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:pattern value=".*(\w+).*" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + + <xs:complexType name="definitionType"> + <xs:annotation> + <xs:documentation> + A ``definition`` is the root element of every NXDL definition. + It may *only* appear at the root of an NXDL file and must only + appear **once** for the NXDL to be *well-formed*. + + The ``definitionType`` defines the documentation, + attributes, fields, and groups that will be used + as children of the ``definition`` element. + Could contain these elements: + + * ``attribute`` + * ``doc`` + * ``field`` + * ``group`` + * ``link`` + + Note that a ``definition`` element also includes the definitions of the + ``basicComponent`` data type. + (The ``definitionType`` data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + + Note that the first line of text in a ``doc`` element in a ``definition`` + is used as a summary in the manual. Follow the pattern as shown + in the base class NXDL files. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="symbols" type="nx:symbolsType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Use a ``symbols`` list + to define each of the mnemonics that + represent the length of each dimension in a vector or array. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:group ref="nx:groupGroup" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + In addition to an optional ``symbols`` list, + a ``definition`` may contain any of the items + allowed in a ``group``. + </xs:documentation> + </xs:annotation> + </xs:group> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + The ``name`` of this NXDL file (without the file extensions). + The name must be unique amongst all the NeXus base class, application, + and contributed definitions. For the class to be adopted by the NIAC, + the first two letters must be "``NX``" (in uppercase). Any other use + must *not* begin with "``NX``" in any combination + of upper or lower case. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" use="required" type="nx:definitionTypeAttr"> + <xs:annotation> + <xs:documentation>Must be ``type="group"``</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="extends" use="optional"> + <xs:annotation> + <xs:documentation> + The ``extends`` attribute allows this definition + to *subclass* from another NXDL, + otherwise ``extends="NXobject"`` should be used. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="restricts" use="optional"> + <xs:annotation> + <xs:documentation> + The ``restricts`` attribute is a flag to the data validation. + When ``restricts="1"``, any non-standard component found + (and checked for validity aginst this NXDL specification) + in a NeXus data file will be flagged as an error. If the + ``restricts`` attribute is not present, any such situations + will produce a warning. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="svnid" use="optional"> + <xs:annotation> + <xs:documentation> + (2014-08-19: deprecated since switch to GitHub version control) + The identifier string from the subversion revision control system. + This reports the time stamp and the revision number of this file. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="category" use="required"> + <xs:annotation> + <xs:documentation> + NXDL ``base`` definitions define the dictionary + of terms to use for these components. + All terms in a ``base`` definition are optional. + NXDL ``application`` definitions define what is + required for a scientific interest. + All terms in an ``application`` definition + are required. + NXDL ``contributed`` definitions may be + considered either base or applications. + Contributed definitions <emphasis>must</emphasis> indicate + their intended use, either as a base class or + as an application definition. + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="base"/> + <xs:enumeration value="application"/> + <xs:enumeration value="contributed"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="ignoreExtraGroups" use="optional" type="nx:NX_BOOLEAN" default="false"> + <xs:annotation> + <xs:documentation> + Only validate known groups; do not not warn about unknowns. + The ``ignoreExtraGroups`` attribute is a flag to the process of + validating NeXus data files. By setting ``ignoreExtraGroups="true"``, + presence of any undefined groups in this class will not generate warnings + during validation. Normally, validation will check all the groups against + their definition in the NeXus base classes and + application definitions. Any items found that do not match the definition + in the NXDL will generate a warning message. + + The ``ignoreExtraGroups`` attribute should be used sparingly! + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="ignoreExtraFields" use="optional" type="nx:NX_BOOLEAN" default="false"> + <xs:annotation> + <xs:documentation> + Only validate known fields; do not not warn about unknowns. + The ``ignoreExtraFields`` attribute is a flag to the process of + validating NeXus data files. By setting ``ignoreExtraFields="true"``, + presence of any undefined fields in this class will not generate warnings + during validation. Normally, validation will check all the fields against + their definition in the NeXus base classes and + application definitions. Any items found that do not match the definition + in the NXDL will generate a warning message. + + The ``ignoreExtraFields`` attribute should be used sparingly! + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="ignoreExtraAttributes" use="optional" type="nx:NX_BOOLEAN" default="false"> + <xs:annotation> + <xs:documentation> + Only validate known attributes; do not not warn about unknowns. + The ``ignoreExtraAttributes`` attribute is a flag to the process of + validating NeXus data files. By setting ``ignoreExtraAttributes="true"``, + presence of any undefined attributes in this class will not generate warnings + during validation. Normally, validation will check all the attributes + against their definition in the NeXus base classes and + application definitions. Any items found that do not match the definition + in the NXDL will generate a warning message. + + The ``ignoreExtraAttributes`` attribute should be used sparingly! + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <xs:simpleType name="definitionTypeAttr"> + <xs:annotation> + <xs:documentation> + Prescribes the allowed values for ``definition`` ``type`` attribute. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="group" /> + <xs:enumeration value="definition" /> + </xs:restriction> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="choiceType"> + <xs:annotation> + <xs:documentation> + A ``choice`` element is used when a named group might take one + of several possible NeXus base classes. Logically, it must + have at least two group children. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="group" type="nx:groupType" minOccurs="2" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + NeXus base class that could be used here. + The group will take the ``@name`` attribute + defined by the parent ``choice`` element + so do not specify the ``@name`` attribute of + the group here. + </xs:documentation> + <!-- TODO: How to enforce the name rule in the schema? --> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + The name to be applied to the selected child group. + None of the child groups should define a + ``@name`` attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="groupType"> + <xs:annotation> + <xs:documentation> + A group element refers to the definition of + an existing NX object or a locally-defined component. + Could contain these elements: + + * ``attribute`` + * ``doc`` + * ``field`` + * ``group`` + * ``link`` + + Note that a ``group`` element also includes the definitions of the + ``basicComponent`` data type. + (The ``groupType`` data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:group ref="nx:groupGroup" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + A ``group`` may be contained within another ``group``. + </xs:documentation> + </xs:annotation> + </xs:group> + <xs:attribute name="type" use="required" type="nx:validNXClassName"> + <xs:annotation> + <xs:documentation> + The ``type`` attribute *must* + contain the name of a + NeXus base class, application definition, or contributed definition. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="name" use="optional" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + A particular scientific application may expect + a name of a ``group`` element. It is helpful but not + required to specify the ``name`` + attribute in the NXDL file. + It is suggested to always specify a ``name`` + to avoid ambiguity. It is also suggested to + derive the ``name`` from the + type, using an additional number suffix as necessary. + For example, consider a data file with only one + ``NXentry``. The suggested default + ``name`` would + be ``entry``. For a data file with two or more + ``NXentry`` groups, the suggested names would be + ``entry1``, ``entry2``, ... + Alternatively, a scientific application such as small-angle + scattering might require + a different naming procedure; two different ``NXaperture`` groups + might be given the names ``beam-defining slit`` + and ``scatter slit``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="minOccurs" use="optional" default="0" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Minimum number of times this ``group`` is allowed to be present within its + parent group. Note each ``group`` must have a ``name`` attribute + that is unique among all ``group`` and ``field`` + declarations within a common parent group. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="maxOccurs" use="optional" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Maximum number of times this ``group`` is allowed to be present within its + parent ``group``. Note each ``group`` must have a ``name`` attribute + that is unique among all ``group`` and ``field`` + declarations within a common parent ``group``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <xs:group name="groupGroup"> + <xs:annotation> + <xs:documentation> + A ``groupGroup`` defines the allowed children of a + ``group`` specification. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe the purpose of this ``group``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="attribute" type="nx:attributeType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Use an ``attribute`` if additional information + needs to be associated with a ``group``. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="choice" type="nx:choiceType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Use a ``choice`` if a named group could be either + of a defined list of base classes. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="group" type="nx:groupType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + A ``group`` may contain ``group``s. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="field" type="nx:fieldType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + A ``group`` may contain ``field`` elements (datasets). + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="link" type="nx:linkType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Use a ``link`` to refer locally to + information placed elsewhere else in the data storage hierarchy. + The ``name`` attribute uniquely identifies + the element in this ``group``. + The ``target`` attribute + (added automatically in a data file by the NAPI) + identifies the original location of this data in the + data storage hierarchy. + In an NXDL specification, the ``target`` attribute + indicates a link to be made by the software that writes the data file. + The value, as written in the NXDL file, will be a suggestion of + the path to the source of the link. + For example:: + + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + + The value of ``target`` is written using + the NeXus class names since this is a suggestion and does not actually use + the element names from a particular data file. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:group> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="basicComponent"> + <xs:annotation> + <xs:documentation> + A ``basicComponent`` defines the allowed name + format and attributes common to all ``field`` + and ``group`` specifications. + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe this ``basicComponent`` and its use. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + The ``name`` attribute is the + identifier string for this entity. + It is required that ``name`` must be unique + within the enclosing ``group``. + The rule (``validItemName``) is defined to only + allow names that can be represented as valid variable names + in most computer languages. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="fieldType"> + <xs:annotation> + <xs:documentation> + A ``field`` declares a new element in the component being defined. + A ``field`` is synonymous with the HDF4 SDS (Scientific Data Set) and + the HDF5 *dataset* terms. Could contain these elements: + + * ``attribute`` + * ``dimensions`` + * ``doc`` + * ``enumeration`` + + Note that a ``field`` element also includes the definitions of the + ``basicComponent`` data type. + (The ``fieldType`` data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="nx:basicComponent"> + <xs:sequence> + <xs:element name="dimensions" type="nx:dimensionsType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation>dimensions of a data element + in a NeXus file</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="attribute" type="nx:attributeType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation + >attributes to be used with this field</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="enumeration" type="nx:enumerationType" minOccurs="0"> + <xs:annotation> + <xs:documentation>A field can specify which + values are to be used</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="units" type="nx:anyUnitsAttr"> + <xs:annotation> + <xs:documentation> + String describing the engineering units. + The string should be appropriate for the value + and should conform to the NeXus rules for units. + Conformance is not validated at this time. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="long_name" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Descriptive name for this field (may include whitespace and engineering units). + Often, the long_name (when defined) will be used as the axis label on a plot. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="signal" type="nx:NX_POSINT"> + <xs:annotation> + <xs:documentation> + Presence of the ``signal`` attribute means this field is an ordinate. + + Integer marking this field as plottable data (ordinates). + The value indicates the priority of selection or interest. + Some facilities only use ``signal=1`` + while others use ``signal=2`` to indicate + plottable data of secondary interest. + Higher numbers are possible but not common + and interpretation is not standard. + + A field with a ``signal`` attribute should not have an ``axis`` attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="axes" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + NOTE: Use of this attribute is discouraged. It is for legacy support. + You should use the axes attribute on the NXdata group instead. + + Presence of the ``axes`` attribute means this field is an ordinate. + + This attribute contains a colon (or comma in legacy files) delimited list + of the names of independent axes when plotting this field. + Each name in this list must exist as a field in the same group. + <!-- perhaps even discourage use of square brackets in axes attribute? --> + (Optionally, the list can be enclosed by square brackets but this is not common.) + The regular expression for this rule is:: + + [A-Za-z_][\w_]*([ :][A-Za-z_][\w_]*)* + + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="axis" type="nx:NX_POSINT"> + <xs:annotation> + <xs:documentation> + NOTE: Use of this attribute is discouraged. It is for legacy support. + You should use the axes attribute on the NXdata group instead. + + Presence of the ``axis`` attribute means this field is an abcissa. + + The attribute value is an integer indicating this + field as an axis that is part of the data set. + The data set is a field with the attribute + ``signal=1`` in the same group. + The value can range from 1 up to the number of + independent axes (abcissae) in the data set. + + A value of ``axis=1``" indicates that this field + contains the data for the first independent axis. + For example, the X axis in an XY data set. + + A value of ``axis=2`` indicates that this field + contains the data for the second independent axis. + For example, the Y axis in a 2-D data set. + + A value of ``axis=3`` indicates that this field + contains the data for the third independent axis. + For example, the Z axis in a 3-D data set. + + A field with an ``axis`` attribute should + not have a ``signal`` attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="primary" type="nx:NX_POSINT"> + <xs:annotation> + <xs:documentation> + Integer indicating the priority of selection + of this field for plotting (or visualization) as an axis. + + Presence of the ``primary`` attribute means this + field is an abcissa. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" type="nx:NAPI" default="NX_CHAR"> + <xs:annotation> + <xs:documentation> + Defines the type of the element as allowed by the NAPI (NeXus Application Programmer Interface). + See elsewhere for the complete list of allowed NAPI types. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="minOccurs" use="optional" default="0" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Defines the minimum number of times this ``field`` may be used. Its + value is confined to zero or greater. Must be less than or equal to + the value for the "maxOccurs" attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="maxOccurs" use="optional" default="1" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Defines the maximum number of times this element may be used. Its + value is confined to zero or greater. Must be greater than or equal to + the value for the "minOccurs" attribute. + A value of "unbounded" is allowed. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="stride" use="optional" default="1" type="nx:NX_INT"> + <xs:annotation> + <xs:documentation> + The ``stride`` and ``data_offset`` attributes + are used together to index the array of data items in a + multi-dimensional array. They may be used as an alternative + method to address a data array that is not stored in the standard NeXus + method of "C" order. + + The ``stride`` list chooses array locations from the + data array with each value in the ``stride`` list + determining how many elements to move in each dimension. + Setting a value in the ``stride`` array to 1 moves + to each element in that dimension of the data array, while + setting a value of 2 in a location in the ``stride`` + array moves to every other element in that dimension of the + data array. A value in the ``stride`` list may be + positive to move forward or negative to step backward. + A value of zero will not step (and is of no particular use). + + See http://davis.lbl.gov/Manuals/HDF5-1.4.3/Tutor/phypereg.html + or *4. Dataspace Selection Operations* in + http://www.hdfgroup.org/HDF5/doc1.6/Dataspaces.html. + + + The ``stride`` attribute contains a + comma-separated list of integers. + (In addition to the required comma delimiter, + whitespace is also allowed to improve readability.) + The number of items in the list + is equal to the rank of the data being stored. The value of each + item is the spacing of the data items in that subscript of the array. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="data_offset" use="optional" default="1" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <!-- + note: renamed from "offset" due to comflict with CIF usage. + see: https://github.com/nexusformat/definitions/issues/330#issuecomment-232074420 + --> + <xs:documentation> + The ``stride`` and ``data_offset`` attributes + are used together to index the array of data items in a + multi-dimensional array. They may be used as an alternative + method to address a data array that is not stored in the standard NeXus + method of "C" order. + + The ``data_offset`` attribute + determines the starting coordinates of the data array + for each dimension. + + See http://davis.lbl.gov/Manuals/HDF5-1.4.3/Tutor/phypereg.html + or *4. Dataspace Selection Operations* in + http://www.hdfgroup.org/HDF5/doc1.6/Dataspaces.html. + + The ``data_offset`` attribute contains a + comma-separated list of integers. + (In addition to the required comma delimiter, + whitespace is also allowed to improve readability.) + The number of items in the list + is equal to the rank of the data being stored. The value of each + item is the offset in the array of the first data item of that + subscript of the array. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="interpretation" use="optional"> + <xs:annotation> + <xs:documentation> + This instructs the consumer of the data what the last dimensions + of the data are. It allows plotting software to work + out the natural way of displaying the data. + + For example a single-element, energy-resolving, fluorescence detector + with 512 bins should have ``interpretation="spectrum"``. If the + detector is scanned over a 512 x 512 spatial grid, the data reported + will be of dimensions: 512 x 512 x 512. + In this example, the initial plotting representation should default to + data of the same dimensions of a 512 x 512 pixel ``image`` + detector where the images where taken at 512 different pressure values. + + In simple terms, the allowed values mean: + + * ``scaler`` = 0-D data to be plotted + * ``spectrum`` = 1-D data to be plotted + * ``image`` = 2-D data to be plotted + * ``vertex`` = 3-D data to be plotted + + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="nx:NX_CHAR"> + <xs:enumeration value="scalar"/> + <xs:enumeration value="spectrum"/> + <xs:enumeration value="image"/> + <xs:enumeration value="vertex"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="nameType" use="optional" default="specified"> + <xs:annotation> + <xs:documentation> + This interprets the name attribute as: + * ``specified`` = use as specified + * ``any`` = can be any name not already used in group + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="nx:NX_CHAR"> + <xs:enumeration value="specified"/> + <xs:enumeration value="any"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="attributeType"> + <xs:annotation> + <xs:documentation> + Any new group or field may expect or require some common attributes. + + .. + Could contain these elements: + + * ``doc`` + * ``enumeration`` + + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0"> + <xs:annotation> + <xs:documentation> + Description of this ``attribute``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="enumeration" type="nx:enumerationType" + minOccurs="0"> + <xs:annotation> + <xs:documentation> + An enumeration specifies the values to be used. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dimensions" type="nx:dimensionsType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + dimensions of an attribute with data value(s) in a NeXus file + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + Name of the attribute (unique within the enclosing group). + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" type="nx:primitiveType" default="NX_CHAR"> + <xs:annotation> + <xs:documentation> + Type of the attribute. + For ``group`` specifications, the class name. + For ``field`` or ``attribute`` specifications, + the NXDL data type. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="optional" type="nx:NX_BOOLEAN" default="true"> + <xs:annotation> + <xs:documentation> + Is this attribute *optional* (if **true**) + or *required* (if **false**)? + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <xs:simpleType name="nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + A ``nonNegativeUnbounded`` allows values including + all positive integers, zero, and the string ``unbounded``. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:nonNegativeInteger"/> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="unbounded" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="linkType"> + <xs:annotation> + <xs:documentation> + A link to another item. Use a link to avoid + needless repetition of information. + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="nx:basicComponent"> + <xs:attribute name="target" use="required" type="nx:validTargetName"> + <xs:annotation> + <xs:documentation> + Declares the absolute HDF5 address of an existing field or group. + + The target attribute is added for NeXus to distinguish the + HDF5 path to the original dataset. + + Could contain these elements: + + * ``doc`` + + Matching regular expression:: + + (/[a-zA-Z_][\w_]*(:[a-zA-Z_][\w_]*)?)+ + + For example, given a + ``/entry/instrument/detector/polar_angle`` field, + link it into the ``NXdata`` group + (at ``/entry/data/polar_angle``). + This would be the NeXus data file structure:: + + /: NeXus/HDF5 data file + /entry:NXentry + /data:NXdata + /polar_angle:NX_NUMBER + @target="/entry/instrument/detector/polar_angle" + /instrument:NXinstrument + /detector:NXdetector + /polar_angle:NX_NUMBER + @target="/entry/instrument/detector/polar_angle" + + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="napimount" use="optional" type="xs:string"> + <xs:annotation> + <xs:documentation> + Group attribute that provides a URL to a group in another file. + More information is described in the *NeXus Programmers Reference*. + + http://download.nexusformat.org/doc/NeXusIntern.pdf + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="docType" mixed="true"> + <xs:annotation> + <xs:documentation> + NXDL allows for documentation on most elements using the ``doc`` + element. The documentation is useful in several contexts. The documentation will be + rendered in the manual. Documentation, is provided as tooltips + by some XML editors when editing NXDL files. + Simple documentation can be typed directly in the NXDL:: + + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + + This is suitable for basic descriptions that do not need extra formatting + such as a bullet-list or a table. For more advanced control, use the rules + of restructured text, such as in the :ref:`NXdetector` specification. + Refer to examples in the NeXus base class NXDL files such as :ref:`NXdata`. + + Could contain these elements: + + * *any* + + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + + Note: + For documentation of ``definition`` elements, + the first line of text in a ``doc`` + is used as a summary in the manual. + Follow the pattern as shown + in the base class NXDL files. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="symbolsType" mixed="true"> + <xs:annotation> + <xs:documentation> + Each ``symbol`` has a ``name`` and optional documentation. + Please provide documentation that indicates what each symbol represents. + For example:: + + <symbols> + <symbol name="nsurf"><doc>number of reflecting surfaces</doc></symbol> + <symbol name="nwl"><doc>number of wavelengths</doc></symbol> + </symbols> + + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe the purpose of this list of ``symbols``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="symbol" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + When multiple ``field`` elements share the same dimensions, such as the dimension scales + associated with plottable data in an ``NXdata`` group, the length of each + dimension written in a NeXus data file should be something that can be tested by the + data file validation process. + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe the purpose of the parent ``symbol``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + Mnemonic variable name for this array index symbol. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="enumerationType"> + <xs:annotation> + <xs:documentation> + An ``enumeration`` restricts the values allowed for a specification. + Each value is specified using an ``item`` element, such as: + ``<item value="Synchrotron X-ray Source" />``. + Could contain these elements: + + * ``doc`` + * ``item`` + + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + + :: + + <field name="mode"> + <doc>source operating mode</doc> + <enumeration> + <item value="Single Bunch"><doc>for storage rings</doc></item> + <item value="Multi Bunch"><doc>for storage rings</doc></item> + <!-- other sources could add to this --> + </enumeration> + </field> + + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="item" minOccurs="1" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + One of the prescribed values. Use the ``value`` attribute. + + Defines the value of one selection for an ``enumeration`` list. + Each enumerated item must have a value (it cannot have an empty text node). + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Individual items can be documented + but this documentation might not be printed in the + *NeXus Reference Guide*. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="value" use="required"> + <xs:annotation> + <xs:documentation> + The value of ``value`` of an ``enumItem`` + is defined as an attribute rather than a name. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="dimensionsType"> + <!-- + see TRAC ticket #32: https://github.com/nexusformat/definitions/issues/32 + --> + <xs:annotation> + <xs:documentation> + dimensions of a data element in a NeXus file + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0"> + <xs:annotation> + <xs:documentation> + Documentation might be necessary to describe how the parts + of the ``dimensions`` element are to be used. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dim" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Specify the parameters for each index of the ``dimensions`` + element with a ``dim`` element. + The number of ``dim`` entries should be equal to + the ``rank`` of the array. + For example, these terms + describe a 2-D array with lengths (``nsurf``, ``nwl``): + + .. code-block:: xml + :linenos: + + <dimensions rank="2"> + <dim index="1" value="nsurf"/> + <dim index="2" value="nwl"/> + </dimensions> + + The ``value`` attribute is used by NXDL and also by + the NeXus data file validation tools to associate and coordinate the + same array length across multiple fields in a group. + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attribute name="index" use="required"> + <xs:annotation> + <xs:documentation> + Number or symbol indicating which axis (subscript) is + being described, ranging from 1 up to + ``rank`` (rank of the + data structure). For example, given an array + ``A[i,j,k]``, + ``index="1"`` would refer to the + ``i`` axis (subscript). + (``NXdata`` uses ``index="0"`` + to indicate a situation when the specific index is not + known *a priori*.) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="value" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Integer length (number of values), or mnemonic symbol + representing the length of this axis. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="ref" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Deprecated: 2016-11-23 telco + (https://github.com/nexusformat/definitions/issues/330) + + The dimension specification is the same as + that in the ``ref`` field, specified either by a relative path, + such as ``polar_angle`` or ``../Qvec`` or absolute path, such as + ``/entry/path/to/follow/to/ref/field``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="refindex" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Deprecated: 2016-11-23 telco + (https://github.com/nexusformat/definitions/issues/330) + + The dimension specification is the same as + the ``refindex`` axis within the ``ref`` field. + Requires ``ref`` attribute to be present. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="incr" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + The dimension specification is related to + the ``refindex`` axis within the ``ref`` field by an + offset of ``incr``. Requires ``ref`` and ``refindex`` + attributes to be present. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="required" type="nx:NX_BOOLEAN" default="true"> + <xs:annotation> + <xs:documentation> + This dimension is required (true: default) or not required (false). + + The default value is ``true``. + + When ``required="false"`` is + specified, all subsequent ``<dim`` nodes + (with higher ``index`` value) + **must** also have ``required="false"``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="rank" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Rank (number of dimensions) of the data structure. + + Value could be either an unsigned integer or a symbol + as defined in the *symbol* table of the NXDL file. + + For example: ``a[5]`` has ``rank="1"`` while + ``b[8,5,6,4]`` has ``rank="4"``. + See http://en.wikipedia.org/wiki/Rank_(computer_programming) + for more details. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +</xs:schema> diff --git a/src/punx/cache/v2018.5/nxdlTypes.xsd b/src/punx/cache/v2018.5/nxdlTypes.xsd new file mode 100644 index 0000000000000000000000000000000000000000..c5da9fad15351ceb56273449d1bd1dc77f94b096 --- /dev/null +++ b/src/punx/cache/v2018.5/nxdlTypes.xsd @@ -0,0 +1,553 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://definition.nexusformat.org/nxdl/3.1" + xmlns:nxdl="http://definition.nexusformat.org/nxdl/3.1" + elementFormDefault="qualified"> + + <xs:annotation> + <xs:documentation> + .. + NeXus - Neutron and X-ray Common Data Format + + Copyright (C) 2008-2018 NeXus International Advisory Committee (NIAC) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information, see http://www.nexusformat.org + </xs:documentation> + </xs:annotation> + + <!-- + anyUnitsAttr: specifies the type of content that goes into a units="" attribute + primitiveType: specifies the type of content that goes into a type="" attribute of a field or attribute + --> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:simpleType name="anyUnitsAttr"> + <xs:annotation> + <xs:documentation> + Unit categories in NXDL specifications describe the expected type of units for a NeXus field. + + They should describe valid units consistent with + the manual section on NeXus units (based on UDUNITS). + Units are not validated by NeXus. + </xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_ANGLE + nxdl:NX_ANY + nxdl:NX_AREA + nxdl:NX_CROSS_SECTION + nxdl:NX_CHARGE + nxdl:NX_CURRENT + nxdl:NX_DIMENSIONLESS + nxdl:NX_EMITTANCE + nxdl:NX_ENERGY + nxdl:NX_FLUX + nxdl:NX_FREQUENCY + nxdl:NX_LENGTH + nxdl:NX_MASS + nxdl:NX_MASS_DENSITY + nxdl:NX_MOLECULAR_WEIGHT + nxdl:NX_PER_AREA + nxdl:NX_PER_LENGTH + nxdl:NX_PERIOD + nxdl:NX_POWER + nxdl:NX_PRESSURE + nxdl:NX_PULSES + nxdl:NX_SCATTERING_LENGTH_DENSITY + nxdl:NX_SOLID_ANGLE + nxdl:NX_TEMPERATURE + nxdl:NX_TIME + nxdl:NX_TIME_OF_FLIGHT + nxdl:NX_TRANSFORMATION + nxdl:NX_UNITLESS + nxdl:NX_VOLTAGE + nxdl:NX_VOLUME + nxdl:NX_UNITLESS + nxdl:NX_WAVELENGTH + nxdl:NX_WAVENUMBER + " /> + </xs:simpleType> + + <xs:simpleType name="NX_ANGLE"> + <xs:annotation> + <xs:documentation> + units of angle + <xs:element name="example">m</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_ANY"> + <xs:annotation> + <xs:documentation> + units for things like logs that aren't picky on units + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_AREA"> + <xs:annotation> + <xs:documentation> + units of area + <xs:element name="example">m^2</xs:element> + <xs:element name="example">barns</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_CROSS_SECTION"> + <xs:annotation> + <xs:documentation> + units of area (alias of NX_AREA) + <xs:element name="example">barn</xs:element> + </xs:documentation> + </xs:annotation> + <xs:union memberTypes="nxdl:NX_AREA" /> + </xs:simpleType> + + <xs:simpleType name="NX_CHARGE"> + <xs:annotation> + <xs:documentation> + units of electrical charge + <xs:element name="example">c</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_CURRENT"> + <xs:annotation> + <xs:documentation> + units of electrical current + <xs:element name="example">A</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_DIMENSIONLESS"> + <xs:annotation> + <xs:documentation> + units for fields where the units cancel out + (NOTE: not the same as NX_UNITLESS) + <xs:element name="example">m/m</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_EMITTANCE"> + <xs:annotation> + <xs:documentation> + units of emittance (``length * angle``) of a + radiation source + <xs:element name="example">nm*rad</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_ENERGY"> + <xs:annotation> + <xs:documentation> + units of energy + <xs:element name="example">J</xs:element> + <xs:element name="example">keV</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_FLUX"> + <xs:annotation> + <xs:documentation> + units of flux + <xs:element name="example">1/s/cm^2</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_FREQUENCY"> + <xs:annotation> + <xs:documentation> + units of frequency + <xs:element name="example">Hz</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_LENGTH"> + <xs:annotation> + <xs:documentation> + units of length + <xs:element name="example">m</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_MASS"> + <xs:annotation> + <xs:documentation> + units of mass + <xs:element name="example">g</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_MASS_DENSITY"> + <xs:annotation> + <xs:documentation> + units of mass density + <xs:element name="example">g/cm^3</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_MOLECULAR_WEIGHT"> + <xs:annotation> + <xs:documentation> + units of molecular weight + <xs:element name="example">g/mol</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PER_AREA"> + <xs:annotation> + <xs:documentation> + units of 1/length^2 + <xs:element name="example">1/m^2</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PER_LENGTH"> + <xs:annotation> + <xs:documentation> + units of 1/length + <xs:element name="example">1/m</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PERIOD"> + <xs:annotation> + <xs:documentation> + units of time, period of pulsed source + (alias to `NX_TIME`) + <xs:element name="example">us</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:NX_TIME" /> + </xs:simpleType> + + <xs:simpleType name="NX_POWER"> + <xs:annotation> + <xs:documentation> + units of power + <xs:element name="example">W</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PRESSURE"> + <xs:annotation> + <xs:documentation> + units of pressure + <xs:element name="example">Pa</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PULSES"> + <xs:annotation> + <xs:documentation> + units of clock pulses (alias to `NX_NUMBER`) + </xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:NX_NUMBER" /> + </xs:simpleType> + + <xs:simpleType name="NX_SCATTERING_LENGTH_DENSITY"> + <xs:annotation> + <xs:documentation> + units of scattering length density + <xs:element name="example">m/m^3</xs:element> + </xs:documentation> + </xs:annotation> + <!-- isn't this an alias of NX_PER_AREA? + Could also be alias of NX_LENGTH (cm^2/atom) --> + <!-- <xs:union memberTypes="nxdl:NX_PER_AREA nxdl:NX_LENGTH" /> --> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_SOLID_ANGLE"> + <xs:annotation> + <xs:documentation> + units of solid angle + <xs:element name="example">sr</xs:element> + <xs:element name="example">steradian</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_TEMPERATURE"> + <xs:annotation> + <xs:documentation> + units of temperature + <xs:element name="example">K</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_TIME"> + <xs:annotation> + <xs:documentation> + units of time + <xs:element name="example">s</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_TIME_OF_FLIGHT"> + <xs:annotation> + <xs:documentation> + units of (neutron) time of flight + (alias to `NX_TIME`) + <xs:element name="example">s</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:NX_TIME" /> + </xs:simpleType> + + <xs:simpleType name="NX_TRANSFORMATION"> + <xs:annotation> + <xs:documentation> + units of the specified transformation + + could be any of these: ``NX_LENGTH``, ``NX_ANGLE``, or ``NX_UNITLESS`` + + There will be one or more transformations defined by one or more fields + for each transformation. The units type ``NX_TRANSFORMATION`` designates the + particular axis generating a transformation (e.g. a rotation axis or a translation + axis or a general axis). ``NX_TRANSFORMATION`` designates the + units will be appropriate to the type of transformation, + indicated in the :ref:`NXtransformations` base class + by the ``transformation_type`` value: + + * ``NX_LENGTH`` for ``translation`` + * ``NX_ANGLE`` for ``rotation`` + * ``NX_UNITLESS`` for axes for which no transformation type is specified. + </xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_LENGTH + nxdl:NX_ANGLE + nxdl:NX_UNITLESS + " /> + </xs:simpleType> + + <xs:simpleType name="NX_UNITLESS"> + <xs:annotation> + <xs:documentation> + for fields that don't have a unit (e.g. hkl) so that they don't + inherit the wrong units (NOTE: not the same as NX_DIMENSIONLESS) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_VOLTAGE"> + <xs:annotation> + <xs:documentation> + units of voltage + <xs:element name="example">V</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_VOLUME"> + <xs:annotation> + <xs:documentation> + units of volume + <xs:element name="example">m3</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_WAVELENGTH"> + <xs:annotation> + <xs:documentation> + units of wavelength + <xs:element name="example">angstrom</xs:element> + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_WAVENUMBER"> + <xs:annotation> + <xs:documentation> + units of wavenumber or Q + <xs:element name="example">1/nm</xs:element> + <xs:element name="example">1/angstrom</xs:element> + </xs:documentation> + </xs:annotation> + <!-- isn't this an alias of NX_PER_LENGTH? --> + <!-- <xs:union memberTypes="nxdl:NX_PER_LENGTH" /> --> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:simpleType name="primitiveType"> + <xs:annotation> + <xs:documentation> + Valid names for the type attribute on fields and attributes. + This is an alias for NAPI (which is any valid NeXus type). + </xs:documentation> + </xs:annotation> + <xs:list itemType="nxdl:NAPI" /> + </xs:simpleType> + + <xs:simpleType name="NAPI"> + <xs:annotation> + <xs:documentation>any valid NeXus type</xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_CHAR + nxdl:NX_FLOAT + nxdl:NX_INT + nxdl:NX_UINT + nxdl:NX_POSINT + nxdl:NX_NUMBER + nxdl:NX_DATE_TIME + nxdl:NX_BOOLEAN + nxdl:NX_BINARY + nxdl:ISO8601 + "/> + </xs:simpleType> + + <xs:simpleType name="NX_CHAR"> + <xs:annotation> + <xs:documentation> + any string representation + + All strings are to be encoded in UTF-8. + + Includes fixed-length strings, variable-length strings, + and string arrays. + + Some file writers write strings as a string array + of rank 1 and length 1. + Clients should be prepared to handle such strings. + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_FLOAT"> + <xs:annotation> + <xs:documentation>any representation of a floating point number</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:float" /> + </xs:simpleType> + + <xs:simpleType name="NX_INT"> + <xs:annotation> + <xs:documentation>any representation of an integer number</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + + <xs:simpleType name="NX_UINT"> + <xs:annotation> + <xs:documentation>any representation of an unsigned integer number (includes zero)</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:unsignedInt" /> + </xs:simpleType> + + <xs:simpleType name="NX_POSINT"> + <xs:annotation> + <xs:documentation>any representation of a positive integer number (greater than zero)</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:positiveInteger" /> + </xs:simpleType> + + <xs:simpleType name="NX_NUMBER"> + <xs:annotation> + <xs:documentation>any valid NeXus number representation</xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_INT + nxdl:NX_UINT + nxdl:NX_POSINT + nxdl:NX_FLOAT + " /> + </xs:simpleType> + + <xs:simpleType name="NX_DATE_TIME"> + <xs:annotation> + <xs:documentation>alias for the ISO8601 date/time stamp</xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:ISO8601" /> + </xs:simpleType> + + <xs:simpleType name="ISO8601"> + <xs:annotation> + <xs:documentation>ISO8601 date/time stamp</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:dateTime" /> + </xs:simpleType> + + <xs:simpleType name="NX_BOOLEAN"> + <xs:annotation> + <xs:documentation>true/false value ( true | 1 | false | 0 )</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:boolean" /> + </xs:simpleType> + + <xs:simpleType name="NX_BINARY"> + <xs:annotation> + <xs:documentation>any representation of binary data - if text, line terminator is [CR][LF]</xs:documentation> + </xs:annotation> + <!-- TODO Is this the way to describe pure binary? uint8, byte, hex64binary --> + <!-- TODO Should be a uint8 but this does not seem to be allowed. Using xs:unsignedByte instead. --> + <xs:restriction base="xs:unsignedByte" /> + </xs:simpleType> + +</xs:schema> diff --git a/src/punx/cache/v3.2/__github_info__.json b/src/punx/cache/v3.2/__github_info__.json deleted file mode 100644 index 540d5b3807c24d409becd1e85c0e1c0a3bf168e6..0000000000000000000000000000000000000000 --- a/src/punx/cache/v3.2/__github_info__.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "# description": "NXDL files downloaded from GitHub repository", - "zip_url": "https://api.github.com/repos/nexusformat/definitions/zipball/v3.2", - "# written": "2017-03-11 12:21:57.583000", - "sha": "e888dacf02712522f28c1b598c6b7855da5fff46", - "last_modified": "2017-01-18 23:12:44", - "ref_type": "tag", - "ref": "v3.2" -} \ No newline at end of file diff --git a/src/punx/cache/v3.3/__github_info__.json b/src/punx/cache/v3.3/__github_info__.json new file mode 100644 index 0000000000000000000000000000000000000000..e6a8a0c0eee8fa72069427d18c39527a3459f897 --- /dev/null +++ b/src/punx/cache/v3.3/__github_info__.json @@ -0,0 +1,9 @@ +{ + "# description": "NXDL files downloaded from GitHub repository", + "zip_url": "https://api.github.com/repos/nexusformat/definitions/zipball/v3.3", + "# written": "2017-07-21 23:31:25.148918", + "sha": "9285af9c80ff5bc4e908ee8aae300f974dda7d38", + "last_modified": "2017-07-12 17:41:13", + "ref_type": "release", + "ref": "v3.3" +} \ No newline at end of file diff --git a/src/punx/cache/v3.2/applications/NXarchive.nxdl.xml b/src/punx/cache/v3.3/applications/NXarchive.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXarchive.nxdl.xml rename to src/punx/cache/v3.3/applications/NXarchive.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXarpes.nxdl.xml b/src/punx/cache/v3.3/applications/NXarpes.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXarpes.nxdl.xml rename to src/punx/cache/v3.3/applications/NXarpes.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXcanSAS.nxdl.xml b/src/punx/cache/v3.3/applications/NXcanSAS.nxdl.xml similarity index 98% rename from src/punx/cache/v3.2/applications/NXcanSAS.nxdl.xml rename to src/punx/cache/v3.3/applications/NXcanSAS.nxdl.xml index 692782960e8cedcb6a9596d64c338b9d9312f315..3ac1d0996f9edf433e10a8806af94163c10c661f 100644 --- a/src/punx/cache/v3.2/applications/NXcanSAS.nxdl.xml +++ b/src/punx/cache/v3.3/applications/NXcanSAS.nxdl.xml @@ -891,8 +891,10 @@ Position of the beam center on the detector. This is the x position where the direct beam would hit the detector plane. - This is a length, not a pixel position, and can be outside of the actual - detector. The value can any real number (positive, zero, or negative). + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. The value can be any + real number (positive, zero, or negative). </doc> </field> @@ -901,8 +903,10 @@ Position of the beam center on the detector. This is the y position where the direct beam would hit the detector plane. - This is a length, not a pixel position, and can be outside of the actual - detector. The value can any real number (positive, zero, or negative). + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. The value can be any + real number (positive, zero, or negative). </doc> </field> diff --git a/src/punx/cache/v3.2/applications/NXdirecttof.nxdl.xml b/src/punx/cache/v3.3/applications/NXdirecttof.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXdirecttof.nxdl.xml rename to src/punx/cache/v3.3/applications/NXdirecttof.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXfluo.nxdl.xml b/src/punx/cache/v3.3/applications/NXfluo.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXfluo.nxdl.xml rename to src/punx/cache/v3.3/applications/NXfluo.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXindirecttof.nxdl.xml b/src/punx/cache/v3.3/applications/NXindirecttof.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXindirecttof.nxdl.xml rename to src/punx/cache/v3.3/applications/NXindirecttof.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXiqproc.nxdl.xml b/src/punx/cache/v3.3/applications/NXiqproc.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXiqproc.nxdl.xml rename to src/punx/cache/v3.3/applications/NXiqproc.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXlauetof.nxdl.xml b/src/punx/cache/v3.3/applications/NXlauetof.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXlauetof.nxdl.xml rename to src/punx/cache/v3.3/applications/NXlauetof.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXmonopd.nxdl.xml b/src/punx/cache/v3.3/applications/NXmonopd.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXmonopd.nxdl.xml rename to src/punx/cache/v3.3/applications/NXmonopd.nxdl.xml diff --git a/src/punx/cache/v3.3/applications/NXmx.nxdl.xml b/src/punx/cache/v3.3/applications/NXmx.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..78d800a86e51407815c018620b04a7a16a883c6c --- /dev/null +++ b/src/punx/cache/v3.3/applications/NXmx.nxdl.xml @@ -0,0 +1,622 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NeXus - Neutron and X-ray Common Data Format + # + # Copyright (C) 2013-2017 NeXus International Advisory Committee (NIAC) + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 3 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # For further information, see http://www.nexusformat.org +--> +<definition name="NXmx" extends="NXobject" type="group" + version="1.5" category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <symbols> + <!-- TODO define options for most fields to allow them to be either scalar + or arrays indexed by np, i, j, k, ..., + --> + <doc> + These symbols will be used below to coordinate datasets + with the same shape. Most MX x-ray detectors will produce + two-dimensional images. Some will produce three-dimensional + images, using one of the indices to select a detector element. + </doc> + <symbol name="dataRank"> + <doc>rank of the ``data`` field</doc> + </symbol> + <symbol name="np"> + <doc>number of scan points</doc> + </symbol> + <symbol name="i"> + <doc>number of detector pixels in the slowest direction</doc> + </symbol> + <symbol name="j"> + <doc>number of detector pixels in the second slowest direction</doc> + </symbol> + <symbol name="k"> + <doc>number of detector pixels in the third slowest direction</doc> + </symbol> + </symbols> + + <doc> + functional application definition for macromolecular crystallography + </doc> + + <group type="NXentry"> + <field name="title" type="NX_CHAR" minOccurs="0" /> + + <field name="start_time" type="NX_DATE_TIME" minOccurs="0" /> + + <field name="end_time" type="NX_DATE_TIME" minOccurs="0" /> + + <field name="definition"> + <doc> NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXmx" /> + </enumeration> + </field> + + <group type="NXinstrument"> + <group type="NXattenuator" minOccurs="0"> + <field name="attenuator_transmission" type="NX_NUMBER" units="NX_UNITLESS" + minOccurs="0" /> + </group> + + <group type="NXdetector_group" minOccurs="0"> + <doc> + Optional logical grouping of detector elements. + + Each detector element is represented as an NXdetector group + with its own detector data array. Each detector data array + may be further decomposed into array sections by use of + NXdetector_module groups. The names are given in the + group names field. + + The groups are defined hierarchically, with names given + in the group_names field, unique identifiing indices given + in the field group_index, and the level in the hierarchy + given in the group_parent field. For example if an x-ray + detector, DET, consists of four elements in a rectangular array:: + + DTL DTR + DLL DLR + + We could have:: + + group_names: ["DET", "DTL", "DTR", "DLL", "DLR"] + group_index: [1, 2, 3, 4, 5] + group_parent: [-1, 1, 1, 1, 1] + + </doc> + + <field name="group_names" type="NX_CHAR"> + <doc> + An array of the names of the detector elements or hierarchical + groupings of detector elements. + + Specified in the base classes as comma separated list of names, + but new code should use an array of names as quoted strings. + </doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> + + <field name="group_index" type="NX_INT"> + <doc> + An array of unique indices for detector elements or groupings + of detector elements. + + Each element is a unique ID for the corresponding group named + in the field group_names. The IDs are positive integers starting + with 1. + </doc> + <dimensions><dim index="1" value="i"/></dimensions> + </field> + + <field name="group_parent" type="NX_INT"> + <doc> + An array of the hierarchical levels of the parents of detector + elements or groupings of detector elements. + + A top-level element or grouping has parent level -1 + </doc> + <dimensions><dim index="1" ref="group_index"/></dimensions> + </field> + </group> + <group type="NXdetector"> + <doc> + Normally the detector group will have the name ``detector``. + However, in the case of multiple detector elements, each element + needs a uniquely named NXdetector group. + </doc> + <field name="depends_on" type="NX_CHAR" /> <!-- better type for paths needed --> + + <group type="NXtransformations" minOccurs="0"> + <doc> + Suggested location for axes (transformations) to do with the + detector + </doc> + </group> + + <group type="NXcollection" minOccurs="0"> + <doc> + Suggested container for detailed non-standard detector + information like corrections applied automatically or + performance settings. + </doc> + </group> + + <field name="data" type="NX_NUMBER"> + <doc> + For a dimension-2 detector, the rank of the data array will be 3. + For a dimension-3 detector, the rank of the data array will be 4. + This allows for the introduction of the frame number as the + first index. + </doc> + <dimensions rank="dataRank"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + <dim index="4" value="k" required="false"/> + </dimensions> + </field> + + <field name="description" minOccurs="0"> + <doc> + name/manufacturer/model/etc. information + </doc> + </field> + + <field name="time_per_channel" units="NX_TIME" minOccurs="0"> + <doc>todo: define more clearly</doc> + </field> + + <group type="NXdetector_module" minOccurs="1" maxOccurs="unbounded"> + <doc> + Many detectors consist of multiple smaller modules that are + operated in sync and store their data in a common dataset. + To allow consistent parsing of the experimental geometry, + this application definiton requires all detectors to + define a detector module, even if there is only one. + + This group specifies the hyperslab of data in the data + array associated with the detector that contains the + data for this module. If the module is associated with + a full data array, rather than with a hyperslab within + a larger array, then a single module should be defined, + spanning the entire array. + </doc> + <field name="data_origin" type="NX_INT"> + <doc> + A dimension-2 or dimension-3 field which gives the indices + of the origin of the hyperslab of data for this module in the + main area detector image in the parent NXdetector module. + + The data_origin is 0-based. + + The frame number dimension (np) is omitted. The order + of indices is i, j or i, j, k, i.e. slow to fast. + </doc> + </field> + <field name="data_size" type="NX_INT"> + <doc> + Two or three values for the size of the module in pixels in + each direction. + </doc> + </field> + <field name="data_stride" type="NX_INT" minOccurs="0"> + <doc> + Two or three values for the stride of the module in pixels in + each direction. By default the stride is [1,1] or [1,1,1], + and this is the most likely case. This optional field is + included for completeness. + </doc> + </field> + + <field name="module_offset" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Offset of the module in regards to the origin of the detector in an + arbitrary direction. + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector"> + </attribute> + <attribute name="offset"> + </attribute> + <attribute name="depends_on"> + </attribute> + </field> + <field name="fast_pixel_direction" units="NX_LENGTH" type="NX_NUMBER"> + <doc> + Values along the direction of fastest varying pixel direction.The + direction itself is given through the vector attribute + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector"> + </attribute> + <attribute name="offset"> + </attribute> + <attribute name="depends_on"> + </attribute> + </field> + <field name="slow_pixel_direction" type="NX_NUMBER" units="NX_LENGTH"> + <doc> + Values along the direction of slow varying pixel direction. The + direction itself is given through the vector attribute + </doc> + <attribute name="transformation_type"> + <enumeration> + <item value="translation" /> + </enumeration> + </attribute> + <attribute name="vector"> + </attribute> + <attribute name="offset"> + </attribute> + <attribute name="depends_on"> + </attribute> + </field> + </group> + + <field name="distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0"> + <doc> + Distance from the sample to the beam center. + This value is a + guidance only, the proper geometry can be + found following the + depends_on axis chain. + </doc> + </field> + + <field name="dead_time" type="NX_FLOAT" units="NX_TIME" minOccurs="0"> + <doc> + Detector dead time + </doc> + </field> + + <field name="count_time" type="NX_NUMBER" units="NX_TIME" minOccurs="0"> + <doc> + Elapsed actual counting time + </doc> + </field> + + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0"> + <doc> + This is the x position where the direct beam would hit the + detector. This is a length and can be outside of the actual + detector. The length can be in physical units or pixels as + documented by the units attribute. + </doc> + </field> + + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0"> + <doc> + This is the y position where the direct beam would hit the + detector. This is a length and can be outside of the actual + detector. The length can be in physical units or pixels as + documented by the units attribute. + </doc> + </field> + + <field name="angular_calibration_applied" type="NX_BOOLEAN" + minOccurs="0"> + <doc> + True when the angular calibration has been applied in the + electronics, false otherwise. + </doc> + </field> + + <field name="angular_calibration" type="NX_FLOAT" minOccurs="0"> + <doc>Angular calibration data.</doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="flatfield_applied" type="NX_BOOLEAN" minOccurs="0"> + <doc> + True when the flat field correction has been applied in the + electronics, false otherwise. + </doc> + </field> + + <field name="flatfield" type="NX_FLOAT" minOccurs="0"> + <doc>Flat field correction data.</doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="flatfield_error" type="NX_FLOAT" minOccurs="0"> + <doc>Errors of the flat field correction data.</doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="pixel_mask_applied" type="NX_BOOLEAN" minOccurs="0"> + <doc> + True when the pixel mask correction has been applied in the + electronics, false otherwise. + </doc> + </field> + + <field name="pixel_mask" type="NX_INT" minOccurs="0"> + <doc> + The 32-bit pixel mask for the detector. + Contains a bit field + for each pixel to signal dead, + blind or high or otherwise unwanted + or undesirable pixels. + They have the following meaning: + + * bit 0: gap (pixel with no sensor) + * bit 1: dead + * bit 2: under responding + * bit 3: over responding + * bit 4: noisy + * bit 5: -undefined- + * bit 6: pixel is part of a cluster of problematic pixels (bit set in addition to others) + * bit 7: -undefined- + * bit 8: user defined mask (e.g. around beamstop) + * bits 9-30: -undefined- + * bit 31: virtual pixel (corner pixel with interpolated value) + + Normal data analysis software would + not take pixels into account + when a bit in (mask & 0x0000FFFF) is + set. Tag bit in the upper + two bytes would indicate special pixel + properties that normally + would not be a sole reason to reject the + intensity value (unless + lower bits are set. + + If the full bit depths is not required, providing a + mask with fewer bits is permissible. + </doc> + <dimensions rank="dataRank"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" required="false"/> + </dimensions> + </field> + + <field name="countrate_correction_applied" type="NX_BOOLEAN" + minOccurs="0"> + <doc> + True when a count-rate correction has already been applied in + the data recorded here, false otherwise. + </doc> + </field> + + <field name="bit_depth_readout" type="NX_INT" minOccurs="0"> + <doc> + How many bits the electronics record per pixel. + </doc> + </field> + + <field name="detector_readout_time" type="NX_FLOAT" units="NX_TIME" + minOccurs="0"> + <doc> + Time it takes to read the detector (typically milliseconds). + This is important to know for time resolved experiments. + </doc> + </field> + + <field name="frame_time" type="NX_FLOAT" units="NX_TIME" + minOccurs="0"> + <doc> + This is time for each frame. This is exposure_time + readout + time. + </doc> + </field> + + <field name="gain_setting" type="NX_CHAR" minOccurs="0"> + <doc> + The gain setting of the detector. This influences background. + </doc> + </field> + + <field name="saturation_value" type="NX_INT" minOccurs="0"> + <doc> + The value at which the detector goes into saturation. + Data + above this value is known to be invalid. + </doc> + </field> + + <field name="sensor_material" type="NX_CHAR" minOccurs="0"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter + like a scintillator. + This is the name of this converter material. + </doc> + </field> + + <field name="sensor_thickness" type="NX_FLOAT" units="NX_LENGTH" + minOccurs="0"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter + like a scintillator. This is the thickness of this + converter + material. + </doc> + </field> + + <field name="threshold_energy" type="NX_FLOAT" units="NX_ENERGY" + minOccurs="0"> + <doc> + Single photon counter detectors can be adjusted for a certain + energy range in which they work optimally. This is the energy + setting for this. + </doc> + </field> + + <field name="type" minOccurs="0"> + <doc> + Description of type such as scintillator, + ccd, pixel, image + plate, CMOS, ... + </doc> + </field> + </group> + </group> + + <group type="NXsample"> + <field name="name" type="NX_CHAR" minOccurs="0"> + <doc>Descriptive name of sample</doc> + </field> + + <field name="depends_on" type="NX_CHAR" minOccurs="0"> + <!-- better type for paths the need to resolve --> + <doc> + This is a requirement to describe for any scan experiment. + The reason it is optional is mainly to accommodate XFEL + single shot exposures. + + The axis on which the sample position depends may be stored + anywhere, but is normally stored in the NXtransformations + NXtransformations group within the NXsample group. + </doc> + </field> + + <group type="NXtransformations" minOccurs="0"> + <doc> + This is the recommended location for sample goniometer + and other related axes. + + This is a requirement to describe for any scan experiment. + The reason it is optional is mainly to accommodate XFEL + single shot exposures. + + Use of the depends_on field and the NXtransformations group is + strongly recommended. As noted above this should be an absolute + requirement to have for any scan experiment. + + The reason it is optional is mainly to accommodate XFEL + single shot exposures. + </doc> + </group> + + <field name="temperature" units="NX_TEMPERATURE" minOccurs="0" /> + + <group type="NXbeam"> + <field name="incident_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH" + minOccurs="0" > + <doc> + In the case of a monchromatic beam this is the scalar + wavelength. + + In the case of a polychromatic beam this is an array of + the wavelengths with the relative weights in + incident_wavelength_weight. + </doc> + </field> + + <field name="incident_wavelength_weight" type="NX_FLOAT" minOccurs="0" > + <doc> + In the case of a polychromatic beam this is an array of the + relative weights of the corresponding wavelengths in + incident_wavelength. + </doc> + </field> + + <field name="incident_wavelength_spread" type="NX_FLOAT" units="NX_WAVELENGTH" + minOccurs="0" > + <doc> + The wavelength spread FWHM for the corresponding + wavelength(s) in incident_wavelength. + </doc> + </field> + + <group name="incident_wavelength_spectrum" type="NXdata" + minOccurs="0" /> + + <field name="flux" type="NX_FLOAT" units="NX_FLUX" minOccurs="0"> + <doc> + flux incident on beam plane area in photons + per second per unit area + </doc> + </field> + + <field name="total_flux" type="NX_FLOAT" units="NX_FREQUENCY" minOccurs="0"> + <doc> + flux incident on beam plane in photons per second + </doc> + </field> + + <field name="incident_beam_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0"> + <doc> + Two-element array of FWHM (if Gaussian or Airy function) or + diameters (if top hat) or widths (if rectangular) of beam + in the order x, y + </doc> + <dimensions rank="1"> + <dim index="1" value="2"/> + </dimensions> + </field> + + <field name="profile" type="NX_CHAR" minOccurs="0"> + <doc> + The beam profile, Gaussian, Airy function, top-hat or + rectangular. The profile is given in the plane of + incidence of the beam on the sample. + </doc> + <enumeration> + <item value="Gaussian"/> + <item value="Airy"/> + <item value="top-hat"/> + <item value="rectangular"/> + </enumeration> + </field> + + + <field name="incident_polarisation_stokes" minOccurs="0"> + <dimensions rank="2"> + <dim index="1" value="np" /> + <dim index="2" value="4" /> + </dimensions> + </field> + </group> + </group> + + <group type="NXdata" /> + </group> +</definition> diff --git a/src/punx/cache/v3.2/applications/NXrefscan.nxdl.xml b/src/punx/cache/v3.3/applications/NXrefscan.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXrefscan.nxdl.xml rename to src/punx/cache/v3.3/applications/NXrefscan.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXreftof.nxdl.xml b/src/punx/cache/v3.3/applications/NXreftof.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXreftof.nxdl.xml rename to src/punx/cache/v3.3/applications/NXreftof.nxdl.xml diff --git a/src/punx/cache/v3.3/applications/NXsas.nxdl.xml b/src/punx/cache/v3.3/applications/NXsas.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..8031f096eafefc4fd1e660b582cc88377aadcca5 --- /dev/null +++ b/src/punx/cache/v3.3/applications/NXsas.nxdl.xml @@ -0,0 +1,181 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsas" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw, monochromatic 2-D SAS data with an area detector + + This is an application definition for raw data (not processed or reduced data) + from a 2-D small angle scattering instrument collected with a monochromatic + beam and an area detector. It is meant to be suitable both for neutron SANS + and X-ray SAXS data. + + It covers all raw data from any monochromatic SAS techniques that + use an area detector: SAS, WSAS, grazing incidence, GISAS + + It covers all raw data from any SAS techniques + that use an area detector + and a monochromatic beam. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc> + NeXus convention is to use ``entry1``, ``entry2``, ... + for analysis software to locate each entry + </doc> + </attribute> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXsas"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <field name="type"> + <doc>type of radiation source</doc> + </field> + <field name="name"> + <doc>Name of the radiation source</doc> + </field> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXmonochromator" name="monochromator"> + <field name="wavelength" units="NX_WAVELENGTH" type="NX_FLOAT"> + <doc>The wavelength of the radiation</doc> + </field> + <field name="wavelength_spread" type="NX_FLOAT"> + <doc> + delta_lambda/lambda (:math:`\Delta\lambda/\lambda`): + Important for resolution calculations + </doc> + </field> + </group> + <group type="NXcollimator" name="collimator"> + <group type="NXgeometry" name="geometry"> + <group type="NXshape" name="shape"> + <field name="shape" type="NX_CHAR"> + <enumeration> + <item value="nxcylinder"/> + <item value="nxbox"/> + </enumeration> + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The collimation length</doc> + </field> + </group> + </group> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_NUMBER" signal="1"> + <doc> + This is area detector data, of number of x-pixel versus + number of y-pixels. Since the beam center is to be + determined as a step of data reduction, it is not necessary + to document or assume the position of the beam center in + acquired data. + </doc> + <dimensions rank="2"> + <dim index="1" value="nXPixel" /> + <dim index="2" value="nYPixel" /> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The distance between detector and sample</doc> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Physical size of a pixel in x-direction</doc> + </field> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Size of a pixel in y direction</doc> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument actually used to perform the experiment</doc> + </field> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> + Count to a preset value based on either clock time + (timer) or received monitor counts (monitor). + </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="integral" type="NX_FLOAT" units="NX_ANY"> + <doc>Total integral monitor counts</doc> + </field> + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link> + </group> + </group> +</definition> diff --git a/src/punx/cache/v3.3/applications/NXsastof.nxdl.xml b/src/punx/cache/v3.3/applications/NXsastof.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..fd9bc6c52135337aeac05abf5a2052a5b8e3579b --- /dev/null +++ b/src/punx/cache/v3.3/applications/NXsastof.nxdl.xml @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsastof" extends="NXobject" type="group" + category="application" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0b" + > + <doc> + raw, 2-D SAS data with an area detector with a time-of-flight source + + It covers all raw data from any SAS techniques + that use an area detector + at a time-of-flight source. + </doc> + <group type="NXentry"> + <attribute name="entry"> + <doc>NeXus convention is to use "entry1", "entry2", ... for analysis software to locate each entry</doc> + </attribute> + <field name="title"/> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="definition"> + <doc> Official NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXsastof"/> + </enumeration> + </field> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="source"> + <field name="type"> + <doc>type of radiation source</doc> + </field> + <field name="name"> + <doc>Name of the radiation source</doc> + </field> + <field name="probe"> + <enumeration> + <item value="neutron"/> + <item value="x-ray"/> + </enumeration> + </field> + </group> + <group type="NXcollimator" name="collimator"> + <group type="NXgeometry" name="geometry"> + <group type="NXshape" name="shape"> + <field name="shape" type="NX_CHAR"> + <enumeration> + <item value="nxcylinder"/> + <item value="nxbox"/> + </enumeration> + </field> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The collimation length</doc> + </field> + </group> + </group> + </group> + <group type="NXdetector" name="detector"> + <field name="data" type="NX_NUMBER" signal="1"> + <doc> + This is area detector data, of number of x-pixel versus + number of y-pixels. Since the beam center is to be + determined as a step of data reduction, it is not necessary + to document or assume the position of the beam center in + acquired data. + </doc> + <dimensions rank="3"> + <dim index="1" value="nXPixel" /> + <dim index="2" value="nYPixel" /> + <dim index="3" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /></dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The distance between detector and sample</doc> + </field> + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Physical size of a pixel in x-direction</doc> + </field> + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Size of a pixel in y direction</doc> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="azimuthal_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. This is a + length, not a pixel position, and can be outside of the actual detector. + </doc> + </field> + </group> + <field name="name" type="NX_CHAR"> + <doc>Name of the instrument actually used to perform the experiment</doc> + </field> + </group> + <group type="NXsample" name="sample"> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="aequatorial_angle" type="NX_FLOAT" + units="NX_ANGLE"> + </field> + </group> + <group type="NXmonitor" name="control"> + <field name="mode"> + <doc> Count to a preset value based on either clock time (timer) or received monitor counts (monitor). </doc> + <enumeration> + <item value="monitor"/> + <item value="timer"/> + </enumeration> + </field> + <field name="preset" type="NX_FLOAT"> + <doc>preset value for time or monitor</doc> + </field> + <field name="data" type="NX_INT" primary="1" signal="1"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + <field name="time_of_flight" units="NX_TIME_OF_FLIGHT" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nTOF" /> + </dimensions> + </field> + + </group> + <group type="NXdata" name="data"> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v3.2/applications/NXscan.nxdl.xml b/src/punx/cache/v3.3/applications/NXscan.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXscan.nxdl.xml rename to src/punx/cache/v3.3/applications/NXscan.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXspe.nxdl.xml b/src/punx/cache/v3.3/applications/NXspe.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXspe.nxdl.xml rename to src/punx/cache/v3.3/applications/NXspe.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXsqom.nxdl.xml b/src/punx/cache/v3.3/applications/NXsqom.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXsqom.nxdl.xml rename to src/punx/cache/v3.3/applications/NXsqom.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXstxm.nxdl.xml b/src/punx/cache/v3.3/applications/NXstxm.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXstxm.nxdl.xml rename to src/punx/cache/v3.3/applications/NXstxm.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtas.nxdl.xml b/src/punx/cache/v3.3/applications/NXtas.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtas.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtas.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtofnpd.nxdl.xml b/src/punx/cache/v3.3/applications/NXtofnpd.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtofnpd.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtofnpd.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtofraw.nxdl.xml b/src/punx/cache/v3.3/applications/NXtofraw.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtofraw.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtofraw.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtofsingle.nxdl.xml b/src/punx/cache/v3.3/applications/NXtofsingle.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtofsingle.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtofsingle.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtomo.nxdl.xml b/src/punx/cache/v3.3/applications/NXtomo.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtomo.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtomo.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtomophase.nxdl.xml b/src/punx/cache/v3.3/applications/NXtomophase.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtomophase.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtomophase.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXtomoproc.nxdl.xml b/src/punx/cache/v3.3/applications/NXtomoproc.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXtomoproc.nxdl.xml rename to src/punx/cache/v3.3/applications/NXtomoproc.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxas.nxdl.xml b/src/punx/cache/v3.3/applications/NXxas.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxas.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxas.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxasproc.nxdl.xml b/src/punx/cache/v3.3/applications/NXxasproc.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxasproc.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxasproc.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxbase.nxdl.xml b/src/punx/cache/v3.3/applications/NXxbase.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxbase.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxbase.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxeuler.nxdl.xml b/src/punx/cache/v3.3/applications/NXxeuler.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxeuler.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxeuler.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxkappa.nxdl.xml b/src/punx/cache/v3.3/applications/NXxkappa.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxkappa.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxkappa.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxlaue.nxdl.xml b/src/punx/cache/v3.3/applications/NXxlaue.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxlaue.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxlaue.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxlaueplate.nxdl.xml b/src/punx/cache/v3.3/applications/NXxlaueplate.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxlaueplate.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxlaueplate.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxnb.nxdl.xml b/src/punx/cache/v3.3/applications/NXxnb.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxnb.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxnb.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/NXxrot.nxdl.xml b/src/punx/cache/v3.3/applications/NXxrot.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/applications/NXxrot.nxdl.xml rename to src/punx/cache/v3.3/applications/NXxrot.nxdl.xml diff --git a/src/punx/cache/v3.2/applications/nxdlformat.xsl b/src/punx/cache/v3.3/applications/nxdlformat.xsl similarity index 100% rename from src/punx/cache/v3.2/applications/nxdlformat.xsl rename to src/punx/cache/v3.3/applications/nxdlformat.xsl diff --git a/src/punx/cache/v3.2/base_classes/NXaperture.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXaperture.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXaperture.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXaperture.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXattenuator.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXattenuator.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXattenuator.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXattenuator.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXbeam.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXbeam.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXbeam.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXbeam.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXbeam_stop.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXbeam_stop.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXbeam_stop.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXbeam_stop.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXbending_magnet.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXbending_magnet.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXbending_magnet.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXbending_magnet.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXcapillary.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXcapillary.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXcapillary.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXcapillary.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXcite.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXcite.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXcite.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXcite.nxdl.xml diff --git a/src/punx/cache/v3.3/base_classes/NXcollection.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXcollection.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..b70e17f191e11a896f31a7eb6511f26dc159d23d --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXcollection.nxdl.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" + category="base" + name="NXcollection" + version="1.0" + type="group" + extends="NXobject" + ignoreExtraGroups="true" + ignoreExtraFields="true" + ignoreExtraAttributes="true" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <!-- + The ignoreExtra* attributes are used in the definition to + avoid warning messages that would be generated from + unexpected groups, fields, and attributes. + Since no groups or attributes are declared here, _every_ + child of this class would generate a warning message without this + attribute being set to "true". + --> + + <doc> + An unvalidated set of terms, such as the description of a beam line. + + Use :ref:`NXcollection` to gather together any set of terms. + The original suggestion is to use this as a container + class for the description of a beamline. + + For NeXus validation, :ref:`NXcollection` will always generate + a warning since it is always an optional group. + Anything (groups, fields, or attributes) placed in + an :ref:`NXcollection` group will not be validated. + </doc> + + <!-- any content is purely optional --> + <!-- + NOTE + ===== + + NXcollection is an unvalidated class, do not add any subgroups. + + See: https://github.com/nexusformat/definitions/issues/259 + --> +</definition> + diff --git a/src/punx/cache/v3.2/base_classes/NXcollimator.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXcollimator.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXcollimator.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXcollimator.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXcrystal.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXcrystal.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXcrystal.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXcrystal.nxdl.xml diff --git a/src/punx/cache/v3.3/base_classes/NXdata.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXdata.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..77fba5497d686d8ac2f2b70677ef6a4661945c9f --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXdata.nxdl.xml @@ -0,0 +1,411 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXdata" + version="1.0" + type="group" + extends="NXobject" + category="base" + ignoreExtraFields="true" + ignoreExtraAttributes="true" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <!-- + The ignoreExtra* attributes are used in the definition to + avoid warning messages that would be generated from unexpected fields or attributes. + Since common use of NXdata indicates field names of any value, _many_ + instances of this class would generate a warning message during validation + without this attribute being set to "true". + --> + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="dataRank"><doc>rank of the ``data`` field</doc></symbol> + <symbol name="n"><doc>length of the ``variable`` field</doc></symbol> + <symbol name="nx"><doc>length of the ``x`` field</doc></symbol> + <symbol name="ny"><doc>length of the ``y`` field</doc></symbol> + <symbol name="nz"><doc>length of the ``z`` field</doc></symbol> + </symbols> + + <attribute name="signal"> + <doc> + .. index:: plotting + + Declares which dataset is the default. + The value is the name of the dataset to be plotted. + A field of this name *must* exist (either as dataset + or as a link to a dataset). + + It is recommended (as of NIAC2014) to use this attribute + rather than adding a signal attribute to the dataset. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> + <attribute name="axes"> + <!-- http://wiki.nexusformat.org/2014_axes_and_uncertainties --> + <doc> + .. index:: plotting + + String array that defines the independent data fields used in + the default plot for all of the dimensions of the *signal* field + (the *signal* field is the field in this group that is named by + the ``signal`` attribute of this group). + One entry is provided for every dimension in the *signal* field. + + The field(s) named as values (known as "axes") of this attribute + *must* exist. An axis slice is specified using a field named + ``AXISNAME_indices`` as described below (where the text shown here + as ``AXISNAME`` is to be replaced by the actual field name). + + When no default axis is available for a particular dimension + of the plottable data, use a "." in that position. + Such as:: + + @I_axes="time", ".", "." + + Since there are three items in the list, the the *signal* field + must must be a three-dimensional array (rank=3). The first dimension + is described by the values of a one-dimensional array named ``time`` + while the other two dimensions have no fields to be used as dimension scales. + + See examples provided on the NeXus wiki: + http://wiki.nexusformat.org/2014_axes_and_uncertainties + + If there are no axes at all (such as with a stack of images), + the axes attribute can be omitted. + </doc> + </attribute> + <attribute name="AXISNAME_indices"> + <!-- + nxdl.xsd rules do not allow us to show this as a variable name + - we'll use ALL CAPS (see #562) + --> + <!-- AXISNAME_indices documentation copied from datarules.rst --> + <doc> + Each ``AXISNAME_indices`` attribute indicates the dependency + relationship of the ``AXISNAME`` field (where ``AXISNAME`` + is the name of a field that exists in this ``NXdata`` group) + with one or more dimensions of the plottable data. + + Integer array that defines the indices of the *signal* field + (that field will be a multidimensional array) + which need to be used in the *AXISNAME* dataset in + order to reference the corresponding axis value. + + The first index of an array is ``0`` (zero). + + Here, *AXISNAME* is to be replaced by the name of each + field described in the ``axes`` attribute. + An example with 2-D data, :math:`d(t,P)`, will illustrate:: + + data_2d:NXdata + @signal="data" + @axes="time","pressure" + @time_indices=0 + @pressure_indices=1 + data: float[1000,20] + time: float[1000] + pressure: float[20] + + This attribute is to be provided in all situations. + However, if the indices attributes are missing + (such as for data files written before this specification), + file readers are encouraged to make their best efforts + to plot the data. + Thus the implementation of the + ``AXISNAME_indices`` attribute is based on the model of + "strict writer, liberal reader". + + .. note:: Attributes potentially containing multiple values + (axes and _indices) are to be written as string or integer arrays, + to avoid string parsing in reading applications. + </doc> + </attribute> + + <doc> + :ref:`NXdata` describes the plottable data and related dimension scales. + + .. index:: plotting + + It is mandatory that there is at least one :ref:`NXdata` group + in each :ref:`NXentry` group. + Note that the ``variable`` and ``data`` + can be defined with different names. + The ``signal`` and ``axes`` attributes of the + ``data`` group define which items + are plottable data and which are *dimension scales*, respectively. + + :ref:`NXdata` is used to implement one of the basic motivations in NeXus, + to provide a default plot for the data of this :ref:`NXentry`. The actual data + might be stored in another group and (hard) linked to the :ref:`NXdata` group. + + * Each :ref:`NXdata` group will define only one data set + containing plottable data, dimension scales, and + possibly associated standard deviations. + Other data sets may be present in the group. + * The plottable data may be of arbitrary rank up to a maximum + of ``NX_MAXRANK=32``. + * The plottable data will be named as the value of + the group ``signal`` attribute, such as:: + + data:NXdata + @signal = "counts" + @axes = "mr" + @mr_indices = 0 + counts: float[100] --> the default dependent data + mr: float[100] --> the default independent data + + The field named in the ``signal`` attribute **must** exist, either + directly as a dataset or defined through a link. + + * The group ``axes`` attribute will name the + *dimension scale* associated with the plottable data. + + If available, the standard deviations of the data are to be + stored in a data set of the same rank and dimensions, with the name ``errors``. + + * For each data dimension, there should be a one-dimensional array + of the same length. + * These one-dimensional arrays are the *dimension scales* of the + data, *i.e*. the values of the independent variables at which the data + is measured, such as scattering angle or energy transfer. + + .. index:: link + .. index:: axes (attribute) + + The preferred method to associate each data dimension with + its respective dimension scale is to specify the field name + of each dimension scale in the group ``axes`` attribute as a string list. + Here is an example for a 2-D data set *data* plotted + against *time*, and *pressure*. (An additional *temperature* data set + is provided and could be selected as an alternate for the *pressure* axis.):: + + data_2d:NXdata + @signal="data" + @axes="time","pressure" + @pressure_indices=1 + @temperature_indices=1 + @time_indices=0 + data: float[1000,20] + pressure: float[20] + temperature: float[20] + time: float[1000] + + .. rubric:: Old methods to identify the plottable data + + There are two older methods of associating + each data dimension to its respective dimension scale. + Both are now out of date and + should not be used when writing new data files. + However, client software should expect to see data files + written with any of these methods. + + * One method uses the ``axes`` + attribute to specify the names of each *dimension scale*. + + * The oldest method uses the ``axis`` attribute on each + *dimension scale* to identify + with an integer the axis whose value is the number of the dimension. + </doc> + <field name="VARIABLE" type="NX_NUMBER" nameType="any"> + <doc> + Dimension scale defining an axis of the data. + Client is responsible for defining the dimensions of the data. + The name of this field may be changed to fit the circumstances. + Standard NeXus client tools will use the attributes to determine + how to use this field. + </doc> + <dimensions rank="1"> + <doc> + A *dimension scale* must have a rank of 1 and has length ``n``. + </doc> + <dim index="1" value="n"/> + </dimensions> + <attribute name="long_name"><doc>Axis label</doc></attribute> + <attribute name="distribution" type="NX_BOOLEAN"> + <doc> + ``0|false``: single value, + ``1|true``: multiple values + </doc> + </attribute> + <attribute name="first_good" type="NX_INT"><doc>Index of first good value</doc></attribute> + <attribute name="last_good" type="NX_INT"><doc>Index of last good value</doc></attribute> + <attribute name="axis" type="NX_POSINT" + deprecated="Use the group ``axes`` attribute (NIAC2014)"> + <doc> + Index (positive integer) identifying this specific set of numbers. + + N.B. The ``axis`` attribute is the old way of designating a link. + Do not use the ``axes`` attribute with the ``axis`` attribute. + The ``axes`` *group* attribute is now preferred. + </doc> + </attribute> + </field> + <field name="VARIABLE_errors" type="NX_NUMBER" nameType="any"> + <doc> + Errors (uncertainties) associated with axis ``VARIABLE``. + Client is responsible for defining the dimensions of the data. + The name of this field may be changed to fit the circumstances + but is matched with the *VARIABLE* + field with ``_errors`` appended. + </doc> + <dimensions rank="1"> + <doc> + A dimension scale must have a rank of 1 and has length ``n``, + same as ``variable``. + </doc> + <dim index="1" value="n"/> + </dimensions> + </field> + <field name="DATA" type="NX_NUMBER" nameType="any"> + <doc> + .. index:: plotting + + This field contains the data values to be used as the + NeXus *plottable data*. + Client is responsible for defining the dimensions of the data. + The name of this field may be changed to fit the circumstances. + Standard NeXus client tools will use the attributes to determine + how to use this field. + </doc> + <dimensions rank="dataRank"> + <doc> + The rank (``dataRank``) of the ``data`` must satisfy + ``1 <= dataRank <= NX_MAXRANK=32``. + At least one ``dim`` must have length ``n``. + </doc> + <dim index="0" value="n"><!-- index="0": cannot know to which dimension this applies a priori --></dim> + </dimensions> + <attribute name="signal" type="NX_POSINT" + deprecated="Use the group ``signal`` attribute (NIAC2014)"> + <doc> + .. index:: plotting + + Plottable (independent) axis, indicate index number. + Only one field in a :ref:`NXdata` group may have the + ``signal=1`` attribute. + Do not use the ``signal`` attribute with the ``axis`` attribute. + </doc> + </attribute> + <attribute name="axes" + deprecated="Use the group ``axes`` attribute (NIAC2014)"> + <doc> + Defines the names of the dimension scales + (independent axes) for this data set + as a colon-delimited array. + NOTE: The ``axes`` attribute is the preferred + method of designating a link. + Do not use the ``axes`` attribute with the ``axis`` attribute. + </doc> + </attribute> + <attribute name="uncertainties"> + <!-- + see http://wiki.nexusformat.org/2014_axes_and_uncertainties + not accepted at NIAC2014 + "NIAC will see a proposal when experience has been gained with all variations." + --> + <doc> + Specify the name (or names) of the uncertainties (errors) + of the dependent axes as plottable data. + NOTE: The ``uncertainties`` attribute uses the same syntax + as the ``axes`` attribute, a string or an array of strings + for multiple uncertainties. + + Examples:: + + @uncertainties="data_errors" + + @uncertainties="Idev" + + @uncertainties="dQw", "dQl" + + </doc> + </attribute> + <attribute name="long_name"> + <doc>data label</doc> + </attribute> + </field> + <field name="errors" type="NX_NUMBER"> + <doc> + Standard deviations of data values - + the data array is identified by the group attribute ``signal``. + The ``errors`` array must have the same dimensions as ``data``. + Client is responsible for defining the dimensions of the data. + </doc> + <dimensions rank="dataRank"> + <doc> + The ``errors`` must have + the same rank (``dataRank``) + as the ``data``. + At least one ``dim`` must have length "n". + </doc> + <dim index="0" value="n"><!-- index="0": cannot know to which dimension this applies a priori --></dim> + </dimensions> + </field> + <field name="scaling_factor" type="NX_FLOAT"> + <doc> + The elements in data are usually float values really. For + efficiency reasons these are usually stored as integers + after scaling with a scale factor. This value is the scale + factor. It is required to get the actual physical value, + when necessary. + </doc> + </field> + <field name="offset" type="NX_FLOAT"> + <doc> + An optional offset to apply to the values in data. + </doc> + </field> + <field name="x" type="NX_FLOAT" units="NX_ANY"> + <doc> + This is an array holding the values to use for the x-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nx" /> + </dimensions> + </field> + <field name="y" type="NX_FLOAT" units="NX_ANY"> + <doc> + This is an array holding the values to use for the y-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="ny" /> + </dimensions> + </field> + <field name="z" type="NX_FLOAT" units="NX_ANY"> + <doc> + This is an array holding the values to use for the z-axis of + data. The units must be appropriate for the measurement. + </doc> + <dimensions rank="1"> + <dim index="1" value="nz" /> + </dimensions> + </field> +</definition> + diff --git a/src/punx/cache/v3.3/base_classes/NXdetector.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXdetector.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4f51aa838ae34b5e027c0987379e6b67dd5ca4c4 --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXdetector.nxdl.xml @@ -0,0 +1,722 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition category="base" extends="NXobject" name="NXdetector" + type="group" version="1.1" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ns="http://definition.nexusformat.org/nxdl/@NXDL_RELEASE@" + > + + <symbols> + <doc>These symbols will be used below to coordinate datasets with the same shape.</doc> + <symbol name="np"><doc>number of scan points (only present in scanning measurements)</doc></symbol> + <symbol name="i"><doc>number of detector pixels in the first (X, slowest) direction</doc></symbol> + <symbol name="j"><doc>number of detector pixels in the second (Y, faster) direction</doc></symbol> + <symbol name="k"><doc>number of detector pixels in the third (Z, if necessary, fastest) direction</doc></symbol> + <symbol name="tof"><doc>number of bins in the time-of-flight histogram</doc></symbol> + </symbols> + + <doc> + A detector, detector bank, or multidetector. + </doc> + + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME_OF_FLIGHT"> + <doc>Total time of flight</doc> + + <dimensions rank="1"> + <dim index="1" value="tof+1" /> + </dimensions> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="3"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>Total time of flight</doc> + </attribute> + </field> + + <field name="raw_time_of_flight" type="NX_INT" units="NX_PULSES"> + <doc>In DAQ clock pulses</doc> + + <dimensions rank="1"> + <dim index="1" value="tof+1" /> + </dimensions> + + <attribute name="frequency" type="NX_NUMBER"> + <doc>Clock frequency in Hz</doc> + </attribute> + </field> + + <field name="detector_number" type="NX_INT"> + <doc>Identifier for detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="data" type="NX_NUMBER" units="NX_ANY"> + <doc>Data values from the detector.</doc> + + <dimensions rank="4"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + <dim index="4" value="tof" /> + </dimensions> + + <attribute name="long_name"> + <doc>Title of measurement</doc> + </attribute> + + <attribute name="check_sum" type="NX_INT"> + <doc>Integral of data as check of data integrity</doc> + </attribute> + + </field> + + <field name="data_error" type="NX_NUMBER" units="NX_ANY"> + <doc> + The best estimate of the uncertainty in the data value. Where + possible, this should be the standard deviation, which has the same units + as the data. + </doc> + + <dimensions rank="4"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + <dim index="4" value="tof" /> + </dimensions> + </field> + + <field name="x_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Offset from the detector center in x-direction. + Can be multidimensional when needed. + </doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>x-axis offset from detector center</doc> + </attribute> + </field> + + <field name="y_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Offset from the detector center in the y-direction. + Can be multidimensional when different values are required for each pixel. + </doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="axis" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="2"/> + </enumeration> + </attribute> + + <attribute name="primary" type="NX_POSINT" + deprecated="see: https://github.com/nexusformat/definitions/issues/436"> + <enumeration> + <item value="1"/> + </enumeration> + </attribute> + + <attribute name="long_name"> + <doc>y-axis offset from detector center</doc> + </attribute> + </field> + + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the distance to the previous component in the + instrument; most often the sample. The usage depends on the + nature of the detector: Most often it is the distance of the + detector assembly. But there are irregular detectors. In this + case the distance must be specified for each detector pixel. + </doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + This is the polar angle of the detector towards the previous + component in the instrument; most often the sample. + The usage depends on the + nature of the detector. + Most often it is the polar_angle of the detector assembly. + But there are irregular detectors. + In this + case, the polar_angle must be specified for each detector pixel. + </doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <doc> + This is the azimuthal angle angle of the detector towards + the previous component in the instrument; most often the sample. + The usage depends on the + nature of the detector. + Most often it is the azimuthal_angle of the detector assembly. + But there are irregular detectors. + In this + case, the azimuthal_angle must be specified for each detector pixel. + </doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="description"> + <doc>name/manufacturer/model/etc. information</doc> + </field> + + <field name="serial_number"> + <doc>Serial number for the detector</doc> + </field> + + <field name="local_name"> + <doc>Local name for the detector</doc> + </field> + + <group type="NXgeometry"> + <doc>Position and orientation of detector</doc> + </group> + + <field name="solid_angle" type="NX_FLOAT" units="NX_SOLID_ANGLE"> + <doc>Solid angle subtended by the detector at the sample</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + Size of each detector pixel. If it is scalar all pixels are the same size. + </doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH"> + <doc>Size of each detector pixel. If it is scalar all pixels are the same size</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="dead_time" type="NX_FLOAT" units="NX_TIME"> + <doc>Detector dead time</doc> + + <dimensions rank="3"> + <dim index="1" value="np" /> + <dim index="2" value="i" /> + <dim index="3" value="j" /> + </dimensions> + </field> + + <field name="gas_pressure" type="NX_FLOAT" units="NX_PRESSURE"> + <doc>Detector gas pressure</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + </field> + + <field name="detection_gas_path" type="NX_FLOAT" units="NX_LENGTH"> + <doc>maximum drift space dimension</doc> + </field> + + <field name="crate" type="NX_INT"> + <doc>Crate number of detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="local_name"> + <doc>Equivalent local term</doc> + </attribute> + </field> + + <field name="slot" type="NX_INT"> + <doc>Slot number of detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="local_name"> + <doc>Equivalent local term</doc> + </attribute> + </field> + + <field name="input" type="NX_INT"> + <doc>Input number of detector</doc> + + <dimensions rank="2"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + </dimensions> + + <attribute name="local_name"> + <doc>Equivalent local term</doc> + </attribute> + </field> + + <field name="type"> + <doc> + Description of type such as He3 gas cylinder, He3 PSD, scintillator, + fission chamber, proportion counter, ion chamber, ccd, pixel, image plate, + CMOS, ... + </doc> + </field> + + <group name="efficiency" type="NXdata"> + <doc>Spectral efficiency of detector with respect to e.g. wavelength</doc> + <attribute name="signal"> + <enumeration> + <item value="efficiency" /> + </enumeration> + </attribute> + <attribute name="axes"> + <enumeration> + <!-- TODO: clarify the various use cases --> + <item value="." /> + <item value=". ." /> + <item value=". . ." /> + <item value=". . . ." /> + <item value="wavelength" /> + </enumeration> + </attribute> + <attribute name="wavelength_indices"> + <enumeration> + <!-- TODO: clarify the actual possibilities --> + <item value="0" /> + </enumeration> + </attribute> + + <field name="efficiency" type="NX_FLOAT" units="NX_DIMENSIONLESS"> + <doc>efficiency of the detector</doc> + + <dimensions rank="3"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" /> + </dimensions> + </field> + + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"> + <doc> + This field can be two things: + + #. For a pixel detector it provides the nominal wavelength + for which the detector has been calibrated. + + #. For other detectors this field has to be seen together with + the efficiency field above. + For some detectors, the efficiency is wavelength dependent. + Thus this field provides the wavelength axis for the efficiency field. + In this use case, the efficiency and wavelength arrays must + have the same dimensionality. + </doc> + + <dimensions rank="3"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" /> + </dimensions> + </field> + + <field name="start_time" type="NX_FLOAT" units="NX_TIME"> + <doc>start time for each frame, with the ``start`` attribute as absolute reference</doc> + <dimensions rank="1"> + <dim index="1" value="np"/> + </dimensions> + <attribute name="start" type="NX_DATE_TIME" /> + </field> + <field name="stop_time" type="NX_FLOAT" units="NX_TIME"> + <doc>stop time for each frame, with the ``start`` attribute as absolute reference</doc> + <dimensions rank="1"> + <dim index="1" value="np"/> + </dimensions> + <attribute name="start" type="NX_DATE_TIME" /> + </field> + + <field name="real_time" type="NX_NUMBER" units="NX_TIME"> + <doc> + real-time of the exposure (use this if exposure time varies for + each array element, otherwise use ``count_time`` field) + </doc> + + <dimensions rank="3"> + <dim index="1" value="i" /> + <dim index="2" value="j" /> + <dim index="3" value="k" /> + </dimensions> + </field> + </group> + + <field name="calibration_date" type="NX_DATE_TIME"> + <doc> + date of last calibration (geometry and/or efficiency) measurements + </doc> + </field> + + <group name="calibration_method" type="NXnote"> + <doc> + summary of conversion of array data to pixels (e.g. polynomial + approximations) and location of details of the calibrations + </doc> + </group> + + <field name="layout"> + <doc>How the detector is represented</doc> + + <enumeration> + <item value="point"/> + <item value="linear"/> + <item value="area"/> + </enumeration> + </field> + + <field name="count_time" type="NX_NUMBER" units="NX_TIME"> + <doc>Elapsed actual counting time</doc> + + <dimensions rank="1"> + <dim index="1" value="np" /> + </dimensions> + </field> + + <group name="data_file" type="NXnote"/> + + <group type="NXcollection"> + <doc> + Use this group to provide other data related to this NXdetector group. + </doc> + </group> + + <field name="sequence_number"> + <doc> + In order to properly sort the order of the images taken in (for + example) a tomography experiment, a sequence number is stored with each + image. + </doc> + + <dimensions rank="1"> + <dim index="1" value="nBrightFrames" /> + </dimensions> + </field> + + <field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the x position where the direct beam would hit the detector. + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. + </doc> + </field> + + <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + This is the y position where the direct beam would hit the detector. + This is a length and can be outside of the actual + detector. The length can be in physical units or pixels + as documented by the units attribute. + </doc> + </field> + + <field name="frame_start_number" type="NX_INT"> + <doc> + This is the start number of the first frame of a scan. In PX one + often scans a couple of frames on a give sample, then does something else, + then returns to the same sample and scans some more frames. Each time with + a new data file. This number helps concatenating such measurements. + </doc> + </field> + + <field name="diameter" type="NX_FLOAT" units="NX_LENGTH"> + <doc>The diameter of a cylindrical detector</doc> + </field> + + <field name="acquisition_mode" type="NX_CHAR"> + <doc>The acquisition mode of the detector.</doc> + <enumeration> + <item value="gated"/> + <item value="triggered"/> + <item value="summed"/> + <item value="event"/> + <item value="histogrammed"/> + <item value="decimated"/> + </enumeration> + </field> + <field name="angular_calibration_applied" type="NX_BOOLEAN" > + <doc> + True when the angular calibration has been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="angular_calibration" type="NX_FLOAT" > + <doc>Angular calibration data.</doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="flatfield_applied" type="NX_BOOLEAN" > + <doc> + True when the flat field correction has been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="flatfield" type="NX_FLOAT" > + <doc>Flat field correction data.</doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="flatfield_error" type="NX_FLOAT" > + <doc>Errors of the flat field correction data.</doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="pixel_mask_applied" type="NX_BOOLEAN" > + <doc> + True when the pixel mask correction has been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="pixel_mask" type="NX_INT" > + <doc> + The 32-bit pixel mask for the detector. + Contains a bit field for each pixel to signal dead, + blind or high or otherwise unwanted or undesirable pixels. + They have the following meaning: + + .. can't make a table here, a bullet list will have to do for now + + * bit 0: gap (pixel with no sensor) + * bit 1: dead + * bit 2: under responding + * bit 3: over responding + * bit 4: noisy + * bit 5: -undefined- + * bit 6: pixel is part of a cluster of problematic pixels (bit set in addition to others) + * bit 7: -undefined- + * bit 8: user defined mask (e.g. around beamstop) + * bits 9-30: -undefined- + * bit 31: virtual pixel (corner pixel with interpolated value) + + The normal data analysis software would not take pixels into + account when a bit in (mask & 0x00FF) is set. + Tag bit in the upper two bytes would indicate special pixel + properties that normally would not be a sole reason to + reject the intensity value (unless lower bits are also set). + </doc> + <dimensions rank="2"> + <dim index="1" value="i"/> + <dim index="2" value="j"/> + </dimensions> + </field> + <field name="countrate_correction__applied" type="NX_BOOLEAN" > + <doc> + True when a count-rate correction has already been applied in the + electronics, false otherwise. + </doc> + </field> + <field name="bit_depth_readout" type="NX_INT"> + <doc> + How many bits the electronics reads per pixel. + With CCD's and single photon counting detectors, + this must not align with traditional integer sizes. + This can be 4, 8, 12, 14, 16, ... + </doc> + </field> + <field name="detector_readout_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time it takes to read the detector (typically milliseconds). + This is important to know for time resolved experiments. + </doc> + </field> + <field name="trigger_delay_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time it takes to start exposure after a trigger signal has been received. + This is the reaction time of the detector firmware after receiving the trigger signal + to when the detector starts to acquire the exposure, including any user set delay.. + This is important to know for time resolved experiments. + </doc> + </field> + <field name="trigger_delay_time_set" type="NX_FLOAT" units="NX_TIME"> + <doc> + User-specified trigger delay. + </doc> + </field> + <field name="trigger_internal_delay_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time it takes to start exposure after a trigger signal has been received. + This is the reaction time of the detector hardware after receiving the + trigger signal to when the detector starts to acquire the exposure. + It forms the lower boundary of the trigger_delay_time when the user + does not request an additional delay. + </doc> + </field> + <field name="trigger_dead_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time during which no new trigger signal can be accepted. + Typically this is the + trigger_delay_time + exposure_time + readout_time. + This is important to know for time resolved experiments. + </doc> + </field> + <field name="frame_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + This is time for each frame. This is exposure_time + readout time. + </doc> + <dimensions rank="1"> + <dim index="1" value="NP" /> + </dimensions> + </field> + <field name="gain_setting" type="NX_CHAR"> + <doc>The gain setting of the detector. This influences background etc.</doc> + <enumeration> + <item value="high"/> + <item value="standard"/> + <item value="fast"/> + <item value="auto"/> + </enumeration> + </field> + <field name="saturation_value" type="NX_INT"> + <doc> + The value at which the detector goes into saturation. + Especially common to CCD detectors, the data + is known to be invalid above this value. + </doc> + </field> + <field name="number_of_cycles" type="NX_INT"> + <doc> + CCD images are sometimes constructed by summing + together multiple short exposures in the + electronics. This reduces background etc. + This is the number of short exposures used to sum + images for an image. + </doc> + </field> + <field name="sensor_material" type="NX_CHAR"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter like a scintillator. + This is the name of this converter material. + </doc> + </field> + <field name="sensor_thickness" type="NX_FLOAT" units="NX_LENGTH"> + <doc> + At times, radiation is not directly sensed by the detector. + Rather, the detector might sense the output from some + converter like a scintillator. + This is the thickness of this converter material. + </doc> + </field> + <field name="threshold_energy" type="NX_FLOAT" units="NX_ENERGY"> + <doc> + Single photon counter detectors can be adjusted + for a certain energy range in which they + work optimally. This is the energy setting for this. + </doc> + </field> + <group type="NXdetector_module"> + <doc> + For use in special cases where the data in NXdetector + is represented in several parts, each with a separate geometry. + + Use one or more instances of the NXdetector_module + group to declare regions of interest or some other + subdivision of a detector. + </doc> + </group> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXdetector_group.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXdetector_group.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXdetector_group.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXdetector_group.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXdetector_module.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXdetector_module.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXdetector_module.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXdetector_module.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXdisk_chopper.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXdisk_chopper.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXdisk_chopper.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXdisk_chopper.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXentry.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXentry.nxdl.xml similarity index 93% rename from src/punx/cache/v3.2/base_classes/NXentry.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXentry.nxdl.xml index 8e788361d76dc7061f4df6965151f626be184e91..0cedd9767af0607b1c4b2e4f4bf0f0dd89d102cb 100644 --- a/src/punx/cache/v3.2/base_classes/NXentry.nxdl.xml +++ b/src/punx/cache/v3.3/base_classes/NXentry.nxdl.xml @@ -40,10 +40,11 @@ It is needed to resolve ambiguity when more than one :ref:`NXdata` group exists. The value is the name of the default :ref:`NXdata` group. - It is recommended (as of NIAC2014) to use this attribute + It is recommended (as of NIAC2014 [#]_) to use this attribute to help define the path to the default dataset to be plotted. - See http://wiki.nexusformat.org/2014_How_to_find_default_data - for a summary of the discussion. + + .. [#] NIAC2014 discussion summary: + http://wiki.nexusformat.org/2014_How_to_find_default_data </doc> </attribute> @@ -59,7 +60,7 @@ <doc> The data group - .. note:: Before the NIAC2016 meeting [#], at least one + .. note:: Before the NIAC2016 meeting [#]_, at least one :ref:`NXdata` group was required in each :ref:`NXentry` group. At the NIAC2016 meeting, it was decided to make :ref:`NXdata` an optional group in :ref:`NXentry` groups for data files that @@ -80,8 +81,9 @@ :ref:`NXdata` group is optional, otherwise, it is required. - .. [#] NIAC2016: http://wiki.nexusformat.org/NIAC2016, - https://github.com/nexusformat/NIAC/issues/16 + .. [#] NIAC2016: + http://wiki.nexusformat.org/NIAC2016, + https://github.com/nexusformat/NIAC/issues/16 </doc> </group> @@ -117,7 +119,7 @@ </field> <field name="features"> <doc> - Reserved for furture use by NIAC. + Reserved for future use by NIAC. See https://github.com/nexusformat/definitions/issues/382 </doc> @@ -205,7 +207,6 @@ </enumeration> </attribute> </group> - <group type="NXcharacterization" /><!-- TODO: consider using NXcollection instead, see https://github.com/nexusformat/definitions/issues/177--> <group type="NXuser" /> <group type="NXsample" /> <group type="NXinstrument" /> diff --git a/src/punx/cache/v3.2/base_classes/NXenvironment.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXenvironment.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXenvironment.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXenvironment.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXevent_data.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXevent_data.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXevent_data.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXevent_data.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXfermi_chopper.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXfermi_chopper.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXfermi_chopper.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXfermi_chopper.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXfilter.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXfilter.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXfilter.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXfilter.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXflipper.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXflipper.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXflipper.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXflipper.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXfresnel_zone_plate.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXfresnel_zone_plate.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXfresnel_zone_plate.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXfresnel_zone_plate.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXgeometry.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXgeometry.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXgeometry.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXgeometry.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXgrating.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXgrating.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXgrating.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXgrating.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXguide.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXguide.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXguide.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXguide.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXinsertion_device.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXinsertion_device.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXinsertion_device.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXinsertion_device.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXinstrument.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXinstrument.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXinstrument.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXinstrument.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXlog.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXlog.nxdl.xml similarity index 88% rename from src/punx/cache/v3.2/base_classes/NXlog.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXlog.nxdl.xml index 9b42a1721696f8d9130e8853c9ab60afe85be29f..1fae060fd1e1bb60625450f8216abd3dc5a1c73b 100644 --- a/src/punx/cache/v3.2/base_classes/NXlog.nxdl.xml +++ b/src/punx/cache/v3.3/base_classes/NXlog.nxdl.xml @@ -53,21 +53,14 @@ This method of storing logged data helps to distinguish instances in which a variable is a dimension scale of the data, in which case it is stored in an :ref:`NXdata` group, and instances in which it is logged during the - run, when it should be stored in an :ref:`NXlog` - group. - - - Note: When using multiple :ref:`NXlog` groups, it is suggested to place - them inside a :ref:`NXcollection` group. In such cases, when - :ref:`NXlog` is used in another class, - :ref:`NXcollection`/:ref:`NXlog` is then constructed. + run, when it should be stored in an :ref:`NXlog` group. In order to make random access to timestamped data faster there is an optional array pair of - cue_timestamp_zero and cue_index. The cue_timestamp_zero will - contain courser timestamps then in the time array, say - every five minutes. The cue_index will then contain the + ``cue_timestamp_zero`` and ``cue_index``. The ``cue_timestamp_zero`` will + contain coarser timestamps than in the time array, say + every five minutes. The ``cue_index`` will then contain the index into the time,value pair of arrays for that - courser cue_timestamp_zero. + coarser ``cue_timestamp_zero``. </doc> <field name="time" type="NX_FLOAT" units="NX_TIME"> @@ -75,7 +68,7 @@ Time of logged entry. The times are relative to the "start" attribute and in the units specified in the "units" attribute. Please note that absolute - timestamps under unix are relative to 1.1.1970:00:00. + timestamps under unix are relative to ``1970-01-01T:00:00``. </doc> <attribute name="start" type="NX_DATE_TIME" /> <attribute name="scaling" type="NX_NUMBER"/> diff --git a/src/punx/cache/v3.2/base_classes/NXmirror.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXmirror.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXmirror.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXmirror.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXmoderator.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXmoderator.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXmoderator.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXmoderator.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXmonitor.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXmonitor.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXmonitor.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXmonitor.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXmonochromator.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXmonochromator.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXmonochromator.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXmonochromator.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXnote.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXnote.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXnote.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXnote.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXobject.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXobject.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXobject.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXobject.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXorientation.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXorientation.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXorientation.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXorientation.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXparameters.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXparameters.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXparameters.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXparameters.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXpinhole.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXpinhole.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXpinhole.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXpinhole.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXpolarizer.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXpolarizer.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXpolarizer.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXpolarizer.nxdl.xml diff --git a/src/punx/cache/v3.3/base_classes/NXpositioner.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXpositioner.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..422e61fd68f9094cc53ecd626a65955ee89e8ecb --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXpositioner.nxdl.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition + name="NXpositioner" + version="1.0" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + <doc> + A generic positioner such as a motor or piezo-electric transducer. + </doc> + <field name="name"> + <doc>symbolic or mnemonic name (one word)</doc> + </field> + <field name="description"> + <doc>description of positioner</doc> + </field> + <field name="value" type="NX_NUMBER" units="NX_ANY"> + <doc>best known value of positioner - need [n] as may be scanned</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="raw_value" type="NX_NUMBER" units="NX_ANY"> + <doc>raw value of positioner - need [n] as may be scanned</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="target_value" type="NX_NUMBER" units="NX_ANY"> + <doc>targeted (commanded) value of positioner - need [n] as may be scanned</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="tolerance" type="NX_NUMBER" units="NX_ANY"> + <doc>maximum allowable difference between target_value and value</doc> + <dimensions rank="1"><dim index="1" value="n"/></dimensions> + </field> + <field name="soft_limit_min" type="NX_NUMBER" units="NX_ANY"> + <doc>minimum allowed limit to set value</doc> + </field> + <field name="soft_limit_max" type="NX_NUMBER" units="NX_ANY"> + <doc>maximum allowed limit to set value</doc> + </field> + <field name="velocity" type="NX_NUMBER" units="NX_ANY"> + <doc>velocity of the positioner (distance moved per unit time)</doc> + </field> + <field name="acceleration_time" type="NX_NUMBER" units="NX_ANY"> + <doc>time to ramp the velocity up to full speed</doc> + </field> + <!-- TODO other parameters: settling time, backlash, link to readback channel --> + <field name="controller_record"> + <doc>Hardware device record, e.g. EPICS process variable, taco/tango ...</doc> + </field> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXprocess.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXprocess.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXprocess.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXprocess.nxdl.xml diff --git a/src/punx/cache/v3.3/base_classes/NXreflections.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXreflections.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..18a3ad30b277ef9a22f03b19996adf8140e74a51 --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXreflections.nxdl.xml @@ -0,0 +1,556 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NXreflections: candidate NeXus definition for reflection data +--> +<definition type="group" name="NXreflections" category="base" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.1" + > + <symbols> + <symbol name="n"><doc>number of reflections</doc></symbol> + <symbol name="m"><doc>number of experiments</doc></symbol> + </symbols> + <doc>This is a definition for reflection data from diffraction experiments </doc> + <group type="NXentry" minOccurs="1"> + + <field name="definition"> + <doc>NeXus NXDL schema to which this file conforms </doc> + <enumeration> + <item value="NXreflections" /> + </enumeration> + </field> + + <field name="experiments" minOccurs="1"> + <doc>The experiments from which the reflection data derives </doc> + <dimensions rank="1"> + <dim index="1" value="m" /> + </dimensions> + </field> + + <field name="h" type="NX_NUMBER" minOccurs="1"> + <doc>The h component of the miller index </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="k" type="NX_NUMBER" minOccurs="1"> + <doc>The k component of the miller index </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="l" type="NX_NUMBER" minOccurs="1"> + <doc>The l component of the miller index </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="id" type="NX_INT" minOccurs="1"> + <doc> + The id of the experiment which resulted in the reflection. If the value + is greater than 0, the experiments must link to a multi-experiment NXmx + group + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="reflection_id" type="NX_INT" minOccurs="1"> + <doc> + The id of the reflection. Multiple partials from the same reflection + should all have the same id + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + <field name="entering" type="NX_BOOLEAN" minOccurs="1"> + <doc>Is the reflection entering or exiting the Ewald sphere </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="det_module" type="NX_INT" minOccurs="1"> + <doc>The detector module on which the reflection was recorded </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="flags" type="NX_INT" minOccurs="1"> + <doc> + Status flags describing the reflection. + + This is a bit mask. The bits in the mask follow the convention + used by DIALS, and have the following names: + + === ========================================== + bit name + === ========================================== + 0 ``predicted`` + 1 ``observed`` + 2 ``indexed`` + 3 ``used_in_refinement`` + 4 ``strong`` + 5 ``reference_spot`` + 6 ``dont_integrate`` + 7 ``integrated_sum`` + 8 ``integrated_prf`` + 9 ``integrated`` + 10 ``overloaded`` + 11 ``overlapped`` + 12 ``overlapped_fg`` + 13 ``in_powder_ring`` + 14 ``foreground_includes_bad_pixels`` + 15 ``background_includes_bad_pixels`` + 16 ``includes_bad_pixels`` + 17 ``bad_shoebox`` + 18 ``bad_spot`` + 19 ``used_in_modelling`` + 20 ``centroid_outlier`` + 21 ``failed_during_background_modelling`` + 22 ``failed_during_summation`` + 23 ``failed_during_profile_fitting`` + 24 ``bad_reference`` + === ========================================== + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="d" type="NX_FLOAT" minOccurs="1"> + <doc>The resolution of the reflection </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="partiality" type="NX_FLOAT" minOccurs="1"> + <doc> + The partiality of the reflection. + Dividing by this number will inflate the measured + intensity to the full reflection equivalent. + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_frame" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The frame on which the bragg peak of the reflection is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The x position at which the bragg peak of the reflection + is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The y position at which the bragg peak of the reflection + is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_phi" type="NX_FLOAT" units="NX_ANGLE" minOccurs="1"> + <doc> + The phi angle at which the bragg peak of the reflection is predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_px_x" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The x pixel position at which the bragg peak of the reflection is + predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="predicted_px_y" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The y pixel position at which the bragg peak of the reflection is + predicted + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_frame" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The estimate of the frame at which the central impact of the + reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_frame_var" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The variance on the estimate of the frame at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_x" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The estimate of the pixel x position at which the central impact of + the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_x_var" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The variance on the estimate of the pixel x position at which the + central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_y" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The estimate of the pixel y position at which the central impact of + the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_px_y_var" type="NX_FLOAT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The variance on the estimate of the pixel y position at which the + central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_phi" type="NX_FLOAT" units="NX_ANGLE" minOccurs="1"> + <doc> + The estimate of the phi angle at which the central impact of the + reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_phi_var" type="NX_FLOAT" units="NX_ANGLE" minOccurs="1"> + <doc> + The variance on the estimate of the phi angle at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The estimate of the x position at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_x_var" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The variance on the estimate of the x position at which + the central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The estimate of the y position at which the central + impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="observed_y_var" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1"> + <doc> + The variance on the estimate of the y position at which + the central impact of the reflection was recorded + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="bounding_box" type="NX_INT" units="NX_UNITLESS" minOccurs="1"> + <doc> + The bounding box around the recorded recorded reflection. + Should be an integer array of length 6, where the 6 values + are pixel positions or frame numbers, as follows: + + ===== =========================== + index meaning + ===== =========================== + 0 The lower pixel x position + 1 The upper pixel x position + 2 The lower pixel y position + 3 The upper pixel y position + 4 The lower frame number + 5 The upper frame number + ===== =========================== + </doc> + <dimensions rank="2"> + <dim index="1" value="n" /> + <dim index="2" value="6" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="background_mean" type="NX_FLOAT" minOccurs="1"> + <doc> + The mean background under the reflection peak + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_prf" type="NX_FLOAT" minOccurs="0"> + <doc> + The estimate of the reflection intensity by profile fitting + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_prf_var" type="NX_FLOAT" minOccurs="0"> + <doc> + The variance on the estimate of the reflection intensity by profile + fitting + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_sum" type="NX_FLOAT" minOccurs="1"> + <doc>The estimate of the reflection intensity by summation </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="int_sum_var" type="NX_FLOAT" minOccurs="1"> + <doc> + The variance on the estimate of the reflection intensity by + summation + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="lp" type="NX_FLOAT" minOccurs="1"> + <doc> + The LP correction factor to be applied to the reflection intensities + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="prf_cc" type="NX_FLOAT" minOccurs="0"> + <doc> + The correlation of the reflection profile with the reference profile + used in profile fitting + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="overlaps" type="NX_INT" minOccurs="0"> + <doc> + An adjacency list specifying the spatial overlaps of reflections. The + adjacency list is specified using an array data type where the elements + of the array are the indices of the adjacent overlapped reflection + </doc> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE" minOccurs="0"> + <doc> + Polar angle of reflection centroid, following the NeXus simple (spherical polar) coordinate system + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </field> + + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE" minOccurs="0"> + <doc> + Azimuthal angle of reflection centroid, following the NeXus simple (spherical polar) coordinate system + </doc> + <dimensions rank="1"> + <dim index="1" value="n" /> + </dimensions> + </field> + <attribute name="description"> + <doc>Describes the dataset </doc> + </attribute> + </group> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXroot.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXroot.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXroot.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXroot.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXsample.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXsample.nxdl.xml similarity index 96% rename from src/punx/cache/v3.2/base_classes/NXsample.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXsample.nxdl.xml index b64e54c732a6974adc51b0cf9bb425a90b8fbf59..ad2787dc3965d280ec310e56d7128af86d5801de 100644 --- a/src/punx/cache/v3.2/base_classes/NXsample.nxdl.xml +++ b/src/punx/cache/v3.3/base_classes/NXsample.nxdl.xml @@ -170,6 +170,20 @@ <dim index="3" value="3"/> </dimensions> </field> + <field name="ub_matrix" type="NX_FLOAT"> + <doc> + UB matrix of single crystal sample using Busing-Levy convention: + W. R. Busing and H. A. Levy (1967). Acta Cryst. 22, 457-464. This is + the multiplication of the orientation_matrix, given above, + with the :math:`B` matrix which + can be derived from the lattice constants. + </doc> + <dimensions rank="3"> + <dim index="1" value="n_comp"/> + <dim index="2" value="3"/> + <dim index="3" value="3"/> + </dimensions> + </field> <field name="mass" type="NX_FLOAT" units="NX_MASS"> <doc>Mass of sample</doc> <dimensions rank="1"> diff --git a/src/punx/cache/v3.2/base_classes/NXsample_component.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXsample_component.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXsample_component.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXsample_component.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXsensor.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXsensor.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXsensor.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXsensor.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXshape.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXshape.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXshape.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXshape.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXslit.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXslit.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXslit.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXslit.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXsource.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXsource.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXsource.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXsource.nxdl.xml diff --git a/src/punx/cache/v3.3/base_classes/NXsubentry.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXsubentry.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..ec949cd00be870d0381393681bd51f7105493187 --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXsubentry.nxdl.xml @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition name="NXsubentry" + version="1.0" + type="group" + extends="NXobject" + category="base" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <attribute name="default"> + <doc> + .. index:: plotting + + Declares which :ref:`NXdata` group contains the data + to be shown by default. + It is needed to resolve ambiguity when more than + one :ref:`NXdata` group exists. + The value is the name of the default :ref:`NXdata` group. + + It is recommended (as of NIAC2014) to use this attribute + to help define the path to the default dataset to be plotted. + See http://wiki.nexusformat.org/2014_How_to_find_default_data + for a summary of the discussion. + </doc> + </attribute> + + <doc> + Group of multiple application definitions for "multi-modal" (e.g. SAXS/WAXS) measurements. + + ``NXsubentry`` is a base class virtually identical to :ref:`NXentry` + and is used as the (overlay) location for application definitions. + Use a separate ``NXsubentry`` for each application definition. + + To use ``NXsubentry`` with a hypothetical application definition + called ``NXmyappdef``: + + * Create a group with attribute ``NX_class="NXsubentry"`` + * Within that group, create a field called ``definition="NXmyappdef"``. + * There are two optional attributes of definition: ``version`` and ``URL`` + + The intended use is to define application definitions for a + multi-modal (a.k.a. multi-technique) :ref:`NXentry`. + Previously, an application definition + replaced :ref:`NXentry` with its own definition. + With the increasing popularity of instruments combining + multiple techniques for data collection (such as SAXS/WAXS instruments), + it was recognized the application definitions must be entered in the NeXus + data file tree as children of :ref:`NXentry`. + </doc> + + <attribute name="IDF_Version"> + <!-- as ratified at NIAC2010 --> + <doc>ISIS Muon IDF_Version</doc> + </attribute> + + <field name="title"> + <doc>Extended title for entry</doc> + </field> + <field name="experiment_identifier"> + <doc> + Unique identifier for the experiment, defined by + the facility, possibly linked to the proposals + </doc> + </field> + <field name="experiment_description"> + <doc>Brief summary of the experiment, including key objectives.</doc> + </field> + <group type="NXnote" name="experiment_documentation"> + <doc>Description of the full experiment (document in pdf, latex, ...)</doc> + </group> + <field name="collection_identifier"> + <doc>User or Data Acquisition defined group of NeXus files or :ref:`NXentry`</doc> + </field> + <field name="collection_description"> + <doc>Brief summary of the collection, including grouping criteria.</doc> + </field> + <field name="entry_identifier"> + <doc>unique identifier for the measurement, defined by the facility.</doc> + </field> + <field name="definition"> + <doc>Official NeXus NXDL schema to which this subentry conforms</doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="definition_local"> + <doc> + Local NXDL schema extended from the subentry + specified in the ``definition`` field. + This contains any locally-defined, + additional fields in the subentry. + </doc> + <attribute name="version"><doc>NXDL version number</doc></attribute> + <attribute name="URL"><doc>URL of NXDL file</doc></attribute> + </field> + <field name="start_time" type="NX_DATE_TIME"> + <doc>Starting time of measurement</doc> + </field> + <field name="end_time" type="NX_DATE_TIME"> + <doc>Ending time of measurement</doc> + </field> + <field name="duration" type="NX_INT" units="NX_TIME"> + <doc>Duration of measurement</doc> + </field> + <field name="collection_time" type="NX_FLOAT" units="NX_TIME"> + <doc> + Time transpired actually collecting data i.e. taking out time when collection was + suspended due to e.g. temperature out of range + </doc> + </field> + <field name="run_cycle"> + <doc>Such as "2007-3". Some user facilities organize their beam time into run cycles.</doc> + </field> + <field name="program_name"> + <doc>Name of program used to generate this file</doc> + <attribute name="version"><doc>Program version number</doc></attribute> + <attribute name="configuration"><doc>configuration of the program</doc></attribute> + </field> + <field name="revision"> + <doc> + Revision id of the file due to re-calibration, reprocessing, new analysis, new + instrument definition format, ... + </doc> + <attribute name="comment"/> + </field> + <field name="pre_sample_flightpath" type="NX_FLOAT" + units="NX_LENGTH"> + <doc> + This is the flightpath before the sample position. This can be determined by a chopper, + by the moderator or the source itself. In other words: it the distance to the component + which gives the T0 signal to the detector electronics. If another component in the + NXinstrument hierarchy provides this information, this should be a link. + </doc> + </field> + <group name="notes" type="NXnote"> + <doc>Notes describing entry</doc> + </group> + <group name="thumbnail" type="NXnote"> + <doc> + A small image that is representative of the entry. An example of this is a 640x480 + jpeg image automatically produced by a low resolution plot of the NXdata. + </doc> + <attribute name="mime_type"> + <doc>The value should be an ``image/*``</doc> + <enumeration> + <!-- + This is not perfect. + How do we set a default value for the mime_type attribute? + --> + <item value="image/*" /> + </enumeration> + </attribute> + </group> + <group type="NXuser" /> + <group type="NXsample" /> + <group type="NXinstrument" /> + <group type="NXcollection" /> + <group type="NXmonitor" /> + <group type="NXdata" /> + <group type="NXparameters" /> + <group type="NXprocess" /> +</definition> + diff --git a/src/punx/cache/v3.3/base_classes/NXtransformations.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXtransformations.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..d3e9027bc7acd1eff1bc9f6d03df247be27ebbc0 --- /dev/null +++ b/src/punx/cache/v3.3/base_classes/NXtransformations.nxdl.xml @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- +# NeXus - Neutron and X-ray Common Data Format +# +# Copyright (C) 2014-2017 NeXus International Advisory Committee (NIAC) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# For further information, see http://www.nexusformat.org +--> +<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" + category="base" + name="NXtransformations" + version="1.1" + type="group" + extends="NXobject" + ignoreExtraGroups="true" + ignoreExtraFields="true" + ignoreExtraAttributes="true" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + > + + <doc> + Collection of axis-based translations and rotations to describe a geometry. + May also contain axes that do not move and therefore do not have a transformation + type specified, but are useful in understanding coordinate frames within which + transformations are done, or in documenting important directions, such as the + direction of gravity. + + A nested sequence of transformations lists the offset and rotation steps + needed to describe the position and orientation of any movable or fixed device. + + There will be one or more transformations (axes) defined by one or more fields + for each transformation. The all-caps name ``AXISNAME`` designates the + particular axis generating a transformation (e.g. a rotation axis or a translation + axis or a general axis). The attribute ``units="NX_TRANSFORMATION"`` designates the + units will be appropriate to the ``transformation_type`` attribute: + + * ``NX_LENGTH`` for ``translation`` + * ``NX_ANGLE`` for ``rotation`` + * ``NX_UNITLESS`` for axes for which no transformation type is specified + + This class will usually contain all axes of a sample stage or goniometer or + a detector. The NeXus default McSTAS coordinate frame is assumed, but additional + useful coordinate axes may be defined by using axes for which no transformation + type has been specified. + + The entry point (``depends_on``) will be outside of this class and point to a + field in here. Following the chain may also require following ``depends_on`` + links to transformations outside, for example to a common base table. If + a relative path is given, it is relative to the group enclosing the ``depends_on`` + specification. + + For a chain of three transformations, where :math:`T_1` depends on :math:`T_2` + and that in turn depends on :math:`T_3`, the final transformation :math:`T_f` is + + .. math:: + + T_f = T_3 T_2 T_1 + + In explicit terms, the transformations are a subset of affine transformations + expressed as 4x4 matrices that act on homogeneous coordinates, :math:`w=(x,y,z,1)^T`. + + For rotation and translation, + + .. math:: + + T_r &= \left( \begin{matrix} R & o \\ + 0_3 & 1 \end{matrix} \right) \\ + T_t &= \left( \begin{matrix} I_3 & t + o \\ + 0_3 & 1 \end{matrix} \right) + + where :math:`R` is the usual 3x3 rotation matrix, :math:`o` is an offset vector, + :math:`0_3` is a row of 3 zeros, :math:`I_3` is the 3x3 identity matrix and + :math:`t` is the translation vector. + + :math:`o` is given the ``offset`` attribute, :math:`t` is given by the ``vector`` + attribute multiplied by the field value, and :math:`R` is defined as a rotation + about an axis in the direction of ``vector``, of angle of the field value. + </doc> + <field name="AXISNAME" nameType="any" units="NX_TRANSFORMATION" type="NX_NUMBER" maxOccurs="unbounded"> + <doc> + Units need to be appropriate for translation or rotation + + The name of this field is not forced. The user is free to use any name + that does not cause confusion. When using more than one ``AXISNAME`` field, + make sure that each field name is unique in the same group, as required + by HDF5. + + The values given should be the start points of exposures for the corresponding + frames. The end points should be given in ``AXISNAME_end``. + </doc> + <attribute name="transformation_type" optional="true"> + <doc> + The transformation_type may be ``translation``, in which case the + values are linear displacements along the axis, ``rotation``, + in which case the values are angular rotations around the axis. + + If this attribute is omitted, this is an axis for which there + is no motion to be specifies, such as the direction of gravity, + or the direction to the source, or a basis vector of a + coordinate frame. + </doc> + <enumeration> + <item value="translation" /> + <item value="rotation" /> + <!-- <item value="general" /> --> + </enumeration> + </attribute> + <attribute name="vector" type="NX_NUMBER"> + <doc> + Three values that define the axis for this transformation. + The axis should be normalized to unit length, making it + dimensionless. For ``rotation`` axes, the direction should be + chosen for a right-handed rotation with increasing angle. + For ``translation`` axes the direction should be chosen for + increasing displacement. + </doc> + <dimensions rank="1"> + <dim index="1" value="3" /> + </dimensions> + </attribute> + <attribute name="offset" type="NX_NUMBER"> + <doc> + A fixed offset applied before the transformation (three vector components). + </doc> + <dimensions rank="1"> + <dim index="1" value="3" /> + </dimensions> + </attribute> + <attribute name="offset_units" type="NX_CHAR"> + <doc> + Units of the offset. Values should be consistent with NX_LENGTH. + </doc> + </attribute> + <attribute name="depends_on" type="NX_CHAR"> + <doc> + Points to the path to a field defining the axis on which this + depends or the string ".". + </doc> + </attribute> + </field> + <field name="AXISNAME_end" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0"> + <doc> + ``AXISNAME_end`` is a placeholder for a name constructed from the actual + name of an axis to which ``_end`` has been appended. + + The values in this field are the end points of the motions that start + at the corresponding positions given in the ``AXISNAME`` field. + </doc> + </field> + <field name="AXISNAME_increment_set" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0"> + <doc> + ``AXISNAME_increment_set`` is a placeholder for a name constructed from the actual + name of an axis to which ``_increment_set`` has been appended. + + The value of this optional field is the intended average range through which + the corresponding axis moves during the exposure of a frame. Ideally, the + value of this field added to each value of ``AXISNAME`` would agree with the + corresponding values of ``AXISNAME_end``, but there is a possibility of significant + differences. Use of ``AXISNAME_end`` is recommended. + </doc> + </field> +</definition> diff --git a/src/punx/cache/v3.2/base_classes/NXtranslation.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXtranslation.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXtranslation.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXtranslation.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXuser.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXuser.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXuser.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXuser.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXvelocity_selector.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXvelocity_selector.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXvelocity_selector.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXvelocity_selector.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/NXxraylens.nxdl.xml b/src/punx/cache/v3.3/base_classes/NXxraylens.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/base_classes/NXxraylens.nxdl.xml rename to src/punx/cache/v3.3/base_classes/NXxraylens.nxdl.xml diff --git a/src/punx/cache/v3.2/base_classes/nxdlformat.xsl b/src/punx/cache/v3.3/base_classes/nxdlformat.xsl similarity index 100% rename from src/punx/cache/v3.2/base_classes/nxdlformat.xsl rename to src/punx/cache/v3.3/base_classes/nxdlformat.xsl diff --git a/src/punx/cache/v3.2/contributed_definitions/NXcontainer.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXcontainer.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXcontainer.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXcontainer.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXelectrostatic_kicker.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXelectrostatic_kicker.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXelectrostatic_kicker.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXelectrostatic_kicker.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXmagnetic_kicker.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXmagnetic_kicker.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXmagnetic_kicker.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXmagnetic_kicker.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXquadrupole_magnet.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXquadrupole_magnet.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXquadrupole_magnet.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXquadrupole_magnet.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXseparator.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXseparator.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXseparator.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXseparator.nxdl.xml diff --git a/src/punx/cache/v3.3/contributed_definitions/NXsnsevent.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXsnsevent.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..c98f6f39dbab652727c1e6d3f631b91e134e5c41 --- /dev/null +++ b/src/punx/cache/v3.3/contributed_definitions/NXsnsevent.nxdl.xml @@ -0,0 +1,325 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NXsnsevent: candidate NeXus definition for event data from Spallation Neutron Source (SNS) at ORNL. +--> +<definition type="group" name="NXsnsevent" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0" + > + <doc>This is a definition for event data from Spallation Neutron Source (SNS) at ORNL.</doc> + <group type="NXentry" minOccurs="1"> + <group type="NXcollection" name="DASlogs"> + <doc> + Details of all logs, both from cvinfo file and from HistoTool (frequency and proton_charge). + </doc> + <group type="NXlog" minOccurs="1"> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"/> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"/> + </dimensions> + </field> + </group> + <group type="NXpositioner" minOccurs="0"> + <doc> + Motor logs from cvinfo file. + </doc> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + </group> + </group> + <group type="NXnote" name="SNSHistoTool"> + <field name="SNSbanking_file_name"/> + <field name="SNSmapping_file_name"/> + <field name="author"/> + <field name="command1"> + <doc> + Command string for event2nxl. + </doc> + </field> + <field name="date"/> + <field name="description"/> + <field name="version"/> + </group> + <group type="NXdata" minOccurs="1"> + <!-- for all NXdata/banks --> + <link name="data_x_y" target="/NXentry/NXinstrument/NXdetector/data_x_y"></link> + <link name="x_pixel_offset" target="/NXentry/NXinstrument/NXdetector/x_pixel_offset"></link> + <link name="y_pixel_offset" target="/NXentry/NXinstrument/NXdetector/y_pixel_offset"></link> + </group> + <group type="NXevent_data" minOccurs="1"> + <!-- for all NXdata/banks --> + <link name="event_index" target="/NXentry/NXinstrument/NXdetector/event_index"></link> + <link name="event_pixel_id" target="/NXentry/NXinstrument/NXdetector/event_pixel_id"></link> + <link name="event_time_of_flight" target="/NXentry/NXinstrument/NXdetector/event_time_of_flight"></link> + <link name="pulse_time" target="/NXentry/NXinstrument/NXdetector/pulse_time"></link> + </group> + <field name="collection_identifier"/> + <field name="collection_title"/> + <field name="definition"> + <doc> + Official NXDL schema after this file goes to applications. + </doc> + <enumeration> + <item value="NXsnsevent"></item> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT" units="NX_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="entry_identifier"/> + <field name="experiment_identifier"/> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="SNS"> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"/> + <field name="name"/> + <field name="probe"/> + <field name="type"/> + </group> + <field name="SNSdetector_calibration_id"> + <doc> + Detector calibration id from DAS. + </doc> + </field> + <field name="SNSgeometry_file_name"/> + <!-- SNSnxtranslate --> + <field name="SNStranslation_service"/> + <group type="NXdetector" minOccurs="1"> + <!-- for all NXdetector/banks --> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="data_x_y" type="NX_UINT"> + <doc>expect ``signal=2 axes="x_pixel_offset,y_pixel_offset``"</doc> + <!-- axes are set in data files --> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="event_index" type="NX_UINT"> + <dimensions rank="1"> + <dim index="1" value="numpulses"/> + </dimensions> + </field> + <field name="event_pixel_id" type="NX_UINT"> + <dimensions rank="1"> + <dim index="1" value="numevents"/> + </dimensions> + </field> + <field name="event_time_of_flight" type="NX_FLOAT" units="NX_TIME_OF_FLIGHT"> + <dimensions rank="1"> + <dim index="1" value="numevents"/> + </dimensions> + </field> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="pixel_id" type="NX_UINT"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="pulse_time" type="NX_FLOAT" units="NX_TIME"> + <dimensions rank="1"> + <dim index="1" value="numpulses"/> + </dimensions> + </field> + <field name="total_counts" type="NX_UINT"/> + <field name="x_pixel_offset" type="NX_FLOAT" axis="1" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numx"/> + </dimensions> + </field> + <field name="y_pixel_offset" type="NX_FLOAT" axis="2" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numy"/> + </dimensions> + </field> + </group> + <field name="beamline"/> + <group type="NXdisk_chopper" minOccurs="0"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + </group> + <group type="NXmoderator" name="moderator"> + <field name="coupling_material"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"/> + <field name="type"/> + </group> + <field name="name"/> + <group type="NXaperture" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="x_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXattenuator" minOccurs="0"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <!-- motor links from DASlogs when exist --> + </group> + <group type="NXpolarizer" minOccurs="0"/> + <!-- motor links from DASlogs when exist --> + <group type="NXcrystal" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <field name="description"/> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="type"/> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + </group> + <group type="NXmonitor" minOccurs="0"> + <field name="data" type="NX_UINT"> + <doc>expect ``signal=1 axes="time_of_flight"``</doc> + <dimensions rank="1"> + <dim index="1" value="numtimechannels"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mode"/> + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME"> + <dimensions rank="1"> + <dim index="1" value="numtimechannels + 1"/> + </dimensions> + </field> + </group> + <field name="notes"/> + <field name="proton_charge" type="NX_FLOAT" units="NX_CHARGE"/> + <field name="raw_frames" type="NX_INT"/> + <field name="run_number"/> + <group type="NXsample" name="sample"> + <field name="changer_position"/> + <field name="holder"/> + <field name="identifier"/> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature"/> + </group> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="title"/> + <field name="total_counts" type="NX_UINT" units="NX_UNITLESS"/> + <field name="total_uncounted_counts" type="NX_UINT" units="NX_UNITLESS"/> + <group type="NXuser" minOccurs="1"> + <field name="facility_user_id"/> + <field name="name"/> + <field name="role"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v3.3/contributed_definitions/NXsnshisto.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXsnshisto.nxdl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f923f3483e08215eb5cb4ca1be2897fb653b85a2 --- /dev/null +++ b/src/punx/cache/v3.3/contributed_definitions/NXsnshisto.nxdl.xml @@ -0,0 +1,338 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?> +<!-- + # NXsnshisto: candidate NeXus definition for histogram data from Spallation Neutron Source (SNS) at ORNL. +--> +<definition type="group" name="NXsnshisto" category="contributed" extends="NXobject" + xmlns="http://definition.nexusformat.org/nxdl/3.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd" + version="1.0" + > + <doc>This is a definition for histogram data from Spallation Neutron Source (SNS) at ORNL.</doc> + <group type="NXentry" minOccurs="1"> + <group type="NXcollection" name="DASlogs"> + <doc> + Details of all logs, both from cvinfo file and from HistoTool (frequency and proton_charge). + </doc> + <group type="NXlog" minOccurs="1"> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"></dim> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="nvalue"/> + </dimensions> + </field> + </group> + <group type="NXpositioner" minOccurs="0"> + <doc> + Motor logs from cvinfo file. + </doc> + <field name="average_value" type="NX_FLOAT"/> + <field name="average_value_error" type="NX_FLOAT"/> + <field name="description"/> + <field name="duration" type="NX_FLOAT"/> + <field name="maximum_value" type="NX_FLOAT"/> + <field name="minimum_value" type="NX_FLOAT"/> + <field name="time" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + <field name="value" type="NX_FLOAT"> + <dimensions rank="1"> + <dim index="1" value="numvalue"/> + </dimensions> + </field> + </group> + </group> + <group type="NXnote" name="SNSHistoTool"> + <field name="SNSbanking_file_name"/> + <field name="SNSmapping_file_name"/> + <field name="author"/> + <field name="command1"> + <doc> + Command string for event2histo_nxl. + </doc> + </field> + <field name="date"/> + <field name="description"/> + <field name="version"/> + </group> + <group type="NXdata" minOccurs="1"> + <!-- for all NXdata/banks --> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + <link name="data_x_time_of_flight" target="/NXentry/NXinstrument/NXdetector/data_x_time_of_flight"/> + <link name="data_x_y" target="/NXentry/NXinstrument/NXdetector/data_x_y"/> + <link name="data_y_time_of_flight" target="/NXentry/NXinstrument/NXdetector/data_y_time_of_flight"/> + <link name="pixel_id" target="/NXentry/NXinstrument/NXdetector/pixel_id"/> + <link name="time_of_flight" target="/NXentry/NXinstrument/NXdetector/time_of_flight"/> + <link name="total_counts" target="/NXentry/NXinstrument/NXdetector/total_counts"/> + <link name="x_pixel_offset" target="/NXentry/NXinstrument/NXdetector/x_pixel_offset"/> + <link name="y_pixel_offset" target="/NXentry/NXinstrument/NXdetector/y_pixel_offset"/> + </group> + <field name="collection_identifier"/> + <field name="collection_title"/> + <field name="definition"> + <doc> + Official NXDL schema after this file goes to applications. + </doc> + <enumeration> + <item value="NXsnshisto"/> + </enumeration> + </field> + <field name="duration" type="NX_FLOAT" units="NX_TIME"/> + <field name="end_time" type="NX_DATE_TIME"/> + <field name="entry_identifier"/> + <field name="experiment_identifier"/> + <group type="NXinstrument" name="instrument"> + <group type="NXsource" name="SNS"> + <field name="frequency" type="NX_FLOAT" units="NX_FREQUENCY"/> + <field name="name"/> + <field name="probe"/> + <field name="type"/> + </group> + <field name="SNSdetector_calibration_id"> + <doc> + Detector calibration id from DAS. + </doc> + </field> + <field name="SNSgeometry_file_name"/> + <!-- SNSnxtranslate --> + <field name="SNStranslation_service"/> + <group type="NXdetector" minOccurs="1"> + <!-- for all NXdetector/banks --> + <field name="azimuthal_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="data" type="NX_UINT" signal="1" axes="x_pixel_offset,y_pixel_offset,time_of_flight"> + <dimensions rank="3"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + <dim index="3" value="numtof"/> + </dimensions> + </field> + <field name="data_x_time_of_flight" type="NX_UINT" signal="3" axes="x_pixel_offset,time_of_flight"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numtof"/> + </dimensions> + </field> + <field name="data_x_y" type="NX_UINT" signal="2" axes="x_pixel_offset,y_pixel_offset"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="data_y_time_of_flight" type="NX_UINT" signal="4" axes="y_pixel_offset,time_of_flight"> + <dimensions rank="2"> + <dim index="1" value="numy"/> + <dim index="2" value="numtof"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="pixel_id" type="NX_UINT"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"> + <dimensions rank="2"> + <dim index="1" value="numx"/> + <dim index="2" value="numy"/> + </dimensions> + </field> + <field name="time_of_flight" type="NX_FLOAT" axis="3" primary="1" units="NX_TIME_OF_FLIGHT"> + <dimensions rank="1"> + <dim index="1" value="numtof + 1"/> + </dimensions> + </field> + <field name="total_counts" type="NX_UINT"/> + <field name="x_pixel_offset" type="NX_FLOAT" axis="1" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numx"/> + </dimensions> + </field> + <field name="y_pixel_offset" type="NX_FLOAT" axis="2" primary="1" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="numy"/> + </dimensions> + </field> + </group> + <field name="beamline"/> + <group type="NXdisk_chopper" minOccurs="0"> + <doc> + Original specification called for NXchopper, + which is not a valid NeXus base class. + Select either NXdisk_chopper or NXfermi_chopper, as appropriate. + </doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + </group> + <group type="NXfermi_chopper" minOccurs="0"> + <doc> + Original specification called for NXchopper, + which is not a valid NeXus base class. + Select either NXdisk_chopper or NXfermi_chopper, as appropriate. + </doc> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + </group> + <group type="NXmoderator" name="moderator"> + <field name="coupling_material"/> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="temperature" type="NX_FLOAT" units="NX_TEMPERATURE"/> + <field name="type"/> + </group> + <field name="name"/> + <group type="NXaperture" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="x_pixel_offset" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXattenuator" minOccurs="0"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <!-- motor links from DASlogs when exist --> + </group> + <group type="NXpolarizer" minOccurs="0"/> + <!-- motor links from DASlogs when exist --> + <group type="NXcrystal" minOccurs="0"> + <group type="NXgeometry" name="origin"> + <field name="description"/> + <group type="NXorientation" name="orientation"> + <field name="value" type="NX_FLOAT"> + <doc> + Six out of nine rotation parameters. + </doc> + <dimensions rank="1"> + <dim index="1" value="6"/> + </dimensions> + </field> + </group> + <group type="NXshape" name="shape"> + <field name="description"/> + <field name="shape"/> + <field name="size" type="NX_FLOAT" units="NX_LENGTH"> + </field> + </group> + <group type="NXtranslation" name="translation"> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"> + <dimensions rank="1"> + <dim index="1" value="3"/> + </dimensions> + </field> + </group> + </group> + <field name="type"/> + <field name="wavelength" type="NX_FLOAT" units="NX_WAVELENGTH"/> + </group> + </group> + <group type="NXmonitor" minOccurs="0"> + <field name="data" type="NX_UINT" signal="1" axes="time_of_flight"> + <dimensions rank="1"> + <dim index="1" value="numtimechannels"/> + </dimensions> + </field> + <field name="distance" type="NX_FLOAT" units="NX_LENGTH"/> + <field name="mode"/> + <field name="time_of_flight" type="NX_FLOAT" units="NX_TIME"> + <dimensions rank="1"> + <dim index="1" value="numtimechannels + 1"/> + </dimensions> + </field> + </group> + <field name="notes"/> + <field name="proton_charge" type="NX_FLOAT" units="NX_CHARGE"/> + <field name="raw_frames" type="NX_INT"/> + <field name="run_number"/> + <group type="NXsample" name="sample"> + <field name="changer_position"/> + <field name="holder"/> + <field name="identifier"/> + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + <field name="nature"/> + </group> + <field name="start_time" type="NX_DATE_TIME"/> + <field name="title"/> + <field name="total_counts" type="NX_UINT" units="NX_UNITLESS"/> + <field name="total_uncounted_counts" type="NX_UINT" units="NX_UNITLESS"/> + <group type="NXuser" minOccurs="1"> + <field name="facility_user_id"/> + <field name="name"/> + <field name="role"/> + </group> + </group> +</definition> diff --git a/src/punx/cache/v3.2/contributed_definitions/NXsolenoid_magnet.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXsolenoid_magnet.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXsolenoid_magnet.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXsolenoid_magnet.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXspecdata.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXspecdata.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXspecdata.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXspecdata.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/NXspin_rotator.nxdl.xml b/src/punx/cache/v3.3/contributed_definitions/NXspin_rotator.nxdl.xml similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/NXspin_rotator.nxdl.xml rename to src/punx/cache/v3.3/contributed_definitions/NXspin_rotator.nxdl.xml diff --git a/src/punx/cache/v3.2/contributed_definitions/nxdlformat.xsl b/src/punx/cache/v3.3/contributed_definitions/nxdlformat.xsl similarity index 100% rename from src/punx/cache/v3.2/contributed_definitions/nxdlformat.xsl rename to src/punx/cache/v3.3/contributed_definitions/nxdlformat.xsl diff --git a/src/punx/cache/v3.3/nxdl.xsd b/src/punx/cache/v3.3/nxdl.xsd new file mode 100644 index 0000000000000000000000000000000000000000..304292258bee60489135e4a65c7e77cf9b02f7f4 --- /dev/null +++ b/src/punx/cache/v3.3/nxdl.xsd @@ -0,0 +1,1286 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://definition.nexusformat.org/nxdl/3.1" + xmlns:nx="http://definition.nexusformat.org/nxdl/3.1" + elementFormDefault="qualified"> + + <xs:annotation> + <xs:documentation> + .. + NeXus - Neutron and X-ray Common Data Format + + Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) + + This library is free software; you can redistribute it and/osr + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information, see http://www.nexusformat.org + </xs:documentation> + </xs:annotation> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:include schemaLocation="nxdlTypes.xsd"> + <xs:annotation> + <xs:documentation> + Definitions of the basic data types and unit types + allowed in NXDL instance files. + </xs:documentation> + </xs:annotation> + </xs:include> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <!-- define the document root element --> + <xs:element name="definition" type="nx:definitionType"> + <xs:annotation> + <xs:documentation> + A ``definition`` element + is the ``group`` at the + root of every NXDL specification. + It may *only* appear + at the root of an NXDL file and must only appear + **once** for the NXDL to be *well-formed*. + </xs:documentation> + </xs:annotation> + </xs:element> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:simpleType name="validItemName"> + <xs:annotation> + <xs:documentation> + Used for allowed names of elements and attributes. + Need to be restricted to valid program variable names. + Note: This means no "-" or "." characters can be allowed and + you cannot start with a number. + HDF4 had a 64 character limit on names + (possibly including NULL) and NeXus enforces this + via the ``NX_MAXNAMELEN`` variable with + a **64** character limit (which + may be 63 on a practical basis if one considers a NULL + terminating byte). + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:pattern value="[A-Za-z_][\w_]*" /> + <xs:maxLength value="63" /> <!-- enforce via NX_MAXNAMELEN --> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="validNXClassName"> + <xs:annotation> + <xs:documentation> + Used for allowed names of NX class types (e.g. NXdetector) + not the instance (e.g. bank1) which is covered by validItemName. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="nx:validItemName"> + <xs:pattern value="NX.+"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="validTargetName"> + <xs:annotation> + <xs:documentation> + This is a valid link target - currently it must be an absolute path + made up of valid names with the ``/`` character delimiter. But we may + want to consider allowing "``..``" (parent of directory) at some point. + If the ``name`` attribute is helpful, then use it in the path + with the syntax of *name:type* as in these examples:: + + /NXentry/NXinstrument/analyzer:NXcrystal/ef + /NXentry/NXinstrument/monochromator:NXcrystal/ei + /NX_other + + Must also consider use of ``name`` attribute in resolving ``link`` targets. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:annotation> + <xs:documentation> + From the HDF5 documentation + (http://www.hdfgroup.org/HDF5/doc/UG/UG_frame09Groups.html): + + *Note that relative path names in HDF5 do not employ the ``../`` notation, + the UNIX notation indicating a parent directory, to indicate a parent group.* + + Thus, if we only consider the case of + ``[name:]type``, the matching regular expression syntax + is written: ``/[a-zA-Z_][\w_]*(:[a-zA-Z_][\w_]*)?)+``. + Note that HDF5 also permits relative path names, such as: + ``GroupA/GroupB/Dataset1`` + but this is not permitted in the matching regular expression and not supported in NAPI. + </xs:documentation> + </xs:annotation> + <xs:pattern value="(/[a-zA-Z_][\w_]*(:[a-zA-Z_][\w_]*)?)+" /> + </xs:restriction> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:attributeGroup name="deprecatedAttributeGroup"> + <xs:attribute name="deprecated" use="optional"> + <xs:annotation> + <xs:documentation> + The presence of the ``deprecated`` attribute + indicates to the data file validation process that + an advisory message (specified as the content of the + ``deprecated`` attribute) will be reported. + Future versions of the NXDL file might + not define (or even re-use) the component marked with this attribute. + + The value of the attribute will be printed in the documentation. + Make it descriptive (limited to no line breaks). + For example:: + + deprecated="as of release MAJOR.MINOR" + + Note: because ``deprecated`` is an attribute, + the XML rules do not permit it to have any + element content. + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:pattern value=".*(\w+).*" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + + <xs:complexType name="definitionType"> + <xs:annotation> + <xs:documentation> + A ``definition`` is the root element of every NXDL definition. + It may *only* appear at the root of an NXDL file and must only + appear **once** for the NXDL to be *well-formed*. + + The ``definitionType`` defines the documentation, + attributes, fields, and groups that will be used + as children of the ``definition`` element. + Could contain these elements: + + * ``attribute`` + * ``doc`` + * ``field`` + * ``group`` + * ``link`` + + Note that a ``definition`` element also includes the definitions of the + ``basicComponent`` data type. + (The ``definitionType`` data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + + Note that the first line of text in a ``doc`` element in a ``definition`` + is used as a summary in the manual. Follow the pattern as shown + in the base class NXDL files. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="symbols" type="nx:symbolsType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Use a ``symbols`` list + to define each of the mnemonics that + represent the length of each dimension in a vector or array. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:group ref="nx:groupGroup" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + In addition to an optional ``symbols`` list, + a ``definition`` may contain any of the items + allowed in a ``group``. + </xs:documentation> + </xs:annotation> + </xs:group> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + The ``name`` of this NXDL file (without the file extensions). + The name must be unique amongst all the NeXus base class, application, + and contributed definitions. For the class to be adopted by the NIAC, + the first two letters must be "``NX``" (in uppercase). Any other use + must *not* begin with "``NX``" in any combination + of upper or lower case. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="version" use="required"> + <xs:annotation> + <xs:documentation> + Version of *this* NXDL definition. + Each NXDL specification + may have a different version to facilitate software maintenance. + This value is modified by the person who edits this file when + this NXDL specification has changed significantly (in a way that + downstream software should be aware). + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" use="required" type="nx:definitionTypeAttr"> + <xs:annotation> + <xs:documentation>Must be ``type="group"``</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="extends" use="optional"> + <xs:annotation> + <xs:documentation> + The ``extends`` attribute allows this definition + to *subclass* from another NXDL, + otherwise ``extends="NXobject"`` should be used. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="restricts" use="optional"> + <xs:annotation> + <xs:documentation> + The ``restricts`` attribute is a flag to the data validation. + When ``restricts="1"``, any non-standard component found + (and checked for validity aginst this NXDL specification) + in a NeXus data file will be flagged as an error. If the + ``restricts`` attribute is not present, any such situations + will produce a warning. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="svnid" use="optional"> + <xs:annotation> + <xs:documentation> + (2014-08-19: deprecated since switch to GitHub version control) + The identifier string from the subversion revision control system. + This reports the time stamp and the revision number of this file. + (Updated automatically, unlike the ``version`` attribute.) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="category" use="required"> + <xs:annotation> + <xs:documentation> + NXDL ``base`` definitions define the dictionary + of terms to use for these components. + All terms in a ``base`` definition are optional. + NXDL ``application`` definitions define what is + required for a scientific interest. + All terms in an ``application`` definition + are required. + NXDL ``contributed`` definitions may be + considered either base or applications. + Contributed definitions <emphasis>must</emphasis> indicate + their intended use, either as a base class or + as an application definition. + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="base"/> + <xs:enumeration value="application"/> + <xs:enumeration value="contributed"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="ignoreExtraGroups" use="optional" type="nx:NX_BOOLEAN" default="false"> + <xs:annotation> + <xs:documentation> + Only validate known groups; do not not warn about unknowns. + The ``ignoreExtraGroups`` attribute is a flag to the process of + validating NeXus data files. By setting ``ignoreExtraGroups="true"``, + presence of any undefined groups in this class will not generate warnings + during validation. Normally, validation will check all the groups against + their definition in the NeXus base classes and + application definitions. Any items found that do not match the definition + in the NXDL will generate a warning message. + + The ``ignoreExtraGroups`` attribute should be used sparingly! + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="ignoreExtraFields" use="optional" type="nx:NX_BOOLEAN" default="false"> + <xs:annotation> + <xs:documentation> + Only validate known fields; do not not warn about unknowns. + The ``ignoreExtraFields`` attribute is a flag to the process of + validating NeXus data files. By setting ``ignoreExtraFields="true"``, + presence of any undefined fields in this class will not generate warnings + during validation. Normally, validation will check all the fields against + their definition in the NeXus base classes and + application definitions. Any items found that do not match the definition + in the NXDL will generate a warning message. + + The ``ignoreExtraFields`` attribute should be used sparingly! + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="ignoreExtraAttributes" use="optional" type="nx:NX_BOOLEAN" default="false"> + <xs:annotation> + <xs:documentation> + Only validate known attributes; do not not warn about unknowns. + The ``ignoreExtraAttributes`` attribute is a flag to the process of + validating NeXus data files. By setting ``ignoreExtraAttributes="true"``, + presence of any undefined attributes in this class will not generate warnings + during validation. Normally, validation will check all the attributes + against their definition in the NeXus base classes and + application definitions. Any items found that do not match the definition + in the NXDL will generate a warning message. + + The ``ignoreExtraAttributes`` attribute should be used sparingly! + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <xs:simpleType name="definitionTypeAttr"> + <xs:annotation> + <xs:documentation> + Prescribes the allowed values for ``definition`` ``type`` attribute. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="group" /> + <xs:enumeration value="definition" /> + </xs:restriction> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="groupType"> + <xs:annotation> + <xs:documentation> + A group element refers to the definition of + an existing NX object or a locally-defined component. + Could contain these elements: + + * ``attribute`` + * ``doc`` + * ``field`` + * ``group`` + * ``link`` + + Note that a ``group`` element also includes the definitions of the + ``basicComponent`` data type. + (The ``groupType`` data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:group ref="nx:groupGroup" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + A ``group`` may be contained within another ``group``. + </xs:documentation> + </xs:annotation> + </xs:group> + <xs:attribute name="type" use="required" type="nx:validNXClassName"> + <xs:annotation> + <xs:documentation> + The ``type`` attribute *must* + contain the name of a + NeXus base class, application definition, or contributed definition. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="name" use="optional" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + A particular scientific application may expect + a name of a ``group`` element. It is helpful but not + required to specify the ``name`` + attribute in the NXDL file. + It is suggested to always specify a ``name`` + to avoid ambiguity. It is also suggested to + derive the ``name`` from the + type, using an additional number suffix as necessary. + For example, consider a data file with only one + ``NXentry``. The suggested default + ``name`` would + be ``entry``. For a data file with two or more + ``NXentry`` groups, the suggested names would be + ``entry1``, ``entry2``, ... + Alternatively, a scientific application such as small-angle + scattering might require + a different naming procedure; two different ``NXaperture`` groups + might be given the names ``beam-defining slit`` + and ``scatter slit``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="minOccurs" use="optional" default="0" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Minimum number of times this ``group`` is allowed to be present within its + parent group. Note each ``group`` must have a ``name`` attribute + that is unique among all ``group`` and ``field`` + declarations within a common parent group. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="maxOccurs" use="optional" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Maximum number of times this ``group`` is allowed to be present within its + parent ``group``. Note each ``group`` must have a ``name`` attribute + that is unique among all ``group`` and ``field`` + declarations within a common parent ``group``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <xs:group name="groupGroup"> + <xs:annotation> + <xs:documentation> + A ``groupGroup`` defines the allowed children of a + ``group`` specification. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe the purpose of this ``group``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="attribute" type="nx:attributeType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Use an ``attribute`` if additional information + needs to be associated with a ``group``. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="group" type="nx:groupType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + A ``group`` may contain ``group``s. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="field" type="nx:fieldType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + A ``group`` may contain ``field`` elements (datasets). + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="link" type="nx:linkType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Use a ``link`` to refer locally to + information placed elsewhere else in the data storage hierarchy. + The ``name`` attribute uniquely identifies + the element in this ``group``. + The ``target`` attribute + (added automatically in a data file by the NAPI) + identifies the original location of this data in the + data storage hierarchy. + In an NXDL specification, the ``target`` attribute + indicates a link to be made by the software that writes the data file. + The value, as written in the NXDL file, will be a suggestion of + the path to the source of the link. + For example:: + + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"/> + + The value of ``target`` is written using + the NeXus class names since this is a suggestion and does not actually use + the element names from a particular data file. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:group> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="basicComponent"> + <xs:annotation> + <xs:documentation> + A ``basicComponent`` defines the allowed name + format and attributes common to all ``field`` + and ``group`` specifications. + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe this ``basicComponent`` and its use. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + The ``name`` attribute is the + identifier string for this entity. + It is required that ``name`` must be unique + within the enclosing ``group``. + The rule (``validItemName``) is defined to only + allow names that can be represented as valid variable names + in most computer languages. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="fieldType"> + <xs:annotation> + <xs:documentation> + A ``field`` declares a new element in the component being defined. + A ``field`` is synonymous with the HDF4 SDS (Scientific Data Set) and + the HDF5 *dataset* terms. Could contain these elements: + + * ``attribute`` + * ``dimensions`` + * ``doc`` + * ``enumeration`` + + Note that a ``field`` element also includes the definitions of the + ``basicComponent`` data type. + (The ``fieldType`` data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="nx:basicComponent"> + <xs:sequence> + <xs:element name="dimensions" type="nx:dimensionsType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation>dimensions of a data element + in a NeXus file</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="attribute" type="nx:attributeType" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation + >attributes to be used with this field</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="enumeration" type="nx:enumerationType" minOccurs="0"> + <xs:annotation> + <xs:documentation>A field can specify which + values are to be used</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="units" type="nx:anyUnitsAttr"> + <xs:annotation> + <xs:documentation> + String describing the engineering units. + The string should be appropriate for the value + and should conform to the NeXus rules for units. + Conformance is not validated at this time. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="long_name" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Descriptive name for this field (may include whitespace and engineering units). + Often, the long_name (when defined) will be used as the axis label on a plot. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="signal" type="nx:NX_POSINT"> + <xs:annotation> + <xs:documentation> + Presence of the ``signal`` attribute means this field is an ordinate. + + Integer marking this field as plottable data (ordinates). + The value indicates the priority of selection or interest. + Some facilities only use ``signal=1`` + while others use ``signal=2`` to indicate + plottable data of secondary interest. + Higher numbers are possible but not common + and interpretation is not standard. + + A field with a ``signal`` attribute should not have an ``axis`` attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="axes" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + NOTE: Use of this attribute is discouraged. It is for legacy support. + You should use the axes attribute on the NXdata group instead. + + Presence of the ``axes`` attribute means this field is an ordinate. + + This attribute contains a colon (or comma in legacy files) delimited list + of the names of independent axes when plotting this field. + Each name in this list must exist as a field in the same group. + <!-- perhaps even discourage use of square brackets in axes attribute? --> + (Optionally, the list can be enclosed by square brackets but this is not common.) + The regular expression for this rule is:: + + [A-Za-z_][\w_]*([ :][A-Za-z_][\w_]*)* + + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="axis" type="nx:NX_POSINT"> + <xs:annotation> + <xs:documentation> + NOTE: Use of this attribute is discouraged. It is for legacy support. + You should use the axes attribute on the NXdata group instead. + + Presence of the ``axis`` attribute means this field is an abcissa. + + The attribute value is an integer indicating this + field as an axis that is part of the data set. + The data set is a field with the attribute + ``signal=1`` in the same group. + The value can range from 1 up to the number of + independent axes (abcissae) in the data set. + + A value of ``axis=1``" indicates that this field + contains the data for the first independent axis. + For example, the X axis in an XY data set. + + A value of ``axis=2`` indicates that this field + contains the data for the second independent axis. + For example, the Y axis in a 2-D data set. + + A value of ``axis=3`` indicates that this field + contains the data for the third independent axis. + For example, the Z axis in a 3-D data set. + + A field with an ``axis`` attribute should + not have a ``signal`` attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="primary" type="nx:NX_POSINT"> + <xs:annotation> + <xs:documentation> + Integer indicating the priority of selection + of this field for plotting (or visualization) as an axis. + + Presence of the ``primary`` attribute means this + field is an abcissa. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" type="nx:NAPI" default="NX_CHAR"> + <xs:annotation> + <xs:documentation> + Defines the type of the element as allowed by the NAPI (NeXus Application Programmer Interface). + See elsewhere for the complete list of allowed NAPI types. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="minOccurs" use="optional" default="0" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Defines the minimum number of times this ``field`` may be used. Its + value is confined to zero or greater. Must be less than or equal to + the value for the "maxOccurs" attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="maxOccurs" use="optional" default="1" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + Defines the maximum number of times this element may be used. Its + value is confined to zero or greater. Must be greater than or equal to + the value for the "minOccurs" attribute. + A value of "unbounded" is allowed. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="stride" use="optional" default="1" type="nx:NX_INT"> + <xs:annotation> + <xs:documentation> + The ``stride`` and ``data_offset`` attributes + are used together to index the array of data items in a + multi-dimensional array. They may be used as an alternative + method to address a data array that is not stored in the standard NeXus + method of "C" order. + + The ``stride`` list chooses array locations from the + data array with each value in the ``stride`` list + determining how many elements to move in each dimension. + Setting a value in the ``stride`` array to 1 moves + to each element in that dimension of the data array, while + setting a value of 2 in a location in the ``stride`` + array moves to every other element in that dimension of the + data array. A value in the ``stride`` list may be + positive to move forward or negative to step backward. + A value of zero will not step (and is of no particular use). + + See http://davis.lbl.gov/Manuals/HDF5-1.4.3/Tutor/phypereg.html + or *4. Dataspace Selection Operations* in + http://www.hdfgroup.org/HDF5/doc1.6/Dataspaces.html. + + + The ``stride`` attribute contains a + comma-separated list of integers. + (In addition to the required comma delimiter, + whitespace is also allowed to improve readability.) + The number of items in the list + is equal to the rank of the data being stored. The value of each + item is the spacing of the data items in that subscript of the array. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="data_offset" use="optional" default="1" type="nx:nonNegativeUnbounded"> + <xs:annotation> + <!-- + note: renamed from "offset" due to comflict with CIF usage. + see: https://github.com/nexusformat/definitions/issues/330#issuecomment-232074420 + --> + <xs:documentation> + The ``stride`` and ``data_offset`` attributes + are used together to index the array of data items in a + multi-dimensional array. They may be used as an alternative + method to address a data array that is not stored in the standard NeXus + method of "C" order. + + The ``data_offset`` attribute + determines the starting coordinates of the data array + for each dimension. + + See http://davis.lbl.gov/Manuals/HDF5-1.4.3/Tutor/phypereg.html + or *4. Dataspace Selection Operations* in + http://www.hdfgroup.org/HDF5/doc1.6/Dataspaces.html. + + The ``data_offset`` attribute contains a + comma-separated list of integers. + (In addition to the required comma delimiter, + whitespace is also allowed to improve readability.) + The number of items in the list + is equal to the rank of the data being stored. The value of each + item is the offset in the array of the first data item of that + subscript of the array. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="interpretation" use="optional"> + <xs:annotation> + <xs:documentation> + This instructs the consumer of the data what the last dimensions + of the data are. It allows plotting software to work + out the natural way of displaying the data. + + For example a single-element, energy-resolving, fluorescence detector + with 512 bins should have ``interpretation="spectrum"``. If the + detector is scanned over a 512 x 512 spatial grid, the data reported + will be of dimensions: 512 x 512 x 512. + In this example, the initial plotting representation should default to + data of the same dimensions of a 512 x 512 pixel ``image`` + detector where the images where taken at 512 different pressure values. + + In simple terms, the allowed values mean: + + * ``scaler`` = 0-D data to be plotted + * ``spectrum`` = 1-D data to be plotted + * ``image`` = 2-D data to be plotted + * ``vertex`` = 3-D data to be plotted + + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="nx:NX_CHAR"> + <xs:enumeration value="scalar"/> + <xs:enumeration value="spectrum"/> + <xs:enumeration value="image"/> + <xs:enumeration value="vertex"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="nameType" use="optional" default="specified"> + <xs:annotation> + <xs:documentation> + This interprets the name attribute as: + * ``specified`` = use as specified + * ``any`` = can be any name not already used in group + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="nx:NX_CHAR"> + <xs:enumeration value="specified"/> + <xs:enumeration value="any"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="attributeType"> + <xs:annotation> + <xs:documentation> + Any new group or field may expect or require some common attributes. + + .. + Could contain these elements: + + * ``doc`` + * ``enumeration`` + + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0"> + <xs:annotation> + <xs:documentation> + Description of this ``attribute``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="enumeration" type="nx:enumerationType" + minOccurs="0"> + <xs:annotation> + <xs:documentation> + An enumeration specifies the values to be used. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dimensions" type="nx:dimensionsType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + dimensions of an attribute with data value(s) in a NeXus file + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" use="required" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + Name of the attribute (unique within the enclosing group). + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" type="nx:primitiveType" default="NX_CHAR"> + <xs:annotation> + <xs:documentation> + Type of the attribute. + For ``group`` specifications, the class name. + For ``field`` or ``attribute`` specifications, + the NXDL data type. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="optional" type="nx:NX_BOOLEAN" default="true"> + <xs:annotation> + <xs:documentation> + Is this attribute *optional* (if **true**) + or *required* (if **false**)? + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attributeGroup ref="nx:deprecatedAttributeGroup"/> + </xs:complexType> + + <xs:simpleType name="nonNegativeUnbounded"> + <xs:annotation> + <xs:documentation> + A ``nonNegativeUnbounded`` allows values including + all positive integers, zero, and the string ``unbounded``. + (This data type is used internally in the NXDL schema + to define a data type.) + </xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:nonNegativeInteger"/> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="unbounded" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:complexType name="linkType"> + <xs:annotation> + <xs:documentation> + A link to another item. Use a link to avoid + needless repetition of information. + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="nx:basicComponent"> + <xs:attribute name="target" use="required" type="nx:validTargetName"> + <xs:annotation> + <xs:documentation> + Declares the absolute HDF5 address of an existing field or group. + + The target attribute is added for NeXus to distinguish the + HDF5 path to the original dataset. + + Could contain these elements: + + * ``doc`` + + Matching regular expression:: + + (/[a-zA-Z_][\w_]*(:[a-zA-Z_][\w_]*)?)+ + + For example, given a + ``/entry/instrument/detector/polar_angle`` field, + link it into the ``NXdata`` group + (at ``/entry/data/polar_angle``). + This would be the NeXus data file structure:: + + /: NeXus/HDF5 data file + /entry:NXentry + /data:NXdata + /polar_angle:NX_NUMBER + @target="/entry/instrument/detector/polar_angle" + /instrument:NXinstrument + /detector:NXdetector + /polar_angle:NX_NUMBER + @target="/entry/instrument/detector/polar_angle" + + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="napimount" use="optional" type="xs:string"> + <xs:annotation> + <xs:documentation> + Group attribute that provides a URL to a group in another file. + More information is described in the *NeXus Programmers Reference*. + + http://download.nexusformat.org/doc/NeXusIntern.pdf + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="docType" mixed="true"> + <xs:annotation> + <xs:documentation> + NXDL allows for documentation on most elements using the ``doc`` + element. The documentation is useful in several contexts. The documentation will be + rendered in the manual. Documentation, is provided as tooltips + by some XML editors when editing NXDL files. + Simple documentation can be typed directly in the NXDL:: + + <field name="name"> + <doc>Descriptive name of sample</doc> + </field> + + This is suitable for basic descriptions that do not need extra formatting + such as a bullet-list or a table. For more advanced control, use the rules + of restructured text, such as in the :ref:`NXdetector` specification. + Refer to examples in the NeXus base class NXDL files such as :ref:`NXdata`. + + Could contain these elements: + + * *any* + + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + + Note: + For documentation of ``definition`` elements, + the first line of text in a ``doc`` + is used as a summary in the manual. + Follow the pattern as shown + in the base class NXDL files. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="symbolsType" mixed="true"> + <xs:annotation> + <xs:documentation> + Each ``symbol`` has a ``name`` and optional documentation. + Please provide documentation that indicates what each symbol represents. + For example:: + + <symbols> + <symbol name="nsurf"><doc>number of reflecting surfaces</doc></symbol> + <symbol name="nwl"><doc>number of wavelengths</doc></symbol> + </symbols> + + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe the purpose of this list of ``symbols``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="symbol" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + When multiple ``field`` elements share the same dimensions, such as the dimension scales + associated with plottable data in an ``NXdata`` group, the length of each + dimension written in a NeXus data file should be something that can be tested by the + data file validation process. + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Describe the purpose of the parent ``symbol``. + This documentation will go into the manual. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="nx:validItemName"> + <xs:annotation> + <xs:documentation> + Mnemonic variable name for this array index symbol. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="enumerationType"> + <xs:annotation> + <xs:documentation> + An ``enumeration`` restricts the values allowed for a specification. + Each value is specified using an ``item`` element, such as: + ``<item value="Synchrotron X-ray Source" />``. + Could contain these elements: + + * ``doc`` + * ``item`` + + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + + :: + + <field name="mode"> + <doc>source operating mode</doc> + <enumeration> + <item value="Single Bunch"><doc>for storage rings</doc></item> + <item value="Multi Bunch"><doc>for storage rings</doc></item> + <!-- other sources could add to this --> + </enumeration> + </field> + + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="item" minOccurs="1" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + One of the prescribed values. Use the ``value`` attribute. + + Defines the value of one selection for an ``enumeration`` list. + Each enumerated item must have a value (it cannot have an empty text node). + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0" maxOccurs="1"> + <xs:annotation> + <xs:documentation> + Individual items can be documented + but this documentation might not be printed in the + *NeXus Reference Guide*. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="value" use="required"> + <xs:annotation> + <xs:documentation> + The value of ``value`` of an ``enumItem`` + is defined as an attribute rather than a name. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="dimensionsType"> + <!-- + see TRAC ticket #32: https://github.com/nexusformat/definitions/issues/32 + --> + <xs:annotation> + <xs:documentation> + dimensions of a data element in a NeXus file + (This data type is used internally in the NXDL schema + to define elements and attributes to be used by users in NXDL specifications.) + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="doc" type="nx:docType" minOccurs="0"> + <xs:annotation> + <xs:documentation> + Documentation might be necessary to describe how the parts + of the ``dimensions`` element are to be used. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dim" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation> + Specify the parameters for each index of the ``dimensions`` + element with a ``dim`` element. + The number of ``dim`` entries should be equal to + the ``rank`` of the array. + For example, these terms + describe a 2-D array with lengths (``nsurf``, ``nwl``): + + .. code-block:: xml + :linenos: + + <dimensions rank="2"> + <dim index="1" value="nsurf"/> + <dim index="2" value="nwl"/> + </dimensions> + + The ``value`` attribute is used by NXDL and also by + the NeXus data file validation tools to associate and coordinate the + same array length across multiple fields in a group. + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attribute name="index" use="required"> + <xs:annotation> + <xs:documentation> + Number or symbol indicating which axis (subscript) is + being described, ranging from 1 up to + ``rank`` (rank of the + data structure). For example, given an array + ``A[i,j,k]``, + ``index="1"`` would refer to the + ``i`` axis (subscript). + (``NXdata`` uses ``index="0"`` + to indicate a situation when the specific index is not + known *a priori*.) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="value" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Integer length (number of values), or mnemonic symbol + representing the length of this axis. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="ref" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Deprecated: 2016-11-23 telco + (https://github.com/nexusformat/definitions/issues/330) + + The dimension specification is the same as + that in the ``ref`` field, specified either by a relative path, + such as ``polar_angle`` or ``../Qvec`` or absolute path, such as + ``/entry/path/to/follow/to/ref/field``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="refindex" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Deprecated: 2016-11-23 telco + (https://github.com/nexusformat/definitions/issues/330) + + The dimension specification is the same as + the ``refindex`` axis within the ``ref`` field. + Requires ``ref`` attribute to be present. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="incr" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + The dimension specification is related to + the ``refindex`` axis within the ``ref`` field by an + offset of ``incr``. Requires ``ref`` and ``refindex`` + attributes to be present. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="required" type="nx:NX_BOOLEAN" default="true"> + <xs:annotation> + <xs:documentation> + This dimension is required (true: default) or not required (false). + + The default value is ``true``. + + When ``required="false"`` is + specified, all subsequent ``<dim`` nodes + (with higher ``index`` value) + **must** also have ``required="false"``. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="rank" type="nx:NX_CHAR"> + <xs:annotation> + <xs:documentation> + Rank (number of dimensions) of the data structure. + + Value could be either an unsigned integer or a symbol + as defined in the *symbol* table of the NXDL file. + + For example: ``a[5]`` has ``rank="1"`` while + ``b[8,5,6,4]`` has ``rank="4"``. + See http://en.wikipedia.org/wiki/Rank_(computer_programming) + for more details. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +</xs:schema> diff --git a/src/punx/cache/v3.3/nxdlTypes.xsd b/src/punx/cache/v3.3/nxdlTypes.xsd new file mode 100644 index 0000000000000000000000000000000000000000..79d28b97953f02f1face6a34a87769253c798484 --- /dev/null +++ b/src/punx/cache/v3.3/nxdlTypes.xsd @@ -0,0 +1,523 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://definition.nexusformat.org/nxdl/3.1" + xmlns:nxdl="http://definition.nexusformat.org/nxdl/3.1" + elementFormDefault="qualified"> + + <xs:annotation> + <xs:documentation> + .. + NeXus - Neutron and X-ray Common Data Format + + Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information, see http://www.nexusformat.org + </xs:documentation> + </xs:annotation> + + <!-- + anyUnitsAttr: specifies the type of content that goes into a units="" attribute + primitiveType: specifies the type of content that goes into a type="" attribute of a field or attribute + --> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:simpleType name="anyUnitsAttr"> + <xs:annotation> + <xs:documentation> + Unit categories in NXDL specifications describe the expected type of units for a NeXus field. + + They should describe valid units consistent with + the manual section on NeXus units (based on UDUNITS). + Units are not validated by NeXus. + </xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_ANGLE + nxdl:NX_ANY + nxdl:NX_AREA + nxdl:NX_CROSS_SECTION + nxdl:NX_CHARGE + nxdl:NX_CURRENT + nxdl:NX_DIMENSIONLESS + nxdl:NX_EMITTANCE + nxdl:NX_ENERGY + nxdl:NX_FLUX + nxdl:NX_FREQUENCY + nxdl:NX_LENGTH + nxdl:NX_MASS + nxdl:NX_MASS_DENSITY + nxdl:NX_MOLECULAR_WEIGHT + nxdl:NX_PER_AREA + nxdl:NX_PER_LENGTH + nxdl:NX_PERIOD + nxdl:NX_POWER + nxdl:NX_PRESSURE + nxdl:NX_PULSES + nxdl:NX_SCATTERING_LENGTH_DENSITY + nxdl:NX_SOLID_ANGLE + nxdl:NX_TEMPERATURE + nxdl:NX_TIME + nxdl:NX_TIME_OF_FLIGHT + nxdl:NX_TRANSFORMATION + nxdl:NX_UNITLESS + nxdl:NX_VOLTAGE + nxdl:NX_VOLUME + nxdl:NX_UNITLESS + nxdl:NX_WAVELENGTH + nxdl:NX_WAVENUMBER + " /> + </xs:simpleType> + + <xs:simpleType name="NX_ANGLE"> + <xs:annotation> + <xs:documentation> + units of angle, example: m + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_ANY"> + <xs:annotation> + <xs:documentation> + units for things like logs that aren't picky on units + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_AREA"> + <xs:annotation> + <xs:documentation> + units of area, example: m2 or barns + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_CROSS_SECTION"> + <xs:annotation> + <xs:documentation> + units of area, example: barns (alias of NX_AREA) + </xs:documentation> + </xs:annotation> + <xs:union memberTypes="nxdl:NX_AREA" /> + </xs:simpleType> + + <xs:simpleType name="NX_CHARGE"> + <xs:annotation> + <xs:documentation> + units of electrical charge, example: c + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_CURRENT"> + <xs:annotation> + <xs:documentation> + units of electrical current, example: A + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_DIMENSIONLESS"> + <xs:annotation> + <xs:documentation> + units for fields where the units cancel out, + example: "" or mm/mm + (NOTE: not the same as NX_UNITLESS) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_EMITTANCE"> + <xs:annotation> + <xs:documentation> + units of emittance (``length * angle``) of a + radiation source, example: ``nm*rad`` + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_ENERGY"> + <xs:annotation> + <xs:documentation> + units of energy, example: J or keV + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_FLUX"> + <xs:annotation> + <xs:documentation> + units of flux, example: s-1 cm-2 + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_FREQUENCY"> + <xs:annotation> + <xs:documentation> + units of frequency, example: Hz + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_LENGTH"> + <xs:annotation> + <xs:documentation> + units of length, example: m + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_MASS"> + <xs:annotation> + <xs:documentation> + units of length, example: g + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_MASS_DENSITY"> + <xs:annotation> + <xs:documentation> + units of mass density, example: g cm-3 + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_MOLECULAR_WEIGHT"> + <xs:annotation> + <xs:documentation> + units of molecular weight, example: g mol-1 + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PER_AREA"> + <xs:annotation> + <xs:documentation> + units of length, example: m + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PER_LENGTH"> + <xs:annotation> + <xs:documentation> + units of length, example: m + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PERIOD"> + <xs:annotation> + <xs:documentation> + units of time, period of pulsed source, + example: microseconds (alias to `NX_TIME`) + </xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:NX_TIME" /> + </xs:simpleType> + + <xs:simpleType name="NX_POWER"> + <xs:annotation> + <xs:documentation> + units of power, example: W + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PRESSURE"> + <xs:annotation> + <xs:documentation> + units of pressure, example: Pa + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_PULSES"> + <xs:annotation> + <xs:documentation> + units of clock pulses (alias to `NX_NUMBER`) + </xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:NX_NUMBER" /> + </xs:simpleType> + + <xs:simpleType name="NX_SCATTERING_LENGTH_DENSITY"> + <xs:annotation> + <xs:documentation> + units of scattering length density, example: cm-2 + </xs:documentation> + </xs:annotation> + <!-- isn't this an alias of NX_PER_AREA? + Could also be alias of NX_LENGTH (cm^2/atom) --> + <!-- <xs:union memberTypes="nxdl:NX_PER_AREA nxdl:NX_LENGTH" /> --> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_SOLID_ANGLE"> + <xs:annotation> + <xs:documentation> + units of solid angle, example: sr | steradian + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_TEMPERATURE"> + <xs:annotation> + <xs:documentation> + units of temperature, example: K + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_TIME"> + <xs:annotation> + <xs:documentation> + units of time, example: s + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_TIME_OF_FLIGHT"> + <xs:annotation> + <xs:documentation> + units of (neutron) time of flight, + example: s (alias to `NX_TIME`) + </xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:NX_TIME" /> + </xs:simpleType> + + <xs:simpleType name="NX_TRANSFORMATION"> + <xs:annotation> + <xs:documentation> + units of the specified transformation + + could be any of these: ``NX_LENGTH``, ``NX_ANGLE``, or ``NX_UNITLESS`` + + There will be one or more transformations defined by one or more fields + for each transformation. The units type ``NX_TRANSFORMATION`` designates the + particular axis generating a transformation (e.g. a rotation axis or a translation + axis or a general axis). ``NX_TRANSFORMATION`` designates the + units will be appropriate to the type of transformation, + indicated in the :ref:`NXtransformations` base class + by the ``transformation_type`` value: + + * ``NX_LENGTH`` for ``translation`` + * ``NX_ANGLE`` for ``rotation`` + * ``NX_UNITLESS`` for axes for which no transformation type is specified. + </xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_LENGTH + nxdl:NX_ANGLE + nxdl:NX_UNITLESS + " /> + </xs:simpleType> + + <xs:simpleType name="NX_UNITLESS"> + <xs:annotation> + <xs:documentation> + for fields that don't have a unit (e.g. hkl) so that they don't + inherit the wrong units (NOTE: not the same as NX_DIMENSIONLESS) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_VOLTAGE"> + <xs:annotation> + <xs:documentation> + units of voltage, example: V + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_VOLUME"> + <xs:annotation> + <xs:documentation> + units of volume, example: m3 + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_WAVELENGTH"> + <xs:annotation> + <xs:documentation> + units of wavelength, example: angstrom + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_WAVENUMBER"> + <xs:annotation> + <xs:documentation> + units of wavenumber or Q, + example: `angstrom-1` or `nm-1` + </xs:documentation> + </xs:annotation> + <!-- isn't this an alias of NX_PER_LENGTH? --> + <!-- <xs:union memberTypes="nxdl:NX_PER_LENGTH" /> --> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> + + <xs:simpleType name="primitiveType"> + <xs:annotation> + <xs:documentation> + Valid names for the type attribute on fields and attributes. + This is an alias for NAPI (which is any valid NeXus type). + </xs:documentation> + </xs:annotation> + <xs:list itemType="nxdl:NAPI" /> + </xs:simpleType> + + <xs:simpleType name="NAPI"> + <xs:annotation> + <xs:documentation>any valid NeXus type</xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_CHAR + nxdl:NX_FLOAT + nxdl:NX_INT + nxdl:NX_UINT + nxdl:NX_POSINT + nxdl:NX_NUMBER + nxdl:NX_DATE_TIME + nxdl:NX_BOOLEAN + nxdl:NX_BINARY + nxdl:ISO8601 + "/> + </xs:simpleType> + + <xs:simpleType name="NX_CHAR"> + <xs:annotation> + <xs:documentation> + any string representation + + All strings are to be encoded in UTF-8. + + Includes fixed-length strings, variable-length strings, + and string arrays. + + Some file writers write strings as a string array + of rank 1 and length 1. + Clients should be prepared to handle such strings. + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="NX_FLOAT"> + <xs:annotation> + <xs:documentation>any representation of a floating point number</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:float" /> + </xs:simpleType> + + <xs:simpleType name="NX_INT"> + <xs:annotation> + <xs:documentation>any representation of an integer number</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + + <xs:simpleType name="NX_UINT"> + <xs:annotation> + <xs:documentation>any representation of an unsigned integer number (includes zero)</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:unsignedInt" /> + </xs:simpleType> + + <xs:simpleType name="NX_POSINT"> + <xs:annotation> + <xs:documentation>any representation of a positive integer number (greater than zero)</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:positiveInteger" /> + </xs:simpleType> + + <xs:simpleType name="NX_NUMBER"> + <xs:annotation> + <xs:documentation>any valid NeXus number representation</xs:documentation> + </xs:annotation> + <xs:union memberTypes=" + nxdl:NX_INT + nxdl:NX_UINT + nxdl:NX_POSINT + nxdl:NX_FLOAT + " /> + </xs:simpleType> + + <xs:simpleType name="NX_DATE_TIME"> + <xs:annotation> + <xs:documentation>alias for the ISO8601 date/time stamp</xs:documentation> + </xs:annotation> + <xs:restriction base="nxdl:ISO8601" /> + </xs:simpleType> + + <xs:simpleType name="ISO8601"> + <xs:annotation> + <xs:documentation>ISO8601 date/time stamp</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:dateTime" /> + </xs:simpleType> + + <xs:simpleType name="NX_BOOLEAN"> + <xs:annotation> + <xs:documentation>true/false value ( true | 1 | false | 0 )</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:boolean" /> + </xs:simpleType> + + <xs:simpleType name="NX_BINARY"> + <xs:annotation> + <xs:documentation>any representation of binary data - if text, line terminator is [CR][LF]</xs:documentation> + </xs:annotation> + <!-- TODO Is this the way to describe pure binary? uint8, byte, hex64binary --> + <!-- TODO Should be a uint8 but this does not seem to be allowed. Using xs:unsignedByte instead. --> + <xs:restriction base="xs:unsignedByte" /> + </xs:simpleType> + +</xs:schema> diff --git a/src/punx/cache_manager.py b/src/punx/cache_manager.py index 08e6c365e556f4a737c46b66175e7afb9d8975bc..79001bc9c5943f5d8f310c8a4a23f8d1f7ee22ac 100644 --- a/src/punx/cache_manager.py +++ b/src/punx/cache_manager.py @@ -4,14 +4,14 @@ #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2016, Pete R. Jemian +# :copyright: (c) 2016-2018, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # # The full license is in the file LICENSE.txt, distributed with this software. #----------------------------------------------------------------------------- -''' +""" manages the NXDL cache directories of this project A key component necessary to validate both NeXus data files and @@ -22,16 +22,17 @@ There are two cache directories: * the source cache * the user cache -Within each of these cache directories, there is a settings file -(such as *punx.ini*) that stores the configuration of that cache -directory. Also, there are a number of subdirectories, each +Within each of these cache directories, +there may be one or more subdirectories, each containing the NeXus definitions subdirectories and files (``*.xml``, -``*.xsl``, & ``*.xsd``) of a specific branch, release, or commit hash +``*.xsl``, & ``*.xsd``) of a specific branch, release, tag, or commit hash from the NeXus definitions repository. :source cache: contains default set of NeXus NXDL files :user cache: contains additional set(s) of NeXus NXDL files, installed by user +The *cache_manager* calls the *github_handler* and +is called by *schema_manager* and *nxdl_manager*. .. rubric:: Public interface @@ -47,27 +48,34 @@ from the NeXus definitions repository. ~get_short_sha ~read_json_file ~write_json_file + ~should_extract_this + ~should_avoid_download ~extract_from_download + ~table_of_caches ~Base_Cache - ~Source_Cache - ~User_Cache + ~SourceCache + ~UserCache ~NXDL_File_Set -''' +""" import datetime import json import os -from PyQt4 import QtCore +import pyRestTable import shutil -import sys +try: + from PyQt5 import QtCore +except ImportError: + from PyQt4 import QtCore -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -import punx.singletons -#from punx import settings +from .__init__ import __settings_organization__, __settings_package__, FileNotFound +from . import singletons +from . import github_handler +from . import utils +logger = utils.setup_logger(__name__) SOURCE_CACHE_SUBDIR = u'cache' SOURCE_CACHE_SETTINGS_FILENAME = u'punx.ini' INFO_FILE_NAME = u'__github_info__.json' @@ -75,42 +83,80 @@ SHORT_SHA_LENGTH = 7 def get_short_sha(full_sha): - ''' + """ return the first few unique characters of the git commit hash (SHA) - ''' + + :param str full_sha: hash code from Github + """ return full_sha[:min(SHORT_SHA_LENGTH, len(full_sha))] def write_json_file(filename, obj): - ''' + """ write the structured ``obj`` to the JSON file ``file_name`` :see: https://docs.python.org/3.5/library/json.html#json.dumps - ''' + """ open(filename, 'w').write(json.dumps(obj, indent=2)) def read_json_file(filename): - ''' + """ read a structured object from the JSON file ``file_name`` :see: https://docs.python.org/3.5/library/json.html#json.loads - ''' + """ return json.loads(open(filename, 'r').read()) +def should_extract_this(item, NXDL_file_endings_list, allowed_parent_directories): + """ + decide if this item should be extracted from the ZIP download + + :return bool: + """ + for ending in NXDL_file_endings_list: + if item.endswith(ending): + if item.split('/')[-2] in allowed_parent_directories: + return True + return False + + +def should_avoid_download(grr, path): + """ + decide if the download should be avoided (True: avoid, False: download) + + :return bool: + """ + names = [] + names.append(grr.appName + '-' + grr.sha) + names.append(grr.orgName + '-' + grr.appName + '-' + grr.sha) + short_sha = get_short_sha(grr.sha) + names.append(grr.appName + '-' + short_sha) + names.append(grr.orgName + '-' + short_sha + '-' + grr.sha) + names.append(grr.ref) + for subdir in names: + if subdir in os.listdir(path): + info_file_name = os.path.join(path, subdir, INFO_FILE_NAME) + if os.path.exists(info_file_name): + info = read_json_file(info_file_name) + if info["sha"] == grr.sha: + return True + return False + + def extract_from_download(grr, path): # TODO refactor into NXDL_File_Set - ''' + """ download & extract NXDL files from ``grr`` into a subdirectory of ``path`` USAGE:: - grr = punx.github_handler.GitHub_Repository_Reference() + grr = github_handler.GitHub_Repository_Reference() grr.connect_repo() if grr.request_info() is not None: - punx.cache_manager.extract_from_download(grr, cache_directory) - - ''' + extract_from_download(grr, cache_directory) + + """ import io, zipfile NXDL_categories = 'base_classes applications contributed_definitions'.split() NXDL_file_endings_list = '.xsd .xml .xsl'.split() @@ -119,49 +165,19 @@ def extract_from_download(grr, path): # TODO refactor into NXDL_File_Set download_dir_name = None # to be learned en route NXDL_refs_dir_name = os.path.join(path, grr.ref) - - def should_avoid_download(grr, path): - ''' - decide if the download should be avoided (True: avoid, False: download) - ''' - names = [] - names.append(grr.appName + '-' + grr.sha) - names.append(grr.orgName + '-' + grr.appName + '-' + grr.sha) - short_sha = get_short_sha(grr.sha) - names.append(grr.appName + '-' + short_sha) - names.append(grr.orgName + '-' + short_sha + '-' + grr.sha) - names.append(grr.ref) - for subdir in names: - if subdir in os.listdir(path): - info_file_name = os.path.join(path, subdir, INFO_FILE_NAME) - if os.path.exists(info_file_name): - info = read_json_file(info_file_name) - if info.sha != grr.sha: - return True - return False if should_avoid_download(grr, path): return msg_list.append('downloading: ' + grr.zip_url) zip_content = zipfile.ZipFile(io.BytesIO(grr.download().content)) - def should_extract_this(item): - ''' - decide if this item should be extracted from the ZIP download - ''' - for ending in NXDL_file_endings_list: - if item.endswith(ending): - if item.split('/')[-2] in allowed_parent_directories: - return True - return False - allowed_parent_directories = NXDL_categories for item in zip_content.namelist(): if download_dir_name is None: root_name = item.split('/')[0] download_dir_name = os.path.join(path, root_name) allowed_parent_directories.append(root_name) - if should_extract_this(item): + if should_extract_this(item, NXDL_file_endings_list, allowed_parent_directories): zip_content.extract(item, path) msg_list.append( 'extracted: ' + item ) @@ -185,60 +201,116 @@ def extract_from_download(grr, path): # TODO refactor into NXDL_File_Set return msg_list -class CacheManager(punx.singletons.Singleton): - ''' +def table_of_caches(): + """ + return a pyRestTable table describing all known file sets in both source and user caches + + :returns obj: instance of pyRestTable.Table with all known file sets + + **Example**:: + + ============= ======= ====== =================== ======= =================================== + NXDL file set type cache date & time commit path + ============= ======= ====== =================== ======= =================================== + v3.2 tag source 2017-01-18 23:12:44 e888dac /home/user/punx/src/punx/cache/v3.2 + NXroot-1.0 tag user 2016-10-24 14:58:10 e0ad63d /home/user/.config/punx/NXroot-1.0 + master branch user 2016-12-20 18:30:29 85d056f /home/user/.config/punx/master + Schema-3.3 release user 2017-05-02 12:33:19 4aa4215 /home/user/.config/punx/Schema-3.3 + a4fd52d commit user 2016-11-19 01:07:45 a4fd52d /home/user/.config/punx/a4fd52d + ============= ======= ====== =================== ======= =================================== + + """ + cm = CacheManager() + return cm.table_of_caches() + + +class CacheManager(singletons.Singleton): + + """ manager both source and user caches .. autosummary:: ~install_NXDL_file_set ~select_NXDL_file_set - ~file_sets + ~find_all_file_sets ~cleanup - ''' + """ def __init__(self): self.default_file_set = None self.source = SourceCache() self.user = UserCache() - self.NXDL_file_sets = self.file_sets() - msg = 'NXDL_file_sets names = ' + self.NXDL_file_sets = self.find_all_file_sets() + msg = ' NXDL_file_sets names = ' msg += str(sorted(list(self.NXDL_file_sets.keys()))) - punx.LOG_MESSAGE(msg, punx.DEBUG) + logger.debug(msg) try: self.select_NXDL_file_set() except KeyError: pass if self.default_file_set is None: - msg = 'CacheManager: no default_file_set selected yet' - punx.LOG_MESSAGE(msg, punx.DEBUG) + msg = ' CacheManager: no default_file_set selected yet' + logger.debug(msg) # TODO: update the .ini file as needed (remember the default_file_set value # - - - - - - - - - - - - - - # public - def install_NXDL_file_set(self, grr, user_cache=True, ref=None): - ref = ref or punx.github_handler.DEFAULT_NXDL_SET + def install_NXDL_file_set(self, grr, user_cache=True, ref=None, force=False): + """ + using `ref` as a name, get the se of NXDL files from the NeXus GitHub + + :param obj grr: instance of :class:`GitHub_Repository_Reference` + :param bool user_cache: ``True``: use user cache, + `` False``: use source cache (default) + :param str ref: name to use when requesting from GitHub, + (`master`, commit hash such as `abc1234`, + branch name, release name such as `v3.2`, + or tag name) + :param bool force: update if installed is not the same SHA + """ + ref = ref or github_handler.DEFAULT_NXDL_SET cache_obj = {True: self.user, False: self.source}[user_cache] - if ref not in cache_obj.file_sets(): + fs = cache_obj.find_all_file_sets() + if force or ref not in fs: if grr.request_info(ref) is not None: - m = punx.cache_manager.extract_from_download(grr, cache_obj.path()) - return m + if ref not in fs: + logger.info(" %s not found in cache", ref) + force = True + verb = "Installing" + else: + force = ref in fs and grr.sha != fs[ref].sha + if force: + msg = " different SHAs - existing=" + fs[ref].sha + msg += " GitHub=" + grr.sha + logger.info(msg) + verb = "Updating" + else: + logger.info(" NXDL file set: %s unchanged, not updating", ref) + if force: + logger.info(" %s NXDL file set: %s", verb, ref) + m = extract_from_download(grr, cache_obj.path()) + return m def select_NXDL_file_set(self, ref=None): - ''' + """ return the named self.default_file_set instance or raise KeyError exception if unknown - ''' - import punx.github_handler - msg = 'DEBUG - given ref: ' + str(ref) - punx.LOG_MESSAGE(msg, punx.DEBUG) + + :return obj: + """ + logger.debug(' given ref: ' + str(ref)) + + def sorter(value): + return self.NXDL_file_sets[value].last_modified - ref = ref or punx.github_handler.DEFAULT_NXDL_SET - msg = 'DEBUG - final ref: ' + str(ref) - punx.LOG_MESSAGE(msg, punx.DEBUG) + if ref is None and len(self.NXDL_file_sets) > 0: + ref = ref or sorted(self.NXDL_file_sets, key=sorter, reverse=True)[0] + ref = ref or github_handler.DEFAULT_NXDL_SET + logger.debug(' final ref: ' + str(ref)) if ref not in self.NXDL_file_sets: #msg = 'unknown NXDL file set: ' + str(ref) @@ -246,79 +318,105 @@ class CacheManager(punx.singletons.Singleton): msg += ', received: ' + str(ref) raise KeyError(msg) self.default_file_set = self.NXDL_file_sets[ref] + logger.debug(" default file set: " + str(self.default_file_set)) return self.default_file_set # - - - - - - - - - - - - - - # private - def file_sets(self): - ''' - index all NXDL file sets in both source and user caches, return a dictionary - ''' - fs = {k: v for k, v in self.source.file_sets().items()} - msg = 'DEBUG - source file set names: ' - msg += str(sorted(list(fs.keys()))) - punx.LOG_MESSAGE(msg, punx.DEBUG) - - for k, v in self.user.file_sets().items(): - if k in fs: - raise ValueError('user cache file set already known: ' + k) - else: + def find_all_file_sets(self): + """return dictionary of all NXDL file sets in both source & user caches""" + fs = {k: v for k, v in self.source.find_all_file_sets().items()} + msg = ' source file set names: ' + msg += str(sorted(list(fs.keys()))) + logger.debug(msg) + + for k, v in self.user.find_all_file_sets().items(): + if k not in fs: + # raise ValueError('user cache file set already known: ' + k) + # else: fs[k] = v self.NXDL_file_sets = fs # remember - msg = 'DEBUG - all file set names: ' + msg = ' all known file set names: ' msg += str(sorted(list(fs.keys()))) - punx.LOG_MESSAGE(msg, punx.DEBUG) + logger.debug(msg) return fs def cleanup(self): - ''' - removes any temporary directories - ''' + """removes any temporary directories""" self.source.cleanup() self.user.cleanup() - + + def table_of_caches(self): + """ + return a pyRestTable table describing all known file sets in both source and user caches + + :returns obj: instance of pyRestTable.Table with all known file sets + + **Example**:: + + ============= ======= ====== =================== ======= =================================== + NXDL file set type cache date & time commit path + ============= ======= ====== =================== ======= =================================== + v3.2 tag source 2017-01-18 23:12:44 e888dac /home/user/punx/src/punx/cache/v3.2 + NXroot-1.0 tag user 2016-10-24 14:58:10 e0ad63d /home/user/.config/punx/NXroot-1.0 + master branch user 2016-12-20 18:30:29 85d056f /home/user/.config/punx/master + Schema-3.3 release user 2017-05-02 12:33:19 4aa4215 /home/user/.config/punx/Schema-3.3 + a4fd52d commit user 2016-11-19 01:07:45 a4fd52d /home/user/.config/punx/a4fd52d + ============= ======= ====== =================== ======= =================================== + + """ + t = pyRestTable.Table() + fs = self.find_all_file_sets() + t.labels = ['NXDL file set', 'type', 'cache', 'date & time', 'commit', 'path'] + for k, v in fs.items(): + # print(k, str(v)) + row = [k,] + v.short_sha = get_short_sha(v.sha) + for w in 'ref_type cache last_modified short_sha path'.split(): + row.append(str(v.__getattribute__(w))) + t.rows.append(row) + return t + class Base_Cache(object): - ''' + + """ provides comon methods to get the QSettings path and file name .. autosummary:: - ~file_sets + ~find_all_file_sets ~fileName ~path ~cleanup - ''' + """ qsettings = None is_temporary_directory = False def path(self): - 'directory containing the QSettings file' + """directory containing the QSettings file""" if self.qsettings is None: raise RuntimeError('cache qsettings not defined!') return os.path.dirname(self.fileName()) def fileName(self): - 'full path of the QSettings file' + """full path of the QSettings file""" if self.qsettings is None: raise RuntimeError('cache qsettings not defined!') fn = str(self.qsettings.fileName()) return fn - def file_sets(self): - ''' - index all NXDL file sets in this cache - ''' + def find_all_file_sets(self): + """index all NXDL file sets in this cache""" fs = {} if self.qsettings is None: raise RuntimeError('cache qsettings not defined!') cache_path = self.path() - msg = 'DEBUG - cache path: ' + str(cache_path) - punx.LOG_MESSAGE(msg, punx.DEBUG) + logger.debug(' cache path: ' + str(cache_path)) for item in os.listdir(cache_path): if os.path.isdir(os.path.join(cache_path, item)): @@ -329,18 +427,15 @@ class Base_Cache(object): return fs def cleanup(self): - ''' - removes any temporary directories - ''' + """removes any temporary directories""" if self.is_temporary_directory: os.removedirs(self.path()) self.is_temporary_directory = False class SourceCache(Base_Cache): - ''' - manage the source directory cache of NXDL files - ''' + + """manage the source directory cache of NXDL files""" def __init__(self): path = os.path.abspath( @@ -350,26 +445,25 @@ class SourceCache(Base_Cache): if not os.path.exists(path): # make the directory and load the default set of NXDL files os.mkdir(path) - _msgs = [] - grr = punx.github_handler.GitHub_Repository_Reference() + grr = github_handler.GitHub_Repository_Reference() grr.connect_repo() if grr.request_info() is not None: - _msgs = extract_from_download(grr, path) + extract_from_download(grr, path) ini_file = os.path.abspath(os.path.join(path, SOURCE_CACHE_SETTINGS_FILENAME)) self.qsettings = QtCore.QSettings(ini_file, QtCore.QSettings.IniFormat) + class UserCache(Base_Cache): - ''' - manage the user directory cache of NXDL files - ''' + + """manage the user directory cache of NXDL files""" def __init__(self): self.qsettings = QtCore.QSettings( QtCore.QSettings.IniFormat, QtCore.QSettings.UserScope, - punx.__settings_organization__, - punx.__settings_package__) + __settings_organization__, + __settings_package__) path = self.path() if not os.path.exists(path): @@ -387,9 +481,8 @@ class UserCache(Base_Cache): class NXDL_File_Set(object): - ''' - describe a single set of NXDL files - ''' + + """describe a single set of NXDL files""" path = None cache = None @@ -399,30 +492,25 @@ class NXDL_File_Set(object): sha = None zip_url = None last_modified = None - nxdl_element_factory = None + #nxdl_element_factory = None # these keys are written and read to the JSON info files in each downloaded file set json_file_keys = 'ref ref_type sha zip_url last_modified'.split() - # TODO: consider defining the SchemaManager here (perhaps lazy load)? see nxdl_manager for example code: __getattribute__() + # TODO: #94 consider defining the SchemaManager here (perhaps lazy load)? + # see nxdl_manager for example code: __getattribute__() schema_manager = None __schema_manager_loaded__ = False - def __init__(self): - import punx.nxdl_manager - #self.nxdl_element_factory = punx.nxdl_manager.NXDL_ElementFactory(self) - def __getattribute__(self, *args, **kwargs): - ''' - implement lazy load of definition content - ''' + """implement lazy load of definition content""" if len(args) == 1 \ and args[0] == 'schema_manager' \ and self.path is not None \ and os.path.exists(self.path) \ and not self.__schema_manager_loaded__: - import punx.schema_manager - self.schema_manager = punx.schema_manager.SchemaManager(self.path) + from punx import schema_manager + self.schema_manager = schema_manager.SchemaManager(self.path) self.__schema_manager_loaded__ = True return object.__getattribute__(self, *args, **kwargs) @@ -447,7 +535,7 @@ class NXDL_File_Set(object): file_name = file_name or self.info if not os.path.exists(file_name): - raise punx.FileNotFound('info file not found: ' + file_name) + raise FileNotFound('info file not found: ' + file_name) self.info = file_name self.path = os.path.abspath(os.path.dirname(file_name)) diff --git a/src/punx/data/02_03_setup.h5 b/src/punx/data/02_03_setup.h5 new file mode 100644 index 0000000000000000000000000000000000000000..b69d3b263e0c495b45bfd4c65837356ab3560327 Binary files /dev/null and b/src/punx/data/02_03_setup.h5 differ diff --git a/src/punx/data/1998spheres.h5 b/src/punx/data/1998spheres.h5 new file mode 100644 index 0000000000000000000000000000000000000000..108f39934ed938bec487d4ce6dfa77b1b810d18d Binary files /dev/null and b/src/punx/data/1998spheres.h5 differ diff --git a/src/punx/data/33837rear_1D_1.75_16.5_NXcanSAS_v3.h5 b/src/punx/data/33837rear_1D_1.75_16.5_NXcanSAS_v3.h5 new file mode 100644 index 0000000000000000000000000000000000000000..1908573d352e51ed0c29765007d47d4a44900cf3 Binary files /dev/null and b/src/punx/data/33837rear_1D_1.75_16.5_NXcanSAS_v3.h5 differ diff --git a/src/punx/data/33id_spec_22_2D.hdf5 b/src/punx/data/33id_spec_22_2D.hdf5 new file mode 100644 index 0000000000000000000000000000000000000000..58dfc40ef9da4b41c3faac2d0ef48208897e70ca Binary files /dev/null and b/src/punx/data/33id_spec_22_2D.hdf5 differ diff --git a/src/punx/data/Data_Q.h5 b/src/punx/data/Data_Q.h5 new file mode 100644 index 0000000000000000000000000000000000000000..e88dfe4093dc08fdc91b29e76cee79fc338316a3 Binary files /dev/null and b/src/punx/data/Data_Q.h5 differ diff --git a/src/punx/data/Qx_rank4_test_data.h5 b/src/punx/data/Qx_rank4_test_data.h5 new file mode 100644 index 0000000000000000000000000000000000000000..a69a4f1543a459326a6249097115068e594f8bbf Binary files /dev/null and b/src/punx/data/Qx_rank4_test_data.h5 differ diff --git a/src/punx/data/USAXS_flyScan_GC_M4_NewD_15.h5 b/src/punx/data/USAXS_flyScan_GC_M4_NewD_15.h5 new file mode 100644 index 0000000000000000000000000000000000000000..957ebfb3e48c6159f6660c85489d24939925f932 Binary files /dev/null and b/src/punx/data/USAXS_flyScan_GC_M4_NewD_15.h5 differ diff --git a/src/punx/data/chopper.nxs b/src/punx/data/chopper.nxs new file mode 100644 index 0000000000000000000000000000000000000000..895bed8fab36b04ea86729a222142746f7e7949d Binary files /dev/null and b/src/punx/data/chopper.nxs differ diff --git a/src/punx/data/compression.h5 b/src/punx/data/compression.h5 new file mode 100644 index 0000000000000000000000000000000000000000..4f6fa814d177ff9e965297f9ee52f55acabe2e43 Binary files /dev/null and b/src/punx/data/compression.h5 differ diff --git a/src/punx/data/cs_af1410.h5 b/src/punx/data/cs_af1410.h5 new file mode 100644 index 0000000000000000000000000000000000000000..e8d52aa3f6c08f91ff2546c47c629eeb59fdc375 Binary files /dev/null and b/src/punx/data/cs_af1410.h5 differ diff --git a/src/punx/data/draft_1D_NXcanSAS.h5 b/src/punx/data/draft_1D_NXcanSAS.h5 new file mode 100644 index 0000000000000000000000000000000000000000..569d514b9e72b0a8abd388b841f6f0f818c836de Binary files /dev/null and b/src/punx/data/draft_1D_NXcanSAS.h5 differ diff --git a/src/punx/data/draft_2D_NXcanSAS.h5 b/src/punx/data/draft_2D_NXcanSAS.h5 new file mode 100644 index 0000000000000000000000000000000000000000..3ed2807cd23ce285ae2f1cec259cef229c565878 Binary files /dev/null and b/src/punx/data/draft_2D_NXcanSAS.h5 differ diff --git a/src/punx/data/example_01_1D_I_Q.h5 b/src/punx/data/example_01_1D_I_Q.h5 new file mode 100644 index 0000000000000000000000000000000000000000..0163fefcb7f8a9aee7a0b39fcbc67a49438e52d1 Binary files /dev/null and b/src/punx/data/example_01_1D_I_Q.h5 differ diff --git a/src/punx/data/example_mapping.nxs b/src/punx/data/example_mapping.nxs new file mode 100644 index 0000000000000000000000000000000000000000..d46df54f5c76993890f7b5db9ad3ac7e4048e659 Binary files /dev/null and b/src/punx/data/example_mapping.nxs differ diff --git a/src/punx/data/gov_5.h5 b/src/punx/data/gov_5.h5 new file mode 100644 index 0000000000000000000000000000000000000000..2476f11433e1c39b24c9ba1b1da080da8bc00df5 Binary files /dev/null and b/src/punx/data/gov_5.h5 differ diff --git a/src/punx/data/prj_test.nexus.hdf5 b/src/punx/data/prj_test.nexus.hdf5 new file mode 100644 index 0000000000000000000000000000000000000000..91c13f25119fd7b0c4306407627e9ca2e34d3332 Binary files /dev/null and b/src/punx/data/prj_test.nexus.hdf5 differ diff --git a/src/punx/data/scan101.nxs b/src/punx/data/scan101.nxs new file mode 100644 index 0000000000000000000000000000000000000000..b0315ea398f70d8422ad95211859e159a9688ad3 Binary files /dev/null and b/src/punx/data/scan101.nxs differ diff --git a/src/punx/data/verysimple.nx5 b/src/punx/data/verysimple.nx5 new file mode 100644 index 0000000000000000000000000000000000000000..ce4ded39c02e806c6627fd56854f574804ebd1e5 Binary files /dev/null and b/src/punx/data/verysimple.nx5 differ diff --git a/src/punx/finding.py b/src/punx/finding.py index 9921ee597b0f69af13c4e2d317540b4fb7bc3b43..3e754adf91b9de1aa14cc695a5d4be8bab72dacc 100644 --- a/src/punx/finding.py +++ b/src/punx/finding.py @@ -1,104 +1,102 @@ - -#----------------------------------------------------------------------------- -# :author: Pete R. Jemian -# :email: prjemian@gmail.com -# :copyright: (c) 2016, Pete R. Jemian -# -# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. -# -# The full license is in the file LICENSE.txt, distributed with this software. -#----------------------------------------------------------------------------- - -''' -document each item during validation - -.. autosummary:: - - ~Finding - ~CheckupResults - ~VALID_STATUS_DICT - -''' - - -class ValidationResultStatus(object): - ''' - summary result of a Finding - - :param str key: short name - :param str color: suggested color for GUI - :param str description: one-line summary - ''' - - def __init__(self, key, color, description): - self.key = key - self.color = color - self.description = description - - def __str__(self, *args, **kwargs): - return self.key - - -OK = ValidationResultStatus('OK', 'green', 'meets NeXus specification') -NOTE = ValidationResultStatus('NOTE', 'palegreen', 'does not meet NeXus specification, but acceptable') -WARN = ValidationResultStatus('WARN', 'yellow', 'does not meet NeXus specification, not generally acceptable') -ERROR = ValidationResultStatus('ERROR', 'red', 'violates NeXus specification') -TODO = ValidationResultStatus('TODO', 'blue', 'validation not implemented yet') -UNUSED = ValidationResultStatus('UNUSED', 'grey', 'optional NeXus item not used in data file') -COMMENT = ValidationResultStatus('COMMENT', 'grey', 'comment from the punx source code') - -VALID_STATUS_LIST = (OK, NOTE, WARN, ERROR, TODO, UNUSED, COMMENT) -VALID_STATUS_DICT = {str(f): f for f in VALID_STATUS_LIST} -'''dictionary (by names) of all available findings''' - -TF_RESULT = {True: OK, False: ERROR} - -# SHOW_ALL = VALID_STATUS_LIST -# SHOW_ERRORS = (ERROR, WARN) -# SHOW_NOT_OK = (WARN, ERROR, TODO, UNUSED) - - -class Finding(object): - ''' - a single reported observation while validating - - :param str test_name: one-word description of the test - :param str h5_address: address of h5py item - :param int status: one of: OK NOTE WARNING ERROR TODO - :param str comment: description - ''' - - def __init__(self, test_name, h5_address, status, comment): - if status not in VALID_STATUS_LIST: - msg = 'unknown status value: ' + status - raise ValueError(msg) - self.test_name = str(test_name) - self.h5_address = h5_address - self.status = status - self.comment = comment - - def __str__(self, *args, **kwargs): - try: - s = self.h5_address - s += ' ' + str(self.status) - s += ': ' + self.test_name - s += ': ' + self.comment - return s - except Exception as exc: - return object.__str__(self, *args, **kwargs) - - -class CheckupResults(object): - ''' - various checkups for a single hdf5 address (absolute path) - - :param str h5_address: address of h5py item - ''' - - def __init__(self, h5_address): - self.h5_address = h5_address - self.findings = [] # keep list of all findings for this address - self.classpath = '' - - def __str__(self, *args, **kwargs): - return self.h5_address + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017-2018, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +""" +document each item during validation + +.. autosummary:: + + ~Finding + ~VALID_STATUS_DICT + +""" + + +import hashlib + + +class ValidationResultStatus(object): + """ + summary result of a Finding + + :param str key: short name + :param str color: suggested color for GUI + :param str description: one-line summary + """ + + def __init__(self, key, value, color, description): + self.key = key + self.value = value + self.color = color + self.description = description + + def __str__(self, *args, **kwargs): + return self.key + +VERY_BAD = -10000000 +OK = ValidationResultStatus('OK', 100, 'green', 'meets NeXus specification') +NOTE = ValidationResultStatus('NOTE', 75, 'palegreen', 'does not meet NeXus specification, but acceptable') +WARN = ValidationResultStatus('WARN', 25, 'yellow', 'does not meet NeXus specification, not generally acceptable') +ERROR = ValidationResultStatus('ERROR', VERY_BAD, 'red', 'violates NeXus specification') +TODO = ValidationResultStatus('TODO', 0, 'blue', 'validation not implemented yet') +UNUSED = ValidationResultStatus('UNUSED', 0, 'grey', 'optional NeXus item not used in data file') +COMMENT = ValidationResultStatus('COMMENT', 0, 'grey', 'comment from the punx source code') +OPTIONAL = ValidationResultStatus('OPTIONAL', 99, 'grey', 'allowed by NeXus specification, not identified') + +VALID_STATUS_LIST = (OK, NOTE, WARN, ERROR, TODO, UNUSED, COMMENT, OPTIONAL) +VALID_STATUS_DICT = {str(f): f for f in VALID_STATUS_LIST} +"""dictionary (by names) of all available validations""" + +TF_RESULT = {True: OK, False: ERROR} + +# SHOW_ALL = VALID_STATUS_LIST +# SHOW_ERRORS = (ERROR, WARN) +# SHOW_NOT_OK = (WARN, ERROR, TODO, UNUSED) + + +class Finding(object): + """ + a single reported observation while validating + + :param str h5_address: address of h5py item + :param str test_name: short description of the test + :param obj status: one of: OK NOTE WARN ERROR TODO COMMENT OPTIONAL UNUSED + :param str comment: description + """ + + def __init__(self, h5_address, test_name, status, comment): + if status not in VALID_STATUS_LIST: + msg = 'unknown status value: ' + status + raise ValueError(msg) + + self.test_name = str(test_name) + self.h5_address = h5_address + self.status = status + self.comment = comment + self.key = self.make_md5 + + def __str__(self, *args, **kwargs): + try: + s = str(self.status) + s += ' ' + self.h5_address + s += ': ' + self.test_name + s += ': ' + self.comment + return s + except Exception: + return object.__str__(self, *args, **kwargs) + + def make_md5(self): + """make a unique hash for this finding""" + h = hashlib.md5() + h.update(bytes(self.h5_address)) + h.update(b"\n") + h.update(bytes(self.test_name)) + return h.hexdigest() diff --git a/src/punx/github_handler.py b/src/punx/github_handler.py index e241bb62b4c875c9620e204df6e4a0328323c30c..d7c37bf717e686b315f4c99ee736c1efae9d5145 100644 --- a/src/punx/github_handler.py +++ b/src/punx/github_handler.py @@ -11,7 +11,7 @@ # The full license is in the file LICENSE.txt, distributed with this software. #----------------------------------------------------------------------------- -''' +""" manages the communications with GitHub @@ -26,10 +26,9 @@ USAGE:: if grr.request_info(u'v3.2') is not None: d = grr.download() -''' +""" import os -import sys import datetime import requests @@ -37,22 +36,29 @@ from requests.packages.urllib3 import disable_warnings from requests.packages.urllib3.exceptions import InsecureRequestWarning import github -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -#from punx import settings +from . import utils +logger = utils.setup_logger(__name__) + CREDS_FILE_NAME = u'__github_creds__.txt' DEFAULT_BRANCH_NAME = u'master' -DEFAULT_RELEASE_NAME = u'v3.2' -DEFAULT_TAG_NAME = u'NXroot-1.0' +DEFAULT_RELEASE_NAME = u'v2018.5' +#DEFAULT_TAG_NAME = u'NXroot-1.0' +DEFAULT_TAG_NAME = u'Schema-3.3' DEFAULT_COMMIT_NAME = u'a4fd52d' DEFAULT_NXDL_SET = DEFAULT_RELEASE_NAME GITHUB_RETRY_COUNT = 3 +GITHUB_NXDL_ORGANIZATION = 'nexusformat' +GITHUB_NXDL_REPOSITORY = 'definitions' +GITHUB_NXDL_BRANCH = 'master' +GITHUB_RETRY_COUNT = 3 +#NXDL_CACHE_SUBDIR = GITHUB_NXDL_REPOSITORY + '-' + GITHUB_NXDL_BRANCH + def get_BasicAuth_credentials(creds_file_name = None): - ''' + """ get the Github Basic Authentication credentials from a local file GitHub requests can use *Basic Authentication* if the @@ -64,19 +70,21 @@ def get_BasicAuth_credentials(creds_file_name = None): If found, the file is parsed for ``username password`` as shown below. Be sure to make the file readable only by the user and not others. - ''' + """ + # TODO: also look in user's .config directory, use a for loop to pick first matching path if creds_file_name is None: path = os.path.dirname(__file__) creds_file_name = os.path.join(path, CREDS_FILE_NAME) if not os.path.exists(creds_file_name): return - uname, pwd = open(creds_file_name, 'r').read().split() + uname, pwd = open(creds_file_name, 'r').read().strip().split() return dict(user=uname, password=pwd) class GitHub_Repository_Reference(object): - ''' + + """ all information necessary to describe and download a repository branch, release, tag, or SHA hash ROUTINES @@ -88,11 +96,11 @@ class GitHub_Repository_Reference(object): ~download :see: https://github.com/PyGithub/PyGithub/tree/master/github - ''' + """ def __init__(self): - self.orgName = punx.GITHUB_NXDL_ORGANIZATION - self.appName = punx.GITHUB_NXDL_REPOSITORY + self.orgName = GITHUB_NXDL_ORGANIZATION + self.appName = GITHUB_NXDL_REPOSITORY self.repo = None self.ref = None self.ref_type = None @@ -101,11 +109,12 @@ class GitHub_Repository_Reference(object): self.last_modified = None def connect_repo(self, repo_name=None): - ''' + """ connect with the GitHub repository :param str repo_name: name of repository in https://github.com/nexusformat (default: *definitions*) - ''' + :returns bool: True if using GitHub credentials + """ repo_name = repo_name or self.appName creds = get_BasicAuth_credentials() @@ -116,9 +125,10 @@ class GitHub_Repository_Reference(object): gh = github.Github(creds['user'], creds['password']) user = gh.get_user(self.orgName) self.repo = user.get_repo(repo_name) + return creds is not None def request_info(self, ref=None): - ''' + """ request download information about ``ref`` :param str ref: name of branch, release, tag, or SHA hash (default: *v3.2*) @@ -131,7 +141,7 @@ class GitHub_Repository_Reference(object): * hash (83ce630): https://github.com/nexusformat/definitions/archive/83ce630.zip * release (v3.2): see hash c0b9500 * tag (NXcanSAS-1.0): see hash 83ce630 - ''' + """ ref = ref or DEFAULT_NXDL_SET if self.repo is None: raise ValueError('call connect_repo() first') @@ -143,16 +153,16 @@ class GitHub_Repository_Reference(object): return node def download(self): - ''' + """ download the NXDL definitions described by ``ref`` - ''' + """ _msg = u'disabling warnings about GitHub self-signed https certificates' #requests.packages.urllib3.disable_warnings(InsecureRequestWarning) disable_warnings(InsecureRequestWarning) creds = get_BasicAuth_credentials() content = None - for _retry in range(punx.GITHUB_RETRY_COUNT): + for _retry in range(GITHUB_RETRY_COUNT): # noqa try: if creds is None: content = requests.get(self.zip_url, verify=False) @@ -171,16 +181,14 @@ class GitHub_Repository_Reference(object): return content def _make_zip_url(self, ref=DEFAULT_BRANCH_NAME): - 'create the download URL for the ``ref``' + """create the download URL for the ``ref``""" url = u'https://github.com/' url += u'/'.join([self.orgName, self.appName, u'archive', ref]) url += u'.zip' return url def _get_last_modified(self): - ''' - get the ``last_modified`` date from the SHA's commit - ''' + """get the ``last_modified`` date from the SHA's commit""" if self.sha is not None: commit = self.repo.get_commit(self.sha) mod_date_time = commit.last_modified # Tue, 20 Dec 2016 18:30:29 GMT @@ -189,11 +197,11 @@ class GitHub_Repository_Reference(object): self.last_modified = str(mod_date_time) def get_branch(self, ref=DEFAULT_BRANCH_NAME): - ''' + """ learn the download information about the named branch :param str ref: name of branch in repository - ''' + """ try: node = self.repo.get_branch(ref) self.ref = ref @@ -206,11 +214,11 @@ class GitHub_Repository_Reference(object): return None def get_release(self, ref=DEFAULT_RELEASE_NAME): - ''' + """ learn the download information about the named release :param str ref: name of release in repository - ''' + """ try: node = self.repo.get_release(ref) self.get_tag(node.tag_name) @@ -221,11 +229,11 @@ class GitHub_Repository_Reference(object): return None def get_tag(self, ref=DEFAULT_TAG_NAME): - ''' + """ learn the download information about the named tag :param str ref: name of tag in repository - ''' + """ try: for tag in self.repo.get_tags(): if tag.name == ref: @@ -240,11 +248,11 @@ class GitHub_Repository_Reference(object): return None def get_commit(self, ref=DEFAULT_COMMIT_NAME): - ''' + """ learn the download information about the referenced commit :param str ref: name of SHA hash, first unique characters are sufficient, usually 7 or less - ''' + """ try: node = self.repo.get_commit(ref) self.ref = ref diff --git a/src/punx/h5tree.py b/src/punx/h5tree.py new file mode 100644 index 0000000000000000000000000000000000000000..078359f3be9818beb1a8937fc3c6ae27997408dd --- /dev/null +++ b/src/punx/h5tree.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2014-2018, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +""" +Describe the tree structure of any HDF5 file + +.. autosummary:: + + ~Hdf5TreeView +""" + +import os #@UnusedImport +import sys #@UnusedImport +import h5py +import numpy + +from . import utils + + +class Hdf5TreeView(object): + """ + Describe the tree structure of any HDF5 file + + Example usage showing default display:: + + mc = Hdf5TreeView(filename) + mc.array_items_shown = 5 + show_attributes = False + txt = mc.report(show_attributes) + """ + requested_filename = None + isNeXus = False + array_items_shown = 5 + + def __init__(self, filename): + """store filename and test if file is NeXus HDF5""" + self.requested_filename = filename + self.filename = None + self.show_attributes = True + if os.path.exists(filename): + self.filename = filename + self.isNeXus = utils.isNeXusFile(filename) + + def report(self, show_attributes=True): + """ + return the structure of the HDF5 file in a list of strings + + The work of parsing the datafile is done in this method. + """ + if self.filename is None: return None + self.show_attributes = show_attributes + f = h5py.File(self.filename, 'r') + txt = self.filename + if self.isNeXus: + txt += " : NeXus data file" + tree_string_list = self._renderGroup(f, txt, indentation = "") + f.close() + return tree_string_list + + def _renderGroup(self, obj, name, indentation = " "): + """return a [formatted_string] with the contents of the group""" + s = [] + nxclass = obj.attrs.get('NX_class', '') + if len(nxclass) > 0: + if isinstance(nxclass, numpy.ndarray): # attribute reported as DATATYPE SIMPLE + nxclass = nxclass[0] # convert as if DATATYPE SCALAR + nxclass = ":" + utils.decode_byte_string(nxclass) + s += [ indentation + name + nxclass ] + s += self._renderAttributes(obj, indentation) + # show datasets and links next + groups = [] + for itemname in sorted(obj): + linkref = obj.get(itemname, getlink=True) + try: + # this will fail for external links if file is not available + classref = obj.get(itemname, getclass=True) + except KeyError: + classref = None + + if classref is None: + s += [ '%s %s: external file missing' % (indentation, itemname) ] + fmt = '%s %s = %s' + s += [ fmt % (indentation, '@file', utils.decode_byte_string(linkref.filename)) ] + s += [ fmt % (indentation, '@path', utils.decode_byte_string(linkref.path)) ] + else: + value = obj.get(itemname) + if utils.isNeXusLink(value): + s += self._renderLinkedObject(value, itemname, indentation+" ") + elif utils.isHdf5Group(value) or utils.isHdf5FileObject(value): + groups.append(value) + # TODO: report external group links in the right place + # The problem is the link file and path need to be fed into the + # next call to _renderGroup(). No such design exists now for that. + elif utils.isHdf5Dataset(value): + s += self._renderDataset(value, itemname, indentation+" ") + if utils.isHdf5ExternalLink(obj, linkref): # TODO: is obj the "parent" + # When "classref" is defined, then external data is available + fmt = '%s %s = %s' + s += [ fmt % (indentation, '@file', utils.decode_byte_string(linkref.filename)) ] + s += [ fmt % (indentation, '@path', utils.decode_byte_string(linkref.path)) ] + else: + msg = "unidentified %s: %s, %s", itemname, repr(classref), repr(linkref) + raise Exception(msg) + + for value in groups: # show things that look like groups + itemname = value.name.split("/")[-1] + s += self._renderGroup(value, itemname, indentation+" ") + + return s + + def _renderAttributes(self, obj, indentation = " "): + """return a [formatted_string] with any attributes""" + s = [] + if self.show_attributes: + for name, value in obj.attrs.items(): # FIXME: for name, value in obj.attrs.iteritems(): + s.append("%s @%s = %s" % (indentation, name, utils.decode_byte_string(value))) + return s + + def _renderLinkedObject(self, obj, name, indentation = " "): + """return a [formatted_string] with the name and target of a NeXus linked object""" + s = [] + s.append("%s%s --> %s" % (indentation, name, obj.attrs['target'])) + return s + + def _renderDataset(self, dset, name, indentation = " "): + """return a [formatted_string] with the contents and structure of a dataset""" + shape = dset.shape + # dset.dtype.kind == 'S', nchar = dset.dtype.itemsize + if self.isNeXus: + if "target" in dset.attrs: + if dset.attrs['target'] != dset.name: + return ["%s%s --> %s" % (indentation, name, utils.decode_byte_string(dset.attrs['target']))] + txType = self._renderDsType(dset) + txShape = self._renderDsShape(dset) + s = [] + if dset.dtype.kind == 'S': + if isinstance(dset.value, numpy.ndarray): + value = " = %s" % utils.decode_byte_string(dset.value[0]) + else: + value = " = %s" % utils.decode_byte_string(dset.value) + s += [ "%s%s:%s%s" % (indentation, name, txType, value) ] + s += self._renderAttributes(dset, indentation) + # dset.dtype.kind == 'S', nchar = dset.dtype.itemsize + elif dset.dtype.kind == 'O': + value = " = %s" % str(dset.value) + s += [ "%s%s:%s%s" % (indentation, name, txType, value) ] + s += self._renderAttributes(dset, indentation) + elif shape == (1,): + value = " = %s" % str(dset[0]) + s += [ "%s%s:%s%s%s" % (indentation, name, txType, + txShape, value) ] + s += self._renderAttributes(dset, indentation) + else: + + if self.array_items_shown > 2: + value = self._renderArray(dset, indentation + ' ') + if len(dset.shape) < 2: + # show the array inline with the field + s += [ "%s%s:%s%s = %s" % ( + indentation, name, txType, txShape, utils.decode_byte_string(value)) ] + else: + # show multi-D arrays different + s += [ "%s%s:%s%s = __array" % ( + indentation, name, txType, txShape) ] + s += [ "%s %s = %s" % (indentation, "__array", utils.decode_byte_string(value)) ] + else: + s += [ "%s%s:%s%s = [ ... ]" % ( + indentation, name, txType, txShape) ] + + # show these after __array + s += self._renderAttributes(dset, indentation) + return s + + def _renderDsType(self, obj): + """get the storage (data) type of the dataset""" + t = str(obj.dtype) + # dset.dtype.kind == 'S', nchar = dset.dtype.itemsize + if obj.dtype.kind == 'S': # fixed-length string + t = 'char[%s]' % obj.dtype.itemsize + elif obj.dtype.kind == 'O': # variable-length string + t = 'CHAR' + if self.isNeXus: + t = 'NX_' + t.upper() + return t + + def _renderDsShape(self, obj): + """return the shape of the HDF5 dataset""" + s = obj.shape + l = [] + for dim in s: + l.append(str(dim)) + if l == ['1']: + result = "" + else: + result = "[%s]" % ",".join(l) + return result + + def _renderArray(self, obj, indentation = ' '): + """nicely format an array up to arbitrary rank""" + shape = obj.shape + r = "" + if len(shape) > 0: + r = self._renderNdArray(obj, indentation + ' ') + return r + + def _decideNumShown(self, n): + """determine how many values to show""" + if self.array_items_shown != None: + if n > self.array_items_shown: + n = self.array_items_shown - 2 + return n + + def _renderNdArray(self, obj, indentation = ' '): + """return a list of lower-dimension arrays, nicely formatted""" + + def __render(obj, rank, key, indents): + if rank == 1: + item = obj[key] + elif rank < 4: + # this replaces a lot of code: if rank == ... + indices = ', '.join( [str(key)] + (':'*(rank-1)).split() ) + part = eval('obj[%s]' % indices) + item = self._renderNdArray(part, indents + ' ') # recursion + else: + item = "rank=%d" % (rank-1) + + return item + + shape = obj.shape + rank = len(shape) + if rank < 1: return None + n = self._decideNumShown( shape[0] ) + r = [] + for i in range(n): + r.append( __render(obj, rank, i, indentation + ' ') ) + if n < shape[0]: + r.append("...") # skip over most + r.append( __render(obj, rank, -1, indentation + ' ') ) # last one + + if rank == 1: + s = str( r ) + else: + s = "[\n" + indentation + ' ' + s += ("\n" + indentation + ' ').join( r ) + s += "\n" + indentation + "]" + return s diff --git a/src/punx/ignore_now/__use_source_cache__ b/src/punx/ignore_now/__use_source_cache__ new file mode 100644 index 0000000000000000000000000000000000000000..d9e93dfa83829c8dc19deffddd7fcdbbff473258 --- /dev/null +++ b/src/punx/ignore_now/__use_source_cache__ @@ -0,0 +1,9 @@ + +Presence of this file in the source directory +informs cache.py that this is a development +directory and that only the source cache will be updated. + +If this file does not exist in the source directory, +then cache.py code will only update the user cache. + +Do NOT package this file with the sdist created from setup.py. diff --git a/src/punx/analyze.py b/src/punx/ignore_now/analyze.py similarity index 100% rename from src/punx/analyze.py rename to src/punx/ignore_now/analyze.py diff --git a/src/punx/cache.py b/src/punx/ignore_now/cache.py similarity index 100% rename from src/punx/cache.py rename to src/punx/ignore_now/cache.py diff --git a/src/punx/dev_main.py b/src/punx/ignore_now/dev_main.py similarity index 100% rename from src/punx/dev_main.py rename to src/punx/ignore_now/dev_main.py diff --git a/src/punx/ignore_now/finding.py b/src/punx/ignore_now/finding.py new file mode 100644 index 0000000000000000000000000000000000000000..b90e1a47d8b9a3fcc9b4560e36f3cd60def5a1ed --- /dev/null +++ b/src/punx/ignore_now/finding.py @@ -0,0 +1,104 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2016, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +''' +document each item during validation + +.. autosummary:: + + ~Finding + ~CheckupResults + ~VALID_STATUS_DICT + +''' + + +class ValidationResultStatus(object): + ''' + summary result of a Finding + + :param str key: short name + :param str color: suggested color for GUI + :param str description: one-line summary + ''' + + def __init__(self, key, color, description): + self.key = key + self.color = color + self.description = description + + def __str__(self, *args, **kwargs): + return self.key + + +OK = ValidationResultStatus('OK', 'green', 'meets NeXus specification') +NOTE = ValidationResultStatus('NOTE', 'palegreen', 'does not meet NeXus specification, but acceptable') +WARN = ValidationResultStatus('WARN', 'yellow', 'does not meet NeXus specification, not generally acceptable') +ERROR = ValidationResultStatus('ERROR', 'red', 'violates NeXus specification') +TODO = ValidationResultStatus('TODO', 'blue', 'validation not implemented yet') +UNUSED = ValidationResultStatus('UNUSED', 'grey', 'optional NeXus item not used in data file') +COMMENT = ValidationResultStatus('COMMENT', 'grey', 'comment from the punx source code') + +VALID_STATUS_LIST = (OK, NOTE, WARN, ERROR, TODO, UNUSED, COMMENT) +VALID_STATUS_DICT = {str(f): f for f in VALID_STATUS_LIST} +'''dictionary (by names) of all available findings''' + +TF_RESULT = {True: OK, False: ERROR} + +# SHOW_ALL = VALID_STATUS_LIST +# SHOW_ERRORS = (ERROR, WARN) +# SHOW_NOT_OK = (WARN, ERROR, TODO, UNUSED) + + +class Finding(object): + ''' + a single reported observation while validating + + :param str test_name: one-word description of the test + :param str h5_address: address of h5py item + :param int status: one of: OK NOTE WARNING ERROR TODO + :param str comment: description + ''' + + def __init__(self, test_name, h5_address, status, comment): + if status not in VALID_STATUS_LIST: + msg = 'unknown status value: ' + status + raise ValueError(msg) + self.test_name = str(test_name) + self.h5_address = h5_address + self.status = status + self.comment = comment + + def __str__(self, *args, **kwargs): + try: + s = self.h5_address + s += ' ' + str(self.status) + s += ': ' + self.test_name + s += ': ' + self.comment + return s + except Exception as _exc: + return object.__str__(self, *args, **kwargs) + + +class CheckupResults(object): + ''' + various checkups for a single hdf5 address (absolute path) + + :param str h5_address: address of h5py item + ''' + + def __init__(self, h5_address): + self.h5_address = h5_address + self.findings = [] # keep list of all findings for this address + self.classpath = '' + + def __str__(self, *args, **kwargs): + return self.h5_address diff --git a/src/punx/h5structure.py b/src/punx/ignore_now/h5structure.py similarity index 100% rename from src/punx/h5structure.py rename to src/punx/ignore_now/h5structure.py diff --git a/src/punx/ignore_now/main.py b/src/punx/ignore_now/main.py new file mode 100644 index 0000000000000000000000000000000000000000..d086aa181cb16c3fa55f20104e7f14ff54bbed85 --- /dev/null +++ b/src/punx/ignore_now/main.py @@ -0,0 +1,414 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2016, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +''' +Python Utilities for NeXus HDF5 files + +main user interface file + +.. rubric:: Usage + +:: + + usage: punx [-h] [-v] {hierarchy,show,structure,update,validate} ... + + Python Utilities for NeXus HDF5 files URL: http://punx.readthedocs.io + v0.0.1+4.gff00892.dirty + + optional arguments: + -h, --help show this help message and exit + -v, --version show program's version number and exit + + subcommands: + valid subcommands + + {demonstrate,structure,update,validate} + demonstrate demonstrate HDF5 file validation + structure show structure of HDF5 or NXDL file + update update the local cache of NeXus definitions + validate validate a NeXus file + +.. autosummary:: + + ~main + ~MyArgumentParser + ~parse_command_line_arguments + ~interceptor_logfile + ~func_demo + ~func_hierarchy + ~func_show + ~func_structure + ~func_update + ~func_validate + +''' + +import argparse +import os +import sys + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +import punx +from punx import finding +from punx import logs + + +CONSOLE_LOGGING_DEFAULT_CHOICE = '__console__' + + +# :see: https://docs.python.org/2/library/argparse.html#sub-commands +# obvious 1st implementations are h5structure and update + + +def exit_message(msg, status=None, exit_code=1): + ''' + exit this code with a message and a status + + :param str msg: text to be reported + :param int status: 0 - 50 (default: punx.ERROR = 40) + :param int exit_code: 0: no error, 1: error (default) + ''' + if status is None: + status = punx.ERROR + punx.LOG_MESSAGE(msg, status) + if punx.LOG_MESSAGE != logs.to_console: + print(msg) + exit(exit_code) + + +def func_demo(args): + ''' + show what **punx** can do + + .. index:: demo + + Internally, runs these commands:: + + punx validate <source_directory>/data/writer_1_3.hdf5 + punx structure <source_directory>/data/writer_1_3.hdf5 + + .. index:: cache update + + If you get an error message that looks like this one (line breaks added here for clarity:: + + punx.cache.FileNotFound: file does not exist: + /Users/<username>/.config/punx/definitions-master/nxdl.xsd + AND not found in source cache either! Report this problem to the developer. + + then you will need to update your local cache of the NeXus definitions. + Use this command to update the local cache:: + + punx update + + ''' + path = os.path.dirname(__file__) + args.infile = os.path.abspath(os.path.join(path, 'data', 'writer_1_3.hdf5')) + + print('console> punx validate ' + args.infile) + args.report = ','.join(sorted(finding.VALID_STATUS_DICT.keys())) + func_validate(args) + del args.report + + print('console> punx structure ' + args.infile) + from punx import h5structure + mc = h5structure.h5structure(args.infile) + # :param bool show_attributes: display attributes in output + show_attributes=True + mc.array_items_shown = 5 + print('\n'.join(mc.report(show_attributes))) + + +def func_hierarchy(args): + url = 'http://punx.readthedocs.io/en/latest/analyze.html' + print('A chart of the NeXus hierarchy is in the **punx** documentation.') + print('see: ' + url) + # TODO: issue #1 & #10 show NeXus base class hierarchy from a given base class + + +def func_show(args): + print('still in development -- not implemented yet') + print(args) + + +def func_structure(args): + if args.infile.endswith('.nxdl.xml'): + from punx import nxdlstructure + nxdl = nxdlstructure.NX_definition(args.infile) + print(nxdl.render()) + else: + from punx import h5structure + + # :param int limit: maximum number of array items to be shown (default = 5) + limit = args.max_array_items + # :param bool show_attributes: display attributes in output + show_attributes=True + + try: + mc = h5structure.h5structure(os.path.abspath(args.infile)) + except punx.FileNotFound: + exit_message('File not found: ' + args.infile) + mc.array_items_shown = limit + try: + report = mc.report(show_attributes) + except punx.HDF5_Open_Error: + exit_message('Could not open as HDF5: ' + args.infile) + print('\n'.join(report or '')) + + +def func_update(args): + from punx import cache + cache.update_NXDL_Cache(force_update=args.force) + + +def func_validate(args): + from punx import validate + + if args.infile.endswith('.nxdl.xml'): + result = validate.validate_xml(args.infile) + if result is None: + print(args.infile, ' validates') + else: + try: + validator = validate.Data_File_Validator(args.infile) + except punx.FileNotFound: + exit_message('File not found: ' + args.infile) + except punx.HDF5_Open_Error: + exit_message('Could not open as HDF5: ' + args.infile) + except punx.SchemaNotFound as _exc: + exit_message(str(_exc)) + + # determine which findings are to be reported + report_choices, trouble = [], [] + for c in args.report.upper().split(','): + if c in finding.VALID_STATUS_DICT: + report_choices.append(finding.VALID_STATUS_DICT[c]) + else: + trouble.append(c) + if len(trouble) > 0: + msg = 'invalid choice(s) for *--report* option: ' + msg += ','.join(trouble) + msg += '\n' + msg += '\t' + 'available choices: ' + msg += ','.join(sorted(finding.VALID_STATUS_DICT.keys())) + exit_message(msg) + + # run the validation + validator.validate() + + # report the findings from the validation + from punx import cache_manager + cm = cache_manager.CacheManager() + print(':file: ' + os.path.basename(validator.fname)) + msg = cm.default_file_set.ref_type + msg += ' ' + cm.default_file_set.ref + msg += ', ' + cache_manager.get_short_sha(cm.default_file_set.sha) + msg += ', ' + cm.default_file_set.cache + ' cache' + print(':NXDL cache info: ' + msg) + print(':NXDL GIT sha: ' + cm.default_file_set.sha) + print(':NXDL GIT date/time: ' + cm.default_file_set.last_modified) + print(':validation results shown: ' + ' '.join(sorted(map(str, report_choices)))) + print('') + print('Validation findings') + print(validator.report_findings(report_choices)) + + print('summary statistics') + print(validator.report_findings_summary()) + + +class MyArgumentParser(argparse.ArgumentParser): + ''' + override standard ArgumentParser to enable shortcut feature + + stretch goal: permit the first two char (or more) of each subcommand to be accepted + # ?? http://stackoverflow.com/questions/4114996/python-argparse-nargs-or-depending-on-prior-argument?rq=1 + ''' + + def parse_args(self, args=None, namespace=None): + ''' + permit the first two char (or more) of each subcommand to be accepted + ''' + if args is None and len(sys.argv) > 1 and not sys.argv[1].startswith('-'): + # TODO: issue #8: make more robust for variations in optional commands + sub_cmd = sys.argv[1] + # make a list of the available subcommand names + choices = [] + for g in self._subparsers._group_actions: + if isinstance(g, argparse._SubParsersAction): + #choices = g._name_parser_map.keys() + choices = g.choices.keys() + break + if len(choices) > 0 and sub_cmd not in choices: + if len(sub_cmd) < 2: + msg = 'subcommand too short, must match first 2 or more characters, given: %s' + self.error(msg % ' '.join(sys.argv[1:])) + # look for any matches + matches = [c for c in choices if c.startswith(sub_cmd)] + # validate the match is unique + if len(matches) == 0: + msg = 'subcommand unrecognized, given: %s' + self.error(msg % ' '.join(sys.argv[1:])) + elif len(matches) > 1: + msg = 'subcommand ambiguous (matches: %s)' % ' | '.join(matches) + msg += ', given: %s' + self.error(msg % ' '.join(sys.argv[1:])) + else: + sub_cmd = matches[0] + # re-assign the subcommand + sys.argv[1] = sub_cmd + return argparse.ArgumentParser.parse_args(self, args, namespace) + + +def parse_command_line_arguments(): + '''process command line''' + doc = __doc__.strip().splitlines()[0] + doc += '\n version: ' + punx.__version__ + doc += '\n URL: ' + punx.__url__ + epilog = 'Note: It is only necessary to use the first two (or' + epilog += ' more) characters of any subcommand, enough that the' + epilog += ' abbreviation is unique. ' + epilog += ' Such as: ``demonstrate`` can be abbreviated to' + epilog += ' ``demo`` or even ``de``.' + p = MyArgumentParser(prog=punx.__package_name__, + description=doc, + epilog=epilog) + + p.add_argument('-v', + '--version', + action='version', + version=punx.__version__) + + def add_logging_argument(subp): + ''' + common code to add option for logging program output + ''' + import logging + help_text = 'log output to file (default: no log file)' + subp.add_argument('-l', '--logfile', + default=CONSOLE_LOGGING_DEFAULT_CHOICE, + nargs='?', + help=help_text) + + level = punx.DEFAULT_LOG_LEVEL + help_text = 'logging interest level (%d - %d), default=%d (%s)' + help_text = help_text % (punx.NOISY, + punx.CRITICAL, + punx.DEFAULT_LOG_LEVEL, + logging.getLevelName(level) + ) + subp.add_argument('-i', '--interest', + default=level, + type=int, + #choices=range(1,51), + help=help_text) + + # TODO: issue #9, stretch goal: GUI for any of this + # p.add_argument('-g', + # '--gui', + # help='graphical user interface (TBA)') + + subcommand = p.add_subparsers(title='subcommand', description='valid subcommands',) + + + ### subcommand: demo + p_demo = subcommand.add_parser('demonstrate', help='demonstrate HDF5 file validation') + add_logging_argument(p_demo) + p_demo.set_defaults(func=func_demo) + + +# ### subcommand: hierarchy +# # TODO: issue #1 & #10 +# help_text = 'show NeXus base class hierarchy from a given base class' +# p_hierarchy = subcommand.add_parser('hierarchy', help=help_text) +# p_hierarchy.set_defaults(func=func_hierarchy) +# #p_hierarchy.add_argument('something', type=bool, help='something help_text') + + + ### subcommand: show +# # TODO: issue #11 +# p_show = subcommand.add_parser('show', help='show program information (about the cache)') +# p_show.set_defaults(func=func_show) +# # p_show.add_argument('details', type=bool, help='details help_text') + + + ### subcommand: structure + help_text = 'show structure of HDF5 or NXDL file' + p_structure = subcommand.add_parser('structure', help=help_text) + p_structure.set_defaults(func=func_structure) + p_structure.add_argument('infile', help="HDF5 or NXDL file name") + p_structure.add_argument('-a', + action='store_false', + default=True, + dest='show_attributes', + help='Do not print attributes of HDF5 file structure') + help_text = 'maximum number of array items to be shown' + p_structure.add_argument('-m', '--max_array_items', + default=5, + type=int, + #choices=range(1,51), + help=help_text) + add_logging_argument(p_structure) + + + ### subcommand: update + help_text = 'update the local cache of NeXus definitions' + p_update = subcommand.add_parser('update', help=help_text) + p_update.set_defaults(func=func_update) + p_update.add_argument('-f', '--force', + action='store_true', + default=False, + help='force update (if GitHub available)') + add_logging_argument(p_update) + + + ### subcommand: validate + p_validate = subcommand.add_parser('validate', help='validate a NeXus file') + p_validate.add_argument('infile', help="HDF5 or NXDL file name") + p_validate.set_defaults(func=func_validate) + reporting_choices = ','.join(sorted(finding.VALID_STATUS_DICT.keys())) + help_text = 'select which validation findings to report, choices: ' + help_text += reporting_choices + p_validate.add_argument('--report', default=reporting_choices, help=help_text) + add_logging_argument(p_validate) + + return p.parse_args() + + +def interceptor_logfile(args): + ''' + special handling for subcommands with a *logfile* option + ''' + if 'logfile' in args: + if args.logfile == CONSOLE_LOGGING_DEFAULT_CHOICE: + punx.DEFAULT_LOG_LEVEL = args.interest + punx.LOG_MESSAGE = logs.to_console + punx.LOG_MESSAGE('logging output to console only', punx.DEBUG) + else: + lo = punx.NOISY + hi = punx.CRITICAL + args.interest = max(lo, min(hi, args.interest)) + _log = logs.Logger(log_file=args.logfile, level=args.interest) + punx.LOG_MESSAGE('sys.argv: ' + ' '.join(sys.argv), punx.DEBUG) + punx.LOG_MESSAGE('args: ' + str(args), punx.DEBUG) + + +def main(): + args = parse_command_line_arguments() + + # special handling for logging program output + interceptor_logfile(args) + + args.func(args) + + +if __name__ == '__main__': + main() diff --git a/src/punx/nxdl_rules.py b/src/punx/ignore_now/nxdl_rules.py similarity index 100% rename from src/punx/nxdl_rules.py rename to src/punx/ignore_now/nxdl_rules.py diff --git a/src/punx/nxdlstructure.py b/src/punx/ignore_now/nxdlstructure.py similarity index 100% rename from src/punx/nxdlstructure.py rename to src/punx/ignore_now/nxdlstructure.py diff --git a/src/punx/settings.py b/src/punx/ignore_now/settings.py similarity index 100% rename from src/punx/settings.py rename to src/punx/ignore_now/settings.py diff --git a/src/punx/ignore_now/validate.py b/src/punx/ignore_now/validate.py new file mode 100644 index 0000000000000000000000000000000000000000..c9f826fd8467ae896c02b9aacaf8d48ca9e84f28 --- /dev/null +++ b/src/punx/ignore_now/validate.py @@ -0,0 +1,1340 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2016, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +''' +validate NeXus NXDL and HDF5 data files + +.. autosummary:: + + ~validate_xml + ~NxdlPattern + ~CustomNxdlPattern + ~Data_File_Validator + +.. rubric:: CHECKLIST + +These are considerata for the validation of NeXus HDF5 data files. +Compare these validation steps with rules and documentation +in the NeXus manual and the XML Schema files (``nxdl.xsd`` and ``nxdlTypes.xsd``). +Checkboxes indicate which steps have been implemented in code below. + +* [x] make a list of all address nodes in the file to be evaluated +* [x] attributes are also in this list +* [x] use a structure to hold results for each node + +.. rubric:: File + +#. [x] verify attributes +#. [x] verify file level as group using NX_class = NXroot +#. [ ] identify any objects at root level that are not in NXroot (which is OK) +#. [x] verify default plot identified + + #. [x] version 1 + #. [x] version 2 + #. [x] version 3 + #. [x] version 3+niac2014 + +.. rubric:: Groups + +#. [x] compare name with pattern *validItemName* +#. [x] determine NX_class, if any +#. [x] verify NX_class in nxdl_dict +#. [ ] is name flexible? +#. [ ] What to do with NXDL symbol tables? +#. [x] observe attribute: minOccurs +#. [ ] observe attribute: maxOccurs +#. [ ] check for items defined by NX_class +#. [ ] check for items required by NX_class +#. [ ] check for items not defined by NX_class +#. [x] observe NXDL specification: ignoreExtraGroups +#. [x] observe NXDL specification: ignoreExtraFields +#. [x] observe NXDL specification: ignoreExtraAttributes +#. [x] validate any attributes +#. [x] validate any links +#. [x] validate any fields + +.. rubric:: Links + +#. [x] compare name with pattern *validItemName* +#. [ ] is name flexible? +#. [x] is target attribute defined? +#. [x] is target address absolute? +#. [x] does target address exist? +#. [ ] construct NX classpath from target +#. [ ] compare NX classpath with NXDL specification + +.. rubric:: Fields + +#. [x] compare name with pattern +#. [x] is name flexible? +#. [x] observe attribute: minOccurs +#. [x] is units attribute defined? +#. [x] check units are consistent against NXDL +#. [x] check data shape against NXDL +#. [x] check data type against NXDL +#. [x] check for attributes defined by NXDL +#. [x] check AXISNAME_indices are each within signal data rank + +.. rubric:: Attributes + +#. [x] compare name with pattern +#. [ ] check data type against NXDL +#. [ ] check nxdl.xsd for how to handle these attributes regarding finding.WARN +''' + +import collections +import h5py +import lxml.etree +import numpy +import os +import re +import sys + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +import punx +from punx import finding +from punx import h5structure + +# TODO: issue #14: http://download.nexusformat.org/doc/html/search.html?q=warning&check_keywords=yes&area=default + +__url__ = 'http://punx.readthedocs.org/en/latest/validate.html' + + +def validate_xml(xml_file_name): + ''' + validate an NXDL XML file against an XML Schema file + + :param str xml_file_name: name of XML file + ''' + from punx import cache + xml_tree = lxml.etree.parse(xml_file_name) + xsd = cache.get_XML_Schema() + try: + result = xsd.assertValid(xml_tree) + except lxml.etree.DocumentInvalid as exc: + msg = 'DocumentInvalid:\n' + msg += 'file: ' + xml_file_name + '\n' + msg += str(exc) + raise punx.InvalidNxdlFile(msg) + return result + + +class NxdlPattern(object): + ''' + common regular expression pattern for validation + + :param obj parent: instance of :class:`Data_File_Validator` + :param str pname: pattern identifying name + :param str xpath_str: XPath search string, expect list of length = 1 + ''' + + def __init__(self, parent, pname, xpath_str): + from punx import cache + self.name = pname + self.xpath_str = xpath_str + rules = cache.get_nxdl_xsd() + + r = rules.xpath(xpath_str, namespaces=parent.ns) + + if r is None or len(r) != 1: + msg = 'could not read *' + pname + '* from *nxdl.xsd*' + raise ValueError(msg) + + self.regexp_pattern_str = r[0].attrib.get('value', None) + self.re_obj = re.compile('^' + self.regexp_pattern_str + '$') + + def match(self, text): + '''regular expression search''' + return self.re_obj.match(text) + + +class CustomNxdlPattern(NxdlPattern): + ''' + custom regular expression pattern for validation + + :param obj parent: instance of :class:`Data_File_Validator` + :param str pname: pattern identifying name + :param str regexp_pattern_str: regular expression to match + ''' + + def __init__(self, parent, pname, regexp_pattern_str): + self.name = pname + self.xpath_str = None + + self.regexp_pattern_str = regexp_pattern_str + self.re_obj = re.compile('^' + self.regexp_pattern_str + '$') + + def match(self, text): + '''regular expression search''' + return self.re_obj.match(text) + + +class Data_File_Validator(object): + ''' + manage the validation of a NeXus HDF5 data file + ''' + + def __init__(self, fname): + from punx import cache + from punx import nxdlstructure + if not os.path.exists(fname): + raise punx.FileNotFound(fname) + self.fname = fname + + self.findings = [] # list of Finding() instances + self.addresses = collections.OrderedDict() # dictionary of all HDF5 address nodes in the data file + + self.ns = cache.NX_DICT + self.nxdl_rules = nxdlstructure.get_nxdl_rules() + self.get_data_types() + self.nxdl_dict = nxdlstructure.get_NXDL_specifications() + + try: + self.h5 = h5py.File(fname, 'r') + except IOError: + raise punx.HDF5_Open_Error(fname) + self._init_patterns() + + def _init_patterns(self): + self.patterns = {} + for item in ('validItemName', 'validNXClassName', + 'validTargetName'): + xps = '//*[@name="' # XPath String query + xps += item + xps += '"]/xs:restriction/xs:pattern' + self.patterns[item] = NxdlPattern(self, item, xps) + + # strict match: [a-z_][a-z\d_]* + # flexible match: [A-Za-z_][\w_]* but gets finding.WARN per manual + # advisory changed to finding.NOTE + p = CustomNxdlPattern(self, 'validItemName-strict', r'[a-z_][a-z0-9_]*') + self.patterns[p.name] = p + self.__unique_findings__ = {} + + + def close(self): + if self.h5 is not None: + self.h5.close() + self.h5 = None + + def get_data_types(self): + ''' + generate dictionary of acceptable Python data types, based on NeXus data type keys + ''' + # Is there a better way to define these? Using nxdlTypes.xsd? + # TODO: #21 : augment from self.nxdl_rules.nxdlTypes + + self.data_types = { + 'NX_CHAR': [str, numpy.string_, numpy.ndarray], + 'NX_UINT': (numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64), + 'NX_INT': (int, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.int64), + 'NX_FLOAT': (float, numpy.float, numpy.float16, numpy.float32, numpy.float64), + 'NX_BINARY': (None, ), # #FIXME: + 'NX_BOOLEAN': (None, ), # FIXME: + } + if sys.version_info.major == 2: # python2 only + self.data_types['NX_CHAR'].append(unicode) # not in python3 + # definitions dependent on other definitions + # (can add the lists together as needed) + self.data_types['NX_INT'] += self.data_types['NX_UINT'] + self.data_types['NX_POSINT'] = self.data_types['NX_INT'] # need to restrict this + self.data_types['NX_NUMBER'] = self.data_types['NX_INT'] + self.data_types['NX_FLOAT'] + self.data_types['ISO8601'] = self.data_types['NX_CHAR'] + self.data_types['NX_DATE_TIME'] = self.data_types['NX_CHAR'] + + def validate(self): + ''' + start the validation process from the file root + ''' + self.validate_HDF5_group(self.h5) + t = self.validate_default_plot() + f = finding.TF_RESULT[t] + title = "* valid NeXus data file" + msg = 'This file is ' + if not t: + msg += 'not ' + title = "!" + title[1:] + msg += 'valid by the NeXus standard.' + self.new_finding(title, "/", f, msg) + + def validate_HDF5_group(self, group): + ''' + review the HDF5 group: group + + :param obj group: instance of h5py.File of h5py.Group + + Verify that items presented in data file are valid. + ''' + nx_class_name = self.get_hdf5_attribute(group, 'NX_class', report=True) + if nx_class_name is None: + if isinstance(group, h5py.File): + nx_class_name = 'NXroot' + msg = 'file root (assumed): NXroot' + self.new_finding('@NX_class', group.name, finding.OK, msg) + else: + self.validate_item_name(group.name, 'validNXClassName') + msg = 'no @NX_class attribute, not a NeXus group' + self.new_finding('@NX_class', group.name, finding.NOTE, msg) + return # evaluate any further? + else: + self.validate_item_name(group.name) + + aname = group.name + '@NX_class' + t = nx_class_name in self.nxdl_dict + f = finding.TF_RESULT[t] + msg = {True: 'known: ', False: 'unknown: '}[t] + str(nx_class_name) + self.new_finding('@NX_class', aname, f, msg) + + nx_class_object = self.nxdl_dict.get(nx_class_name) + if nx_class_object is None: + msg = 'ignoring content in group not defined by NeXus' + self.new_finding('not NeXus group', group.name, finding.UNUSED, msg) + return # ignore content in HDF5 groups that are not NeXus classes + + nx_class_defaults = nx_class_object.attributes['defaults'] + + for k in group.attrs.keys(): # review the group's attributes + k = punx.h5structure.decode_byte_string(k) + if k in ('NX_class', ): + pass # handled elsewhere + else: + aname = group.name + '@' + k + if not nx_class_defaults['ignoreExtraAttributes']: + # TODO: don't validate attribute names defined in NXDL rules! + self.validate_item_name(k, parent=group) + if k == 'default' and nx_class_name in ('NXroot', 'NXentry', 'NXsubentry'): + target = self.get_hdf5_attribute(group, 'default') + t = target in group + f = {True: finding.OK, False: finding.ERROR}[t] + msg = {True: 'exists: ', False: 'does not exist: '}[t] + target + self.new_finding('default plot group', aname, f, msg) + + for child_name in group: # review the group's children + try: + child = group[child_name] + except KeyError as _exc: + if True: + filename = self.missing_file_link(str(_exc)) + if filename is not None: + title = 'external file link' + msg = 'missing file: ' + filename + self.new_finding(title, group.name+'/'+child_name, finding.ERROR, msg) + continue + if h5structure.isNeXusLink(child): + if nx_class_defaults['ignoreExtraGroups']: # TODO: Is this proper for links? + title = nx_class_name+'@ignoreExtraGroups' + msg = 'link ignored per NXDL specification' + self.new_finding(title, child.name, finding.UNUSED, msg) + else: + self.validate_NeXus_link(child, group) + elif h5structure.isHdf5Group(child): + if nx_class_defaults['ignoreExtraGroups']: + title = nx_class_name+'@ignoreExtraGroups' + msg = 'subgroup ignored per NXDL specification' + self.new_finding(title, child.name, finding.UNUSED, msg) + else: + self.validate_HDF5_group(child) + elif h5structure.isHdf5Dataset(child): + if nx_class_defaults['ignoreExtraFields']: + title = nx_class_name+'@ignoreExtraFields' + msg = 'field ignored per NXDL specification' + self.new_finding(title, child.name, finding.UNUSED, msg) + else: + self.validate_HDF5_dataset(child, group) + else: + msg = str(_exc) + '\n' + 'unexpected: ' + child.name + raise ValueError(msg) + + self.validate_NXDL_specification(group, nx_class_name) + # FIXME: need special handling for application definitions +# if nx_class_name in ('NXsubentry', 'NXentry') and 'definition' in group: +# # application definition masquerading as NXentry or NXsubentry +# app_def_name = group['definition'][0] +# self.validate_NXDL_specification(group, app_def_name) + + def validate_HDF5_dataset(self, dataset, group): + ''' + review the HDF5 dataset: dataset + + :param obj dataset: instance of h5py.Dataset + :param obj group: instance of h5py.Group or h5py.File, needed to check against NXDL + ''' + self.validate_item_name(dataset.name) + field_rules = self.nxdl_rules.nxdl.children['field'] + nx_class_name = self.get_hdf5_attribute(group, 'NX_class') + nx_class_object = self.nxdl_dict.get(nx_class_name) + + for k in dataset.attrs.keys(): # review the dataset's attributes + k = punx.h5structure.decode_byte_string(k) + aname = dataset.name + '@' + k + self.validate_item_name(k, parent=dataset) + v = self.get_hdf5_attribute(dataset, k, report=True) + if k in field_rules.attrs: + rules = field_rules.attrs[k] + if len(rules.enum) > 0: + t = v in rules.enum + f = {True: finding.OK, False: finding.WARN}[t] + msg = 'value=' + v + if t: + msg += ' :recognized' + else: + msg += ' : expected one of these: ' + '|'.join(rules.enum) + self.new_finding('enumeration: @' + k, aname, f, msg) + else: + if k not in ('target',): # link target attribute checked elsewhere + if nx_class_object is not None: # only check if NXDL exists + if nx_class_object.attributes['defaults']['ignoreExtraAttributes']: + msg = 'attribute ignored per NXDL specification' + self.new_finding(nx_class_name + '@ignoreExtraAttributes', aname, finding.NOTE, msg) + else: + msg = 'attribute not defined in NXDL' + self.new_finding(nx_class_name + '@' + k, aname, finding.NOTE, msg) + + self.validate_numerical_dataset(dataset, group) + + # check the type of this field + # https://github.com/prjemian/punx/blob/b595fdf9910dbab113cfe8febbb37e6c5b48d74f/src/punx/validate.py#L761 + + # review the dataset's content + nx_class_name = self.get_hdf5_attribute(group, 'NX_class') + if nx_class_name in self.nxdl_dict: + nx_class = self.nxdl_dict[nx_class_name] + rules = nx_class.fields.get(dataset.name.split('/')[-1]) + if rules is not None: + if len(rules.enum) > 0: + pass # TODO: + defaults = rules.attributes['defaults'] + nx_type = defaults['type'] # TODO: check for this + minO = defaults['minOccurs'] # TODO: check for this + # in either case, validation of maxOccurs for datasets is not informative + # HDF5 will not allow more than one instance of a name within a group + # maxOccurs: is either 1 or, if name is flexible, unbounded + + isSpecifiedName = defaults['nameType'] == 'specified' + f = finding.OK + msg = 'name is ' + {True: 'specified', False: 'flexible'}[isSpecifiedName] + self.new_finding('@nameType', dataset.name, f, msg) + + def validate_NeXus_link(self, link, group): + ''' + review the NeXus link: link + + :param obj link: instance of h5py.Group or h5py.Dataset + :param obj group: instance of h5py.Group, needed to check against NXDL + ''' + self.validate_item_name(link.name, 'validTargetName') + + target = self.get_hdf5_attribute(link, 'target', report=True) + if target is not None: + aname = link.name + '@target' + target_exists = target in self.h5 + f = finding.TF_RESULT[target_exists] + msg = {True: target, False: 'does not exist'}[target_exists] + self.new_finding('link target exists', aname, f, msg) + else: + self.new_finding('link', link.name, finding.ERROR, 'no target') + + def validate_NXDL_specification(self, group, nx_class_name): + ''' + validate the group with the NXDL specification + + :param obj group: instance of h5py.Group or h5py.File + :param str nx_class_name: name of a NeXus NXDL class + + Verify that items specified in NXDL file are present in the data file. + ''' + nx_class_object = self.nxdl_dict.get(nx_class_name) + if nx_class_object is None: + return + + msg = 'validate with ' + nx_class_name + ' specification (incomplete)' + self.new_finding('NXDL review', group.name, finding.TODO, msg) + + # specified group attributes are handled elsewhere + # group_defaults = nx_class_object.attributes['defaults'] + + # validate provided, required, and optional fields + for field_name, rules in sorted(nx_class_object.fields.items()): + self.validate_NXDL_field_specification(field_name, group, rules) + + # validate provided, required, and optional groups (recursive as directed) + for subgroup_name, rules in nx_class_object.groups.items(): + self.validate_NXDL_group_specification(subgroup_name, group, rules) + + def validate_NXDL_group_specification(self, subgroup_name, group, rules): + ''' + validate the group/subgroup with the NXDL specification + + :param str subgroup_name: name of subgroup in group + :param obj group: instance of h5py.Group or h5py.File + :param obj rules: instance of nxdlstructure.NX_group + + Verify this HDF5 group conforms to the NXDL specification + ''' + #nx_class_name = self.get_hdf5_attribute(group, 'NX_class') + defaults = rules.attributes['defaults'] + target_exists = subgroup_name in group + + deprecated = defaults['deprecated'] + if deprecated is not None: + if target_exists: + obj = group[subgroup_name] + nm = '/'.join(rules.NX_class, subgroup_name) + '@deprecated' + self.new_finding(nm, obj.name, finding.NOTE, deprecated) + + minO = defaults['minOccurs'] + maxO = defaults['maxOccurs'] + if int(minO) > 0: + if defaults['name'] is None: + matches = [node for node in group.values() if h5structure.isNeXusGroup(node, rules.NX_class)] + if len(matches) < int(minO): + nm = group.name + m = 'must have at least ' + str(minO) + ' group: ' + rules.NX_class + f = finding.WARN + self.new_finding(rules.NX_class+' required group', nm, f, m) + else: + nm = group.name + '/' + subgroup_name + f = {True: finding.OK, False: finding.WARN}[target_exists] + m = rules.NX_class + {True: ' found', False: ' not found'}[target_exists] + self.new_finding(rules.NX_class+' required group', nm, f, m) + if maxO == 'unbounded': + pass + # TODO: what else? + + def validate_NXDL_field_specification(self, field_name, group, rules): + ''' + validate the group/field with the NXDL specification + + :param str field_name: name of field in group + :param obj group: instance of h5py.Group or h5py.File + :param obj rules: instance of nxdlstructure.NX_field + + Verify this HDF5 field conforms to the NXDL specification + ''' + nx_class_name = self.get_hdf5_attribute(group, 'NX_class') + defaults = rules.attributes['defaults'] + nx_type = self.data_types[defaults['type']] + target_exists = field_name in group + if target_exists: + try: + dataset = group[field_name] + except KeyError as _exc: + filename = self.missing_file_link(str(_exc)) + if filename is not None: + title = 'external file link' + msg = 'missing file: ' + filename + self.new_finding(title, group.name+'/'+field_name, finding.ERROR, msg) + return + else: + dataset = None + nm = '/'.join((nx_class_name, field_name)) + + # check the attributes specified in NXDL rules + for k, attr in rules.attributes['nxdl.xsd'].items(): + if k in ('minOccurs maxOccurs name nameType type units'.split()): + pass + elif target_exists: + if k == 'deprecated': + m = defaults['deprecated'] + if m is not None: + self.new_finding(nm+'@deprecated', dataset.name, finding.NOTE, m) + elif k in dataset.attrs: + aname = dataset.name + '@' + k + ttl = 'NXDL attribute type: ' + ttl += '/'.join((nx_class_name, field_name)) + ttl += '@' + k + v = self.get_hdf5_attribute(dataset, k) + + # check type against NXDL + attr_type = attr.type.split(':')[-1] # strip off XML namespace prefix, if found + if attr_type not in self.data_types: + if attr_type == 'str': + attr_type = 'NX_CHAR' + else: + msg = 'type(' + aname + msg += ') = "' + attr_type + msg += '" not in known data types' + raise KeyError(msg) + t = type(v) in self.data_types[attr_type] + f = {True: finding.OK, False: finding.WARN}[t] + if isinstance(v, numpy.ndarray) and isinstance(v[0], numpy.bytes_): + m = 'byte-string' + elif isinstance(v, numpy.ndarray): + m = type(v[0]).__name__ + else: + m = type(v).__name__ + m += ' : ' + attr_type + self.new_finding(ttl, aname, f, m) + + # check if value matches enumeration + if len(attr.enum) > 0: + t = v in attr.enum + f = {True: finding.OK, False: finding.WARN}[t] + m = str(v) + if t: + m += ': expected' + else: + m += ': not in list: ' + ','.join(attr.enum) + ttl = 'NXDL attribute enum: ' + ttl += '/'.join((nx_class_name, field_name)) + ttl += '@' + k + self.new_finding(ttl, aname, f, m) + elif attr.required: + if k not in ('name', 'minOccurs', 'maxOccurs',): + nm = 'NXDL attribute: ' + '/'.join((nx_class_name, field_name)) + nm += '@' + k + m = 'required attribute not found' + self.new_finding(nm, dataset.name, finding.WARN, m) + + minO = defaults['minOccurs'] + maxO = defaults['maxOccurs'] + required_name = defaults['nameType'] == 'specified' + if int(minO) > 0 and required_name: + f = {True: finding.OK, False: finding.WARN}[target_exists] + m = {True: '', False: ' not'}[target_exists] + ' found' + nm = group.name + '/' + field_name + self.new_finding(nx_class_name+' required field', nm, f, m) + + t = len(dataset.shape) == len(rules.dims) # check rank against specification + f = {True: finding.OK, False: finding.WARN}[t] # TODO: ? change WARN to NOTE ? + m = {True: 'matches', False: 'does not match'}[target_exists] + ' NXDL specification' + self.new_finding(nx_class_name+' field rank', nm, f, m) + + if target_exists: + if str(dataset.dtype).startswith('|S'): + t = type('numpy string array') in nx_type + m = 'str' + elif str(dataset.dtype).startswith('|O'): + t = type(dataset[0]) in nx_type + m = 'str' + else: + t = dataset.dtype in nx_type + m = str(dataset.dtype) + if 'object' == m: + if dataset.ndim == 0: + m = type(dataset.value).__name__ + else: + m = type(dataset[0]).__name__ + if 'unicode' == m: + m = 'str' + f = {True: finding.OK, False: finding.WARN}[t] + m += {True: ' : ', False: ' not '}[t] + defaults['type'] + nm = group.name + '/' + field_name + ttl = '/'.join((nx_class_name, field_name)) + self.new_finding('NXDL data type: '+ttl, nm, f, m) + + # TODO: #16 check if unknown names are allowed to be flexible + + def validate_item_name(self, h5_addr, key=None, parent=None): + ''' + validate *h5_addr* using *validItemName* regular expression + + This is used for the names of groups, fields, links, and attributes. + + :param str h5_addr: full HDF5 address of item, for reference only, + for attributes, use an @ symbol, such as these examples: + + ============================= ============ + *h5_addr* *short_name* + ============================= ============ + ``/entry/user`` ``user`` + ``/entry/data01/data`` ``data`` + ``/entry/data01/data@signal`` ``signal`` + ============================= ============ + + :param str key: named key to search, default: None (``validItemName``) + :param obj parent: HDF5 parent object, default: None + + This method will separate out the last part of the name for validation. + Then, it is tested against the strict or relaxed regular expressions for + a valid item name. The finding for each name is classified by the + next table: + + ===== ======= ======= ================================================================ + order finding match description + ===== ======= ======= ================================================================ + 1 OK strict matches most stringent NeXus specification + 2 NOTE relaxed matches NeXus specification that is most generally accepted + 3 ERROR UTF8 specific to strings with UnicodeDecodeError (see issue #37) + 4 WARN HDF5 acceptable to HDF5 but not NeXus + ===== ======= ======= ================================================================ + + :see: http://download.nexusformat.org/doc/html/datarules.html?highlight=regular%20expression + ''' + full_name = h5_addr + if key is None: + key_relaxed = 'validItemName' + key_strict = 'validItemName-strict' + + short_name = h5_addr.split('/')[-1] + if parent is not None: + full_name = parent.name + '@' + h5_addr + + if short_name == 'NX_class': + # special case + self.new_finding('NeXus internal attribute', + full_name, + finding.OK, + 'marks this HDF5 group as NeXus group') + return + + # strict match: [a-z_][a-z\d_]* + # flexible match: [A-Za-z_][\w_]* but gets finding.WARN per manual + + p = self.patterns[key_strict] + m = p.match(short_name) + if m is not None and m.string == short_name: + f = finding.OK + key = key_strict + msg = 'strict re: ' + p.regexp_pattern_str + else: + p = self.patterns[key_relaxed] + m = p.match(short_name) + if m is not None and m.string == short_name: + f = finding.NOTE + key = key_relaxed + msg = 'relaxed re: ' + p.regexp_pattern_str + else: + # test if string rendering raises UnicodeDecodeError + key = 'validItemName' + if parent is None: + msg = 'valid HDF5 item name, not valid with NeXus' + else: + msg = 'valid HDF5 attribute name, not valid with NeXus' + try: # to raise the exception + _test = '%s' % str(m) + f = finding.WARN + except UnicodeDecodeError as _exc: + f = finding.ERROR + msg += ', UnicodeDecodeError' + else: + # TODO: validate full_name against other keys + # validNXClassName + # validTargetName + f = finding.TODO + msg = 'TODO: validate full_name against ' + key + pass + + self.new_finding(key, full_name, f, msg) + + def validate_default_plot(self): + ''' + check that data file defines the default plottable data + + :see: http://download.nexusformat.org/doc/html/datarules.html#find-the-plottable-data + ''' + classpath_dict = collections.OrderedDict() + for results in self.addresses.values(): + cp = results.classpath + if cp not in classpath_dict: + classpath_dict[cp] = [] + classpath_dict[cp].append(results.h5_address) + candidates = self.identify_default_plot_candidates() + + if self.default_plot_addr_v3(candidates['v3'], classpath_dict) is not None: + return True + elif self.default_plot_addr_v2(candidates['v2']) is not None: + return True + elif self.default_plot_addr_v1(candidates['v1']) is not None: + return True + elif self.no_NXdata_children_of_NXentry(candidates['niac2016']): + return True + + k = '/NXentry/NXdata/field' + if k in classpath_dict and len(classpath_dict[k]) == 1: + m = 'only one /NXentry/NXdata/field exists but no signal indicated' + else: + m = '/NXentry/NXdata/field exists but no signal indicated' + f = finding.WARN + self.new_finding('NeXus default plot', k, f, m) + + f = finding.TF_RESULT['/NXentry/NXdata/field' in classpath_dict] + return f != finding.ERROR + + def identify_default_plot_candidates(self): + ''' + find the HDF5 addresses that might provide the default plottable data + + :see: http://download.nexusformat.org/doc/html/datarules.html#find-the-plottable-data + :see: http://download.nexusformat.org/doc/html/preface.html?highlight=class%20path#class-path-specification + + There are different methods to identify the default data to be plotted. + These can be distinguished by differences in the NeXus class path + (the sequence of NeXus classes and other elements that describe an object in + a NeXus HDF5 data file). As used here, the text ``field`` is used + instead of the name of the field (as shown in the NeXus manual) but the name of the + attribute is given. + + =========== ======================================= + version NeXus classpath signature + =========== ======================================= + niac2016 /NXentry (no NXdata group) + v3 /NXentry/NXdata@signal + v3+niac2014 /@default/NXentry@default/NXdata@signal + v2 /NXentry/NXdata/field@signal + v1 /NXentry/NXdata/field@signal + =========== ======================================= + + Versions *v1* and *v2* differ in their use of other attributes + such as *axes* (v2) versus *axis* (v1) and *primary* (v1). + with other attributes such as */NXentry/NXdata/field2@primary*. + Since these other attributes are not always present, or + might be used to indicate alternatives, a test for *v1* + can fail due to both false negatives and false positives. + ''' + # prepare dictionaries of candidates for the default plot + candidates = dict(v1 = {}, v2 = {}, v3 = {}, niac2016 = {}) + for node_name in self.h5: + node = self.h5[node_name] + if h5structure.isNeXusGroup(node, 'NXentry'): + candidates['niac2016'][node.name] = '/NXentry' + for subnode_name in node: + subnode = node[subnode_name] + if h5structure.isNeXusGroup(subnode, 'NXdata'): + if node.name in candidates['niac2016']: + # reject this node from niac2016 since it has NXdata group + del candidates['niac2016'][node.name] + + signal = self.get_hdf5_attribute(subnode, 'signal') + if isinstance(signal, (bytes, numpy.bytes_)): + signal = signal.decode() + if signal is not None: + k = subnode.name + '@signal' + candidates['v3'][k] = '/NXentry/NXdata@signal' + for ss_node_name in subnode: + try: + ss_node = subnode[ss_node_name] + except KeyError: + continue + if not h5structure.isNeXusDataset(ss_node): + continue + if self.get_hdf5_attribute(ss_node, 'signal') is not None: + k = ss_node.name + '@signal' + # TODO: verify the value is a number (either as float, int, or str of some sort) + candidates['v2'][k] = '/NXentry/NXdata/field@signal' + candidates['v1'][k] = '/NXentry/NXdata/field@signal' + return candidates + + def default_plot_addr_v1(self, group_dict): + ''' + return the HDF5 address of the v1 default plottable data or None + + :see: http://download.nexusformat.org/doc/html/datarules.html#version-1 + ''' + default_plot_addr = [] + for primary_field_addr, nx_classpath in group_dict.items(): + title = 'NXdata group default plot v1' + # need the NXdata group of this field + primary = self.h5[primary_field_addr.split('@')[0]] + nxdata_addr = '/'.join(primary.name.split('/')[:-1]) + nxdata = self.h5[nxdata_addr] + signal_field_list = [] + for field_name in nxdata: + field = nxdata[field_name] + if h5structure.isNeXusDataset(field): + signal = self.get_hdf5_attribute(field, 'signal', report=True) + if signal is None: + continue + elif signal in (1, '1'): + signal_field_list.append(field) + else: + m = 'expected @signal=1, found: ' + signal + addr = field.name + '@signal' + self.new_finding(title, addr, finding.ERROR, m) + continue + # TODO: @axis, @primary, and dimension scales + # TODO: signal and dimension scales data shape + + if len(signal_field_list) == 1: + m = 'NXdata group default plot using v1' + self.new_finding(title, signal_field_list[0], finding.OK, m) + default_plot_addr.append(signal_field_list[0]) + elif len(signal_field_list) == 0: + m = 'NXdata group does not define a default plot using v1' + self.new_finding(title, nxdata_addr, finding.WARN, m) + else: + m = 'NXdata group defines more than one default plot using v1' + self.new_finding(title, nxdata_addr, finding.NOTE, m) + + cp = '/NXentry/NXdata/field@signal' + title = 'NeXus default plot v1' + if len(default_plot_addr) == 1: + m = 'NeXus data file default plot defined' + self.new_finding(title, default_plot_addr[0], finding.OK, m) + return default_plot_addr[0] + elif len(default_plot_addr) == 0: + m = 'NeXus data file does not define a default plot using v1' + #self.new_finding(title, cp, finding.WARN, m) + else: + m = 'NeXus data file defines more than one default plot using v1' + self.new_finding(title, cp, finding.WARN, m) + return default_plot_addr + + def default_plot_addr_v2(self, group_dict): + ''' + return the HDF5 address of the v2 default plottable data or None + + :see: http://download.nexusformat.org/doc/html/datarules.html#version-2 + ''' + default_plot_addr = [] + for h5_addr, nx_classpath in group_dict.items(): + title = 'NeXus default plot v2' + try: + field = self.h5[h5_addr.split('@')[0]] + except KeyError: + continue + signal = self.get_hdf5_attribute(field, 'signal', report=True) + if signal in (1, '1'): + m = nx_classpath + ' = 1' + self.new_finding(title, field.name, finding.OK, m) + default_plot_addr.append(field.name) + else: + m = 'expected @signal=1, found: ' + signal + self.new_finding(title, h5_addr, finding.ERROR, m) + # TODO: @axes and dimension scales (see issue #41) + # TODO: signal and dimension scales data shape + + cp = '/NXentry/NXdata/field@signal' + title = 'NeXus default plot v2' + if len(default_plot_addr) == 1: + m = 'NeXus data file default plot defined using v2' + self.new_finding(title, default_plot_addr[0], finding.OK, m) + return default_plot_addr[0] + elif len(default_plot_addr) == 0: + m = 'NeXus data file does not define a default plot using v2' + #self.new_finding(title, cp, finding.WARN, m) + else: + m = 'NeXus data file defines more than one default plot using v2' + self.new_finding(title, cp, finding.NOTE, m) + return default_plot_addr + + def default_plot_addr_v3(self, group_dict, classpath_dict): + ''' + return the HDF5 address of the v3 default plottable data or None + + :see: http://download.nexusformat.org/doc/html/datarules.html#version-3 + ''' + # TODO: this change will be disruptive, better in a branch +# if '/NXentry/NXdata/field@signal' in classpath_dict: +# pass +# elif '/NXentry/NXdata/field' in classpath_dict: +# field_list = classpath_dict['/NXentry/NXdata/field'] +# for entry in classpath_dict['/NXentry']: +# count = len([i for i in field_list if i.startswith(entry)]) +# pass + + default_plot_addr = [] + for h5_addr, nx_classpath in group_dict.items(): + dimension_scales = [] + dimension_scales_ok = True # assume until proven otherwise + title = 'NXdata group default plot v3' + nxdata = self.h5[h5_addr.split('@')[0]] + signal_name = self.get_hdf5_attribute(nxdata, 'signal', report=True) + if signal_name not in nxdata: + m = nx_classpath + ' field not found: ' + signal_name + self.new_finding(title, nxdata.name + '@signal', finding.ERROR, m) + continue + else: + signal_data = nxdata[signal_name] + m = 'NXdata@signal = ' + signal_name + addr = nxdata.name + self.new_finding(title, addr+'@signal', finding.OK, m) + + axes_names = self.get_hdf5_attribute(nxdata, 'axes', report=True) + if axes_names is None: # no axes attribute: use array indices as dimension scales + for dim in signal_data.shape: + dimension_scales.append(numpy.ndarray(dim)) + else: + if isinstance(axes_names, str): + for delim in (':', ' '): + # replace alternate delimiters (":", " ") with "," + axes_names = axes_names.replace(delim, ',') + axes_names = axes_names.split(',') + for axis_name in axes_names: + ttl = 'NXdata@axes' + if axis_name == '.': + pass + elif axis_name in nxdata: # does axis exist? + m = 'axes dataset found: ' + axis_name + f = finding.OK + self.new_finding(ttl+'='+axis_name, addr+'@axes', f, m) + # check @AXISNAME_indices holds index of dimension scale data to use + # dimension scale = index 'indices' of nxdata[axis_name] + axis_data = nxdata[axis_name] + indices = self.get_hdf5_attribute(nxdata, axis_name+'_indices') + if indices is None: + if len(axis_data.shape) == 1: + m = 'not provided, assume = 0' + self.new_finding('NXdata@'+axis_name+'_indices', + nxdata.name+'@'+axis_name+'_indices', + finding.NOTE, + m) + else: + m = 'not provided, uncertain how to use' + self.new_finding('NXdata@'+axis_name+'_indices', + nxdata.name+'@'+axis_name+'_indices', + finding.WARN, + m) + dimension_scales_ok = False + else: + if not isinstance(indices, (tuple, numpy.ndarray)): + indices = [indices,] + indices = numpy.array([int(v) for v in indices], dtype=int) + t = numpy.all(indices < len(signal_data.shape)) + if len(indices) == 1: + indices = indices[0] + f = finding.TF_RESULT[t] + m = 'value = ' + str(indices) + m += {True:': ok', False:': invalid'}[t] + self.new_finding('NXdata@'+axis_name+'_indices', + nxdata.name+'@'+axis_name+'_indices', + f, + m) + if not t: + dimension_scales_ok = False + + if len(axis_data.shape) == 1: + dimension_scales.append(axis_data) + elif len(axis_data.shape) == 2: + if not isinstance(indices, numpy.ndarray): + dimension_scales.append(axis_data[indices]) + else: + for indx in indices: + dimension_scales.append(axis_data[indx]) + else: + m = axis_data.name + '@axes, axis=' + axis_name + m += ' has rank=' + str(len(axis_data.shape)) + m += '\n This needs special handling. Send email to the developer.' + raise ValueError(m) + else: + m = 'axes dataset not found: ' + axis_name + f = finding.WARN + self.new_finding(ttl+'='+axis_name, addr+'@axes', f, m) + dimension_scales_ok = False + + if len(dimension_scales) == len(signal_data.shape): + if len(dimension_scales) == 1: + length_ok = dimension_scales[0].shape[0] - signal_data.shape[0] in (0, 1) + # 0 : dimension scale values are bin centers + # 1 : dimension scale values are bin edges + if not length_ok: + ttl = 'dimension scale for NXdata@signal' + m = 'array lengths are not the same' + self.new_finding(ttl, signal_data.name, finding.WARN, m) + dimension_scales_ok = False + else: + for i, dscale in enumerate(dimension_scales): + length_ok = dscale.shape[0] - signal_data.shape[i] in (0, 1) + if not length_ok: + ttl = 'dimension scale for NXdata@signal[' + str(i) + ']' + m = 'array lengths are not the same' + self.new_finding(ttl, signal_data.name, finding.WARN, m) + dimension_scales_ok = False + else: + m = 'rank(' + signal_name + ') != number of dimension scales' + self.new_finding('NXdata@signal rank', signal_data.name, finding.WARN, m) + default_plot_addr.append(addr) + if dimension_scales_ok: + m = 'dimension scale(s) verified' + self.new_finding('NXdata dimension scale(s)', nxdata.name, finding.OK, m) + + title = 'NeXus default plot v3' + # TODO: report default plot in each NXdata group + # TODO: report if file has one clearly designated default plot + # TODO: report if file has one default plot + if len(default_plot_addr) == 1: + m = 'NeXus data file default plot: /NXentry/NXdata@signal' + cp = nx_classpath + '=' + cp += self.get_hdf5_attribute(self.h5[default_plot_addr[0]], 'signal') + self.new_finding(cp, default_plot_addr[0], finding.OK, title) + return default_plot_addr[0] + elif len(default_plot_addr) == 0: + m = 'NeXus data file does not define a default plot using v3' + # self.new_finding(title, cp, finding.WARN, m) + else: + # use NIAC2014 terms to find unique address + unique_list = self.default_plot_addr_v3_niac2014(default_plot_addr) + m = title + '+niac2014' + if len(unique_list) == 1: + self.new_finding(nx_classpath, unique_list[0], finding.OK, m) + return unique_list[0] + else: + for _addr in default_plot_addr: + cp = nx_classpath + '=' + cp += self.get_hdf5_attribute(self.h5[_addr], 'signal') + self.new_finding(cp, _addr, finding.NOTE, title) + return default_plot_addr + + def default_plot_addr_v3_niac2014(self, address_list): + ''' + return a list of default plottable data as directed by @default attributes + + :param [str] address_list: list of absolute HDF5 addresses with v3 default plottable data + + Each address fits this NeXus class path: /NXentry/NXdata/field + ''' + unique_list = [] + for k in address_list: + nxentry_name = k.split('/')[1] + root_default = self.get_hdf5_attribute(self.h5, 'default', nxentry_name) + if root_default == nxentry_name: + nxentry = self.h5[nxentry_name] + nxdata_name = k.split('/')[2] + nxentry_default = self.get_hdf5_attribute(nxentry, 'default', nxdata_name) + if nxentry_default == nxdata_name: + unique_list.append(k) + return unique_list + + def no_NXdata_children_of_NXentry(self, group_dict): + ''' + As of NIAC2016, it is not required that there be any NXdata as a child of NXentry + ''' + title = 'NXdata optional per NIAC2016' + cp = '/NXentry' + m = 'NeXus allows NXentry without NXdata subgroup' + if len(group_dict) == 1: + for h5_addr, nx_classpath in group_dict.items(): + t = h5_addr in self.h5 + f = finding.TF_RESULT[t] + self.new_finding(title, cp, finding.NOTE, m) + return t + + return False + + def validate_numerical_dataset(self, dataset, group): + ''' + review the units attribute of an HDF5 dataset + + :param obj dataset: instance of h5py.Dataset + :param obj group: instance of h5py.Group or h5py.File, needed to check against NXDL + ''' + if dataset.dtype not in self.data_types['NX_NUMBER']: + return + + # check the units of numerical fields + title = 'field@units' + units = self.get_hdf5_attribute(dataset, 'units', report=True) + t = units is not None + f = {True: finding.OK, False: finding.NOTE}[t] + msg = {True: 'exists', False: 'does not exist'}[t] + if t: + t = len(units) > 0 + f = {True: finding.OK, False: finding.NOTE}[t] + msg = {True: 'value: ' + units, False: 'has no value'}[t] + self.new_finding(title, dataset.name + '@units', f, msg) + # TODO: compare value of dataset@units with NXDL@units specification + # this could easily require a deep analysis + + # TODO: issue #13: check field dimensions against "rank" : len(shape) == len(NXDL/dims) + shape = dataset.shape + if shape != (1,): # ignore scalars + __ = None # used as a NOP breakpoint after previous definition + + def get_hdf5_attribute(self, obj, attribute, default=None, report=False): + ''' + HDF5 attribute strings might be coded in several ways + + :param obj obj: instance of h5py.File, h5py.Group, or h5py.Dataset + :param str attribute: name of requested attribute + :param obj default: value if attribute not found (usually str) + :param bool report: check & report if value is an ndarray of variable length string + ''' + a = obj.attrs.get(attribute, default) + if isinstance(a, numpy.ndarray): + if len(a) > 0: + if isinstance(a[0], (bytes, numpy.bytes_)): + a = [str(v.decode()) for v in a] + if report: + gname = obj.name + '@' + attribute + msg = 'variable length string' + if len(a) > 1: + msg += ' array' + msg += ': ' + str(a) + self.new_finding('attribute data type', gname, finding.NOTE, msg) + if len(a) == 1: + a = a[0] + elif isinstance(a, (int, numpy.int16, numpy.int32, numpy.int64)): + a = str(a) + if sys.version_info.major == 3: + if isinstance(a, bytes): + a = str(a.decode()) + return a + + def reconstruct_classpath(self, h5_address, *args, **kwargs): + ''' + build the classpath from the h5_address + ''' + path = h5_address.lstrip('/').split('@')[0] + if len(path) == 0: + return + + # reconstruct the NeXus classpath + cp = '' # classpath to be built + hp = '' # HDF5 address to be built + for item in path.split('/'): + hp += '/' + item + if hp in self.h5: + try: + item = self.h5[hp] + except KeyError as _exc: + cp += '/missing_external_file_link' + continue + if h5structure.isHdf5Dataset(item): + cp += '/field' + else: + obj = self.h5[hp] + nx_class = self.get_hdf5_attribute(obj, 'NX_class', '-') + cp += '/' + str(nx_class) + if '@' in h5_address: + cp += '@' + h5_address.split('@')[-1] + + return cp + + def new_finding(self, test_name, h5_address, status, comment): + ''' + accumulate a list of findings + + :param str test_name: brief name of this test + :param str h5_address: HDF5 address + :param obj status: instance of finding.ValidationResultStatus, + should be the same text as other instances of this test + :param str comment: free-form explanation + ''' + + addr = str(h5_address) + unique_key = addr + ':' + test_name + if unique_key in self.__unique_findings__: + # ensure that each test is only recorded once + return + f = finding.Finding(test_name, addr, status, comment) + self.findings.append(f) + self.__unique_findings__[unique_key] = f + if addr not in self.addresses: + # accumulate a dictionary of HDF5 object addresses + self.addresses[addr] = finding.CheckupResults(addr) + self.addresses[addr].classpath = self.reconstruct_classpath(addr) + self.addresses[addr].findings.append(f) + + def report_findings(self, statuses=()): + ''' + make a table of the validation findings + + :param statuses: List (or tuple) of finding statuses to be shown. + Use the `finding.VALID_STATUS_LIST` (as shown below) + or create your own list: + + :data:`finding.VALID_STATUS_LIST` ``(OK, NOTE, WARN, ERROR, TODO, UNUSED, COMMENT)`` + + See :mod:`finding` for details. + + :returns str: table of results or `None` if no results match. + ''' + import pyRestTable + + t = pyRestTable.Table() + t.labels = 'address validation status comment(s)'.split() + if isinstance(statuses, finding.ValidationResultStatus): + statuses = [statuses,] + for f in sorted(self.findings, key=self.findings_comparator): + if f.status in statuses: + t.rows.append((f.h5_address, f.test_name, f.status, f.comment)) + if len(t.rows) == 0: + return 'None' + return t.reST() + + def findings_comparator(self, finding): + ''' + custom sorting key for all HDF5 addresses + ''' + if finding.h5_address.find('@') >= 0: + address, attribute = finding.h5_address.split('@') + else: + address = finding.h5_address + attribute = None + try: + if attribute is not None: + k = '!_4_' + elif isinstance(self.h5[address], h5py.Dataset): + k = '!_3_' + elif isinstance(self.h5[address], h5py.Group): + k = '!_1_' + elif isinstance(self.h5[address], h5py.File): + k = '!_0_' + else: + k = '!_5_' + except KeyError as exc: + k = '!_6_' + key = address + k + if attribute is not None: + key += '@' + attribute + key += '!__status_' + finding.status.key + key += '!__title_' + finding.test_name + return key + + def report_findings_summary(self): + ''' + make a summary table of the validation findings (count how many of each status) + ''' + import pyRestTable + + # count each category + summary = collections.OrderedDict() + for k in finding.VALID_STATUS_LIST: + summary[str(k.key)] = 0 + xref = {str(k): k for k in finding.VALID_STATUS_LIST} + for f in self.findings: + summary[str(f.status)] += 1 + + t = pyRestTable.Table() + t.labels = 'status count description'.split() + for k, v in summary.items(): + t.rows.append((k, v, xref[k].description)) + t.rows.append(('--', '--', '--')) + t.rows.append(('TOTAL', len(self.findings), '--')) + return t.reST() + + def report_classpath(self): + ''' + make a table of the known NeXus class paths + ''' + import pyRestTable + t = pyRestTable.Table() + t.labels = 'HDF5-address NeXus-classpath'.split() + for k, v in self.addresses.items(): + t.rows.append((k, v.classpath)) + return t.reST() + + def missing_file_link(self, text): + ''' + Return file name if error message from KeyError due to missing external file link, else None + + Such as:: + + Unable to open object (Unable to open file: name = 'data\\../nt15698-1/processing/waxs_mask.nxs', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0) + + Returns:: + + data\\../nt15698-1/processing/waxs_mask.nxs + + ''' + filename = None + m1 = 'Unable to open object (Unable to open file: name = ' + p1 = text.find(m1) + if p1 >= 0: + p2 = text.find(', errno =') + filename = text[p1 + len(m1) : p2].strip("'") + return filename + +if __name__ == '__main__': + print("Start this module using: python main.py validate ...") + exit(0) diff --git a/src/punx/logs.py b/src/punx/logs.py deleted file mode 100644 index 9bb4ef9a8ad2462d48c43835d251d63582d837c1..0000000000000000000000000000000000000000 --- a/src/punx/logs.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -#----------------------------------------------------------------------------- -# :author: Pete R. Jemian -# :email: prjemian@gmail.com -# :copyright: (c) 2016, Pete R. Jemian -# -# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. -# -# The full license is in the file LICENSE.txt, distributed with this software. -#----------------------------------------------------------------------------- - -''' -document program history events in a log file - -.. autosummary:: - - ~Logger - ~to_console - -''' - -import datetime -import logging -import os -import socket -import sys - -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx - - -class Logger(object): - ''' - use Python logging package to record program history - - :param str log_file: name of file to store history - :param enum level: logging interest level (default=punx.INFO, no logs = -1) - ''' - - def __init__(self, log_file=None, level=None): - if level is None: - level = punx.INFO - self.level = level - if level == punx.CONSOLE_ONLY: - # this means: only write ALL log messages to the console - self.log_file = None - else: - if log_file is None: - ymd = str(_now()).split()[0] - pid = os.getpid() - # current working directory? - log_file = '-'.join((punx.__package_name__, ymd, str(pid) + '.log')) - self.log_file = os.path.abspath(log_file) - logging.basicConfig(filename=log_file, level=level) - - self.history = '' - self.filename = os.path.basename(sys.argv[0]) - self.pid = os.getpid() - - punx.LOG_MESSAGE = self.add - self.first_logs() - - def add(self, message, interest=None): - ''' - log a message or report from the application - - :param str message: words to be logged - :param int interest: interest level of this message (default: logging.INFO) - ''' - if interest is None: - interest = punx.INFO - if interest < self.level: - return - - timestamp = _now() - text = "(%d,%s,%s) %s" % (self.pid, self.filename, timestamp, message) - - if self.level == punx.CONSOLE_ONLY: - print(text) - else: - logging.log(interest, text) - - if len(self.history) != 0: - self.history += '\n' - self.history += text - - return text - - def first_logs(self): - ''' - first logging information after log file has been defined - ''' - user = os.environ.get('LOGNAME', None) or os.environ.get('USERNAME', None) or 'unknown' - if self.level == punx.CONSOLE_ONLY: - interest = 'no logging' - else: - interest = logging.getLevelName(self.level) - - self.add("startup") - self.add("log_file = " + str(self.log_file)) - self.add("interest level = " + interest) - self.add("user = " + user) - self.add("host = " + socket.gethostname()) - self.add("program = " + sys.argv[0]) - self.add("program filename = " + self.filename) - self.add("PID = " + str(self.pid)) - - def close(self): - ''' - close the log file - ''' - for h in logging.root.handlers: - h.close() - logging.root.removeHandler(h) - - -def to_console(message, interest=None): - ''' - used when *only* logging output to the console (not using the logging package) - ''' - interest = interest or punx.DEFAULT_LOG_LEVEL - if interest >= punx.DEFAULT_LOG_LEVEL: - status = logging.getLevelName(interest) + ':' - print(status, message) - - -def ignore_logging(): - ''' - used during unit testing - ''' - punx.DEFAULT_LOG_LEVEL = 999999 - punx.LOG_MESSAGE = to_console - - -def _now(): - ''' ''' - return datetime.datetime.now() diff --git a/src/punx/main.py b/src/punx/main.py old mode 100644 new mode 100755 index d086aa181cb16c3fa55f20104e7f14ff54bbed85..2adce56d7701e87ed34c8c74d141dd28cf7cc650 --- a/src/punx/main.py +++ b/src/punx/main.py @@ -4,7 +4,7 @@ #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2016, Pete R. Jemian +# :copyright: (c) 2018, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # @@ -20,51 +20,65 @@ main user interface file :: - usage: punx [-h] [-v] {hierarchy,show,structure,update,validate} ... + console> punx -h + usage: punx [-h] [-v] + {configuration,demonstrate,structure,tree,update,validate} ... - Python Utilities for NeXus HDF5 files URL: http://punx.readthedocs.io - v0.0.1+4.gff00892.dirty + Python Utilities for NeXus HDF5 files version: 0.2.0+9.g31fd4b4.dirty URL: + http://punx.readthedocs.io optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit - subcommands: + subcommand: valid subcommands - {demonstrate,structure,update,validate} + {configuration,demonstrate,structure,tree,update,validate} + configuration show configuration details of punx demonstrate demonstrate HDF5 file validation - structure show structure of HDF5 or NXDL file + structure structure command deprecated. Use ``tree`` instead + tree show tree structure of HDF5 or NXDL file update update the local cache of NeXus definitions validate validate a NeXus file + + Note: It is only necessary to use the first two (or more) characters of any + subcommand, enough that the abbreviation is unique. Such as: ``demonstrate`` + can be abbreviated to ``demo`` or even ``de``. .. autosummary:: ~main ~MyArgumentParser ~parse_command_line_arguments - ~interceptor_logfile ~func_demo + ~func_validate ~func_hierarchy - ~func_show - ~func_structure + ~func_configuration + ~func_tree ~func_update - ~func_validate ''' import argparse +import logging import os import sys -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -from punx import finding -from punx import logs +logging.basicConfig( + level=logging.INFO, + # level=logging.DEBUG, + format='[%(levelname)s %(asctime)s.%(msecs)03d %(name)s:%(lineno)d] %(message)s', + datefmt='%Y-%m-%d %H:%M:%S') -CONSOLE_LOGGING_DEFAULT_CHOICE = '__console__' +from .__init__ import __version__, __package_name__, __url__ +from .__init__ import FileNotFound, HDF5_Open_Error, SchemaNotFound +from . import finding +from . import utils +ERROR = 40 +logger = utils.setup_logger(__name__, logging.INFO) # :see: https://docs.python.org/2/library/argparse.html#sub-commands # obvious 1st implementations are h5structure and update @@ -75,17 +89,30 @@ def exit_message(msg, status=None, exit_code=1): exit this code with a message and a status :param str msg: text to be reported - :param int status: 0 - 50 (default: punx.ERROR = 40) + :param int status: 0 - 50 (default: ERROR = 40) :param int exit_code: 0: no error, 1: error (default) ''' if status is None: - status = punx.ERROR - punx.LOG_MESSAGE(msg, status) - if punx.LOG_MESSAGE != logs.to_console: - print(msg) + status = ERROR + logging.info("{} -- {}".format(msg, status)) exit(exit_code) +def func_configuration(args): + """show internal configuration of punx""" + from . import cache_manager + from . import github_handler + + cm = cache_manager.CacheManager() + print("Locally-available versions of NeXus definitions (NXDL files)") + print(cm.table_of_caches()) + print("default NXDL file set: ", cm.default_file_set.ref) + + # nothing to show from here + # grr = github_handler.GitHub_Repository_Reference() + # perhaps does local creds file exist? Show where it is? or TMI? + + def func_demo(args): ''' show what **punx** can do @@ -95,11 +122,12 @@ def func_demo(args): Internally, runs these commands:: punx validate <source_directory>/data/writer_1_3.hdf5 - punx structure <source_directory>/data/writer_1_3.hdf5 + punx tree <source_directory>/data/writer_1_3.hdf5 .. index:: cache update - If you get an error message that looks like this one (line breaks added here for clarity:: + If you get an error message that looks like this one + (line breaks added here for clarity):: punx.cache.FileNotFound: file does not exist: /Users/<username>/.config/punx/definitions-master/nxdl.xsd @@ -114,14 +142,16 @@ def func_demo(args): path = os.path.dirname(__file__) args.infile = os.path.abspath(os.path.join(path, 'data', 'writer_1_3.hdf5')) + print("") print('console> punx validate ' + args.infile) args.report = ','.join(sorted(finding.VALID_STATUS_DICT.keys())) func_validate(args) del args.report - print('console> punx structure ' + args.infile) - from punx import h5structure - mc = h5structure.h5structure(args.infile) + print("") + print('console> punx tree ' + args.infile) + from . import h5tree + mc = h5tree.Hdf5TreeView(args.infile) # :param bool show_attributes: display attributes in output show_attributes=True mc.array_items_shown = 5 @@ -129,100 +159,128 @@ def func_demo(args): def func_hierarchy(args): + "not implemented yet" url = 'http://punx.readthedocs.io/en/latest/analyze.html' print('A chart of the NeXus hierarchy is in the **punx** documentation.') print('see: ' + url) # TODO: issue #1 & #10 show NeXus base class hierarchy from a given base class -def func_show(args): - print('still in development -- not implemented yet') - print(args) +def func_structure(args): + "deprecated subcommand" + msg = 'structure command deprecated. Use ``tree`` instead' + print(ValueError(msg)) + sys.exit(1) -def func_structure(args): +def func_tree(args): + """print the tree structure of a NeXus HDF5 data file of NXDL XML file""" if args.infile.endswith('.nxdl.xml'): - from punx import nxdlstructure - nxdl = nxdlstructure.NX_definition(args.infile) - print(nxdl.render()) + from . import nxdltree + + try: + mc = nxdltree.NxdlTreeView(os.path.abspath(args.infile)) + except FileNotFound: + exit_message('File not found: ' + args.infile) + except Exception as exc: + exit_message(str(exc)) + report = mc.report(args.show_attributes) + print('\n'.join(report or '')) + else: - from punx import h5structure - - # :param int limit: maximum number of array items to be shown (default = 5) - limit = args.max_array_items - # :param bool show_attributes: display attributes in output - show_attributes=True + from . import h5tree try: - mc = h5structure.h5structure(os.path.abspath(args.infile)) - except punx.FileNotFound: + mc = h5tree.Hdf5TreeView(os.path.abspath(args.infile)) + except FileNotFound: exit_message('File not found: ' + args.infile) - mc.array_items_shown = limit + mc.array_items_shown = args.max_array_items try: - report = mc.report(show_attributes) - except punx.HDF5_Open_Error: + report = mc.report(args.show_attributes) + except HDF5_Open_Error: exit_message('Could not open as HDF5: ' + args.infile) print('\n'.join(report or '')) -def func_update(args): - from punx import cache - cache.update_NXDL_Cache(force_update=args.force) - - def func_validate(args): - from punx import validate + """ + validate the content of a NeXus HDF5 data file of NXDL XML file + """ + from . import validate if args.infile.endswith('.nxdl.xml'): result = validate.validate_xml(args.infile) if result is None: print(args.infile, ' validates') - else: - try: - validator = validate.Data_File_Validator(args.infile) - except punx.FileNotFound: - exit_message('File not found: ' + args.infile) - except punx.HDF5_Open_Error: - exit_message('Could not open as HDF5: ' + args.infile) - except punx.SchemaNotFound as _exc: - exit_message(str(_exc)) - - # determine which findings are to be reported - report_choices, trouble = [], [] - for c in args.report.upper().split(','): - if c in finding.VALID_STATUS_DICT: - report_choices.append(finding.VALID_STATUS_DICT[c]) - else: - trouble.append(c) - if len(trouble) > 0: - msg = 'invalid choice(s) for *--report* option: ' - msg += ','.join(trouble) - msg += '\n' - msg += '\t' + 'available choices: ' - msg += ','.join(sorted(finding.VALID_STATUS_DICT.keys())) - exit_message(msg) + return + validator = validate.Data_File_Validator() + + # determine which findings are to be reported + report_choices, trouble = [], [] + for c in args.report.upper().split(','): + if c in finding.VALID_STATUS_DICT: + report_choices.append(finding.VALID_STATUS_DICT[c]) + else: + trouble.append(c) + if len(trouble) > 0: + msg = 'invalid choice(s) for *--report* option: ' + msg += ','.join(trouble) + msg += '\n' + msg += '\t' + 'available choices: ' + msg += ','.join(sorted(finding.VALID_STATUS_DICT.keys())) + exit_message(msg) + + try: # run the validation - validator.validate() - - # report the findings from the validation - from punx import cache_manager - cm = cache_manager.CacheManager() - print(':file: ' + os.path.basename(validator.fname)) - msg = cm.default_file_set.ref_type - msg += ' ' + cm.default_file_set.ref - msg += ', ' + cache_manager.get_short_sha(cm.default_file_set.sha) - msg += ', ' + cm.default_file_set.cache + ' cache' - print(':NXDL cache info: ' + msg) - print(':NXDL GIT sha: ' + cm.default_file_set.sha) - print(':NXDL GIT date/time: ' + cm.default_file_set.last_modified) - print(':validation results shown: ' + ' '.join(sorted(map(str, report_choices)))) - print('') - print('Validation findings') - print(validator.report_findings(report_choices)) + validator.validate(args.infile) + except FileNotFound: + exit_message('File not found: ' + args.infile) + except HDF5_Open_Error: + exit_message('Could not open as HDF5: ' + args.infile) + except SchemaNotFound as _exc: + exit_message(str(_exc)) + + # report the findings from the validation + validator.print_report() + + +def _install(cm, grr, ref, use_user_cache = True, force = False): + """ + Install or update the named NXDL file reference + """ + force = force or ref == "master" # always update from the master branch + + msg = "install_NXDL_file_set(ref={}, force={}, user_cache={})".format( + ref, force, use_user_cache) + logger.info(msg) + + m = cm.install_NXDL_file_set( + grr, + user_cache=use_user_cache, + ref=ref, + force = force) + if isinstance(m, list): + print(str(m[-1])) + + +def func_update(args): + """update or install versions of the NeXus definitions""" + from . import cache_manager + from . import github_handler + + cm = cache_manager.CacheManager() + print(cm.table_of_caches()) + + if args.try_to_install_or_update: + grr = github_handler.GitHub_Repository_Reference() + grr.connect_repo() + cm.find_all_file_sets() + + for ref in args.file_set_list: + _install(cm, grr, ref, force=args.force) - print('summary statistics') - print(validator.report_findings_summary()) + print(cm.table_of_caches()) class MyArgumentParser(argparse.ArgumentParser): @@ -271,142 +329,130 @@ class MyArgumentParser(argparse.ArgumentParser): def parse_command_line_arguments(): '''process command line''' doc = __doc__.strip().splitlines()[0] - doc += '\n version: ' + punx.__version__ - doc += '\n URL: ' + punx.__url__ + doc += '\n version: ' + __version__ + doc += '\n URL: ' + __url__ epilog = 'Note: It is only necessary to use the first two (or' epilog += ' more) characters of any subcommand, enough that the' epilog += ' abbreviation is unique. ' epilog += ' Such as: ``demonstrate`` can be abbreviated to' epilog += ' ``demo`` or even ``de``.' - p = MyArgumentParser(prog=punx.__package_name__, - description=doc, - epilog=epilog) - - p.add_argument('-v', - '--version', - action='version', - version=punx.__version__) - - def add_logging_argument(subp): - ''' - common code to add option for logging program output - ''' - import logging - help_text = 'log output to file (default: no log file)' - subp.add_argument('-l', '--logfile', - default=CONSOLE_LOGGING_DEFAULT_CHOICE, - nargs='?', - help=help_text) - - level = punx.DEFAULT_LOG_LEVEL - help_text = 'logging interest level (%d - %d), default=%d (%s)' - help_text = help_text % (punx.NOISY, - punx.CRITICAL, - punx.DEFAULT_LOG_LEVEL, - logging.getLevelName(level) - ) - subp.add_argument('-i', '--interest', - default=level, - type=int, - #choices=range(1,51), - help=help_text) + p = MyArgumentParser( + prog=__package_name__, + description=doc, + epilog=epilog) + + p.add_argument( + '-v', + '--version', + action='version', + version=__version__) # TODO: issue #9, stretch goal: GUI for any of this - # p.add_argument('-g', - # '--gui', - # help='graphical user interface (TBA)') + # p.add_argument( + # '-g', + # '--gui', + # help='graphical user interface (TBA)') subcommand = p.add_subparsers(title='subcommand', description='valid subcommands',) + + + ## subcommand: configuration + # TODO: issue #11 + help_text = 'show configuration details of punx' + p_sub = subcommand.add_parser('configuration', help=help_text) + p_sub.set_defaults(func=func_configuration) ### subcommand: demo - p_demo = subcommand.add_parser('demonstrate', help='demonstrate HDF5 file validation') - add_logging_argument(p_demo) - p_demo.set_defaults(func=func_demo) + p_sub = subcommand.add_parser('demonstrate', help='demonstrate HDF5 file validation') + # TODO: add_logging_argument(p_sub) + p_sub.set_defaults(func=func_demo) # ### subcommand: hierarchy # # TODO: issue #1 & #10 # help_text = 'show NeXus base class hierarchy from a given base class' -# p_hierarchy = subcommand.add_parser('hierarchy', help=help_text) -# p_hierarchy.set_defaults(func=func_hierarchy) -# #p_hierarchy.add_argument('something', type=bool, help='something help_text') - - - ### subcommand: show -# # TODO: issue #11 -# p_show = subcommand.add_parser('show', help='show program information (about the cache)') -# p_show.set_defaults(func=func_show) -# # p_show.add_argument('details', type=bool, help='details help_text') +# p_sub = subcommand.add_parser('hierarchy', help=help_text) +# p_sub.set_defaults(func=func_hierarchy) +# #p_sub.add_argument('something', type=bool, help='something help_text') ### subcommand: structure - help_text = 'show structure of HDF5 or NXDL file' - p_structure = subcommand.add_parser('structure', help=help_text) - p_structure.set_defaults(func=func_structure) - p_structure.add_argument('infile', help="HDF5 or NXDL file name") - p_structure.add_argument('-a', - action='store_false', - default=True, - dest='show_attributes', - help='Do not print attributes of HDF5 file structure') + help_text = 'structure command deprecated. Use ``tree`` instead' + p_sub = subcommand.add_parser('structure', help=help_text) + p_sub.set_defaults(func=func_structure) + p_sub.add_argument('infile', help="HDF5 or NXDL file name") + + + ### subcommand: tree + help_text = 'show tree structure of HDF5 or NXDL file' + p_sub = subcommand.add_parser('tree', help=help_text) + p_sub.set_defaults(func=func_tree) + p_sub.add_argument('infile', help="HDF5 or NXDL file name") + p_sub.add_argument( + '-a', + action='store_false', + default=True, + dest='show_attributes', + help='Do not print attributes of HDF5 file structure') help_text = 'maximum number of array items to be shown' - p_structure.add_argument('-m', '--max_array_items', - default=5, - type=int, - #choices=range(1,51), - help=help_text) - add_logging_argument(p_structure) + p_sub.add_argument( + '-m', '--max_array_items', + default=5, + type=int, + #choices=range(1,51), + help=help_text) + # TODO: add_logging_argument(p_sub) ### subcommand: update help_text = 'update the local cache of NeXus definitions' - p_update = subcommand.add_parser('update', help=help_text) - p_update.set_defaults(func=func_update) - p_update.add_argument('-f', '--force', - action='store_true', - default=False, - help='force update (if GitHub available)') - add_logging_argument(p_update) + p_sub = subcommand.add_parser('update', help=help_text) + p_sub.set_defaults(func=func_update) + + help_text = "name(s) of reference NeXus NXDL file set" + help_text += " (GitHub tag, hash, version, or 'master')" + help_text += " -- default master" + p_sub.add_argument( + '-r', '--file_set_list', + default=["master", ], + nargs='*', + help=help_text) + + p_sub.add_argument("-i", "--install", + action='store_false', + default=True, + dest='try_to_install_or_update', + help='Do not install (or update) -- default True') + + p_sub.add_argument( + '-f', '--force', + action='store_true', + default=False, + help='force update (if GitHub available)') + # TODO: add_logging_argument(p_sub) ### subcommand: validate - p_validate = subcommand.add_parser('validate', help='validate a NeXus file') - p_validate.add_argument('infile', help="HDF5 or NXDL file name") - p_validate.set_defaults(func=func_validate) + p_sub = subcommand.add_parser('validate', help='validate a NeXus file') + p_sub.add_argument('infile', help="HDF5 or NXDL file name") + p_sub.set_defaults(func=func_validate) reporting_choices = ','.join(sorted(finding.VALID_STATUS_DICT.keys())) help_text = 'select which validation findings to report, choices: ' help_text += reporting_choices - p_validate.add_argument('--report', default=reporting_choices, help=help_text) - add_logging_argument(p_validate) + p_sub.add_argument('--report', default=reporting_choices, help=help_text) + # TODO: add_logging_argument(p_sub) return p.parse_args() -def interceptor_logfile(args): - ''' - special handling for subcommands with a *logfile* option - ''' - if 'logfile' in args: - if args.logfile == CONSOLE_LOGGING_DEFAULT_CHOICE: - punx.DEFAULT_LOG_LEVEL = args.interest - punx.LOG_MESSAGE = logs.to_console - punx.LOG_MESSAGE('logging output to console only', punx.DEBUG) - else: - lo = punx.NOISY - hi = punx.CRITICAL - args.interest = max(lo, min(hi, args.interest)) - _log = logs.Logger(log_file=args.logfile, level=args.interest) - punx.LOG_MESSAGE('sys.argv: ' + ' '.join(sys.argv), punx.DEBUG) - punx.LOG_MESSAGE('args: ' + str(args), punx.DEBUG) - - def main(): + print("\n!!! WARNING: this program is not ready for distribution.\n") args = parse_command_line_arguments() - - # special handling for logging program output - interceptor_logfile(args) - + if not hasattr(args, "func"): + print("ERROR: must specify a subcommand -- for help, type:") + print("%s -h" % sys.argv[0]) + sys.exit(1) args.func(args) diff --git a/src/punx/nxdl_manager.py b/src/punx/nxdl_manager.py index c9f9952d03e18f6e29efc0e3f9ab3a738f6ced34..18a8715892a32c0b40b269a495ff05361f726b56 100644 --- a/src/punx/nxdl_manager.py +++ b/src/punx/nxdl_manager.py @@ -4,7 +4,7 @@ #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2017, Pete R. Jemian +# :copyright: (c) 2017-2018, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # @@ -12,62 +12,113 @@ #----------------------------------------------------------------------------- -''' +""" Load and/or document the structure of a NeXus NXDL class specification -''' + +The *nxdl_manager* calls the *schema_manager* and +is called by *____tba_____*. + +""" from __future__ import print_function import collections -import copy import lxml.etree import os -import sys +import six + +from .__init__ import FileNotFound, InvalidNxdlFile +from . import nxdl_schema +from . import cache_manager +from . import utils -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -import punx.singletons -import punx.nxdl_schema + +logger = utils.setup_logger(__name__) class NXDL_Manager(object): - ''' - the NXDL classes found in ``nxdl_dir`` - ''' + + """the NXDL classes found in ``nxdl_dir``""" nxdl_file_set = None + nxdl_defaults = None - def __init__(self, file_set): - import punx.cache_manager - assert(isinstance(file_set, punx.cache_manager.NXDL_File_Set)) + def __init__(self, file_set=None): + if file_set is None: + cm = cache_manager.CacheManager() + file_set = cm.default_file_set + elif isinstance(file_set, six.string_types): + cm = cache_manager.CacheManager() + cm.select_NXDL_file_set(file_set) + file_set = cm.default_file_set + assert(isinstance(file_set, cache_manager.NXDL_File_Set)) + if file_set.path is None or not os.path.exists(file_set.path): - raise punx.FileNotFound('NXDL directory: ' + str(file_set.path)) + msg = 'NXDL directory: ' + str(file_set.path) + logger.error(msg) + raise FileNotFound(msg) self.nxdl_file_set = file_set + self.nxdl_defaults = self.get_nxdl_defaults() self.classes = collections.OrderedDict() -# get_element = file_set.nxdl_element_factory.get_element for nxdl_file_name in get_NXDL_file_list(file_set.path): - definition = NXDL_element__definition(file_set.path) # the default - obj = copy.deepcopy(definition) # ALWAYS make a copy of that - # TODO: adjust minOccurs defaults for application definition or contributed definition - obj.set_file(nxdl_file_name) - obj.parse() - self.classes[obj.title] = obj + logger.debug("reading NXDL file: " + nxdl_file_name) + definition = NXDL__definition(nxdl_manager=self) # the default + definition.set_file(nxdl_file_name) # defines definition.title + self.classes[definition.title] = definition + definition.parse_nxdl_xml() + + logger.debug(definition) + for j in "attributes groups fields links".split(): + dd = definition.__getattribute__(j) + for k in sorted(dd.keys()): + logger.debug(dd[k]) + for v in sorted(definition.symbols): + logger.debug("symbol: " + v) + logger.debug("-"*50) + + def __str__(self, *args, **kwargs): + s = "NXDL_Manager(" + count = {} + for v in self.classes.values(): + if v.category not in count: + count[v.category] = 0 + count[v.category] += 1 + args = [k + ":%d" % v for k, v in sorted(count.items())] + s += ", ".join(args) + s += ")" + return s + + def get_nxdl_defaults(self): + """ """ + schema_file = os.path.join( + self.nxdl_file_set.path, + nxdl_schema.NXDL_XSD_NAME) + if os.path.exists(schema_file): + return nxdl_schema.NXDL_Summary(schema_file) def get_NXDL_file_list(nxdl_dir): - ''' + """ return a list of all NXDL files in the ``nxdl_dir`` - ''' + + The list is sorted by NXDL category + (base_classes, applications, contributed_definitions) + and then alphabetically within each category. + """ if not os.path.exists(nxdl_dir): - raise punx.FileNotFound('NXDL directory: ' + nxdl_dir) + msg = 'NXDL directory: ' + nxdl_dir + logger.error(msg) + raise FileNotFound(msg) NXDL_categories = 'base_classes applications contributed_definitions'.split() nxdl_file_list = [] for category in NXDL_categories: path = os.path.join(nxdl_dir, category) if not os.path.exists(path): - raise IOError('no definition available, cannot find ' + path) + msg = 'no definition available, cannot find ' + path + logger.error(msg) + raise IOError(msg) for fname in sorted(os.listdir(path)): if fname.endswith('.nxdl.xml'): nxdl_file_list.append(os.path.join(path, fname)) @@ -75,368 +126,516 @@ def get_NXDL_file_list(nxdl_dir): def validate_xml_tree(xml_tree): - ''' + """ validate an NXDL XML file against the NeXus NXDL XML Schema file :param str xml_file_name: name of XML file - ''' - import punx.schema_manager - schema = punx.schema_manager.get_default_schema_manager().lxml_schema + """ + from punx import schema_manager + schema = schema_manager.get_default_schema_manager().lxml_schema try: result = schema.assertValid(xml_tree) except lxml.etree.DocumentInvalid as exc: - raise punx.InvalidNxdlFile(str(exc)) + logger.error(str(exc)) + raise InvalidNxdlFile(str(exc)) return result -# class NXDL_Base(object): -# ''' -# a complete description of a specific NXDL definition -# ''' -# -# parent = None -# -# def __init__(self, parent): -# self.parent = parent -# -# def set_defaults(self, rules): -# ''' -# use the NXDL Schema to set defaults -# -# do not call this from the constructor due to infinite loop -# ''' -# pass -# -# -# class NXDL_element__definition(NXDL_Base): -# ''' -# a complete description of a specific NXDL definition -# ''' -# -# title = None -# category = None -# file_name = None -# nxdl = None -# lxml_tree = None -# nxdl_file_set = None -# -# nxdl_attributes = {} -# nxdl_groups = {} -# nxdl_fields = {} -# nxdl_symbols = {} -# -# __parsed__ = False -# -# def __init__(self, file_set): -# self.nxdl_file_set = file_set -# NXDL_Base.__init__(self, None) -# -# def __getattribute__(self, *args, **kwargs): -# ''' -# implement lazy load of definition content -# ''' -# if len(args) == 1 and args[0] == 'lxml_tree' and not self.__parsed__: -# self.parse() # only parse this file once content is requested -# return object.__getattribute__(self, *args, **kwargs) -# -# def set_defaults(self, rules): -# ''' -# use the NXDL Schema to set defaults -# -# :param obj rules: instance of Schema_Attribute -# -# do not call this from the constructor due to infinite loop -# ''' -# get_element = self.nxdl_file_set.nxdl_element_factory.get_element # alias -# -# for k, v in rules.attrs.items(): -# self.nxdl_attributes[k] = get_element('attribute', parent=self) -# -# _breakpoint = True # TODO: -# -# def set_file(self, fname): -# self.file_name = fname -# self.title = os.path.split(fname)[-1].split('.')[0] -# self.category = os.path.split(os.path.dirname(fname))[-1] -# -# def parse(self): -# ''' -# parse the XML content -# -# This step is deferred until self.lxml_tree is requested -# since only a small subset of the NXDL files are typically -# referenced in a single data file. -# ''' -# if self.__parsed__: -# return # only parse this file when content is requested -# -# if self.file_name is None or not os.path.exists(self.file_name): -# raise punx.FileNotFound('NXDL file: ' + str(self.file_name)) -# -# self.lxml_tree = lxml.etree.parse(self.file_name) -# self.__parsed__ = True # NOW, the file has been parsed -# -# try: -# validate_xml_tree(self.lxml_tree) -# except punx.InvalidNxdlFile as exc: -# msg = 'NXDL file is not valid: ' + self.file_name -# msg += '\n' + str(exc) -# -# # parse the XML content of this NXDL definition element -# for node in self.lxml_tree.getroot(): -# if isinstance(node, lxml.etree._Comment): -# continue -# -# element_type = node.tag.split('}')[-1] -# if element_type not in ('doc',): -# obj = self.nxdl_file_set.nxdl_element_factory.get_element(element_type) -# _break = True -# -# -# class NXDL_element__attribute(NXDL_Base): -# ''' -# a complete description of a specific NXDL attribute element -# -# :param obj parent: instance of NXDL_Base -# ''' -# -# def __init__(self, parent): -# NXDL_Base.__init__(self, parent) -# self.name = None -# self.type = 'str' -# self.required = False -# self.default_value = None -# self.enum = [] -# self.patterns = [] -# self.nxdl_attributes = {} -# -# def __str__(self, *args, **kwargs): -# msg = '%s(' % type(self).__name__ -# l = [] -# for k in 'name type required default_value enum patterns'.split(): -# l.append('%s=%s' % (k, str(self.__getattribute__(k)))) -# msg += ', '.join(l) -# msg += ')' -# -# return msg -# -# def set_defaults(self, rules): -# ''' -# use the NXDL Schema to set defaults -# -# :param obj rules: instance of Schema_Attribute -# ''' -# if self.parent is not None: -# get_element = self.parent.nxdl_file_set.nxdl_element_factory.get_element -# elif hasattr(self, 'nxdl_file_set'): -# get_element = self.nxdl_file_set.nxdl_element_factory.get_element # alias -# else: -# raise RuntimeError('cannot locate get_element()') -# -# for k in 'required default_value enum patterns name type'.split(): -# if hasattr(rules, k): -# self.__setattr__(k, rules.__getattribute__(k)) -# # TODO: convert type (such as nx:validItemName into pattern -# # self.parent.nxdl.children['attribute'] -# -# for k, v in rules.attrs.items(): -# self.nxdl_attributes[k] = get_element('attribute', parent=self) -# -# _breakpoint = True # TODO: -# -# -# class NXDL_element__field(NXDL_Base): # TODO: -# ''' -# a complete description of a specific NXDL field -# ''' -# -# optional = True -# -# nxdl_attributes = {} -# -# -# class NXDL_element__group(NXDL_Base): # TODO: -# ''' -# a complete description of a specific NXDL group -# ''' -# -# optional = True -# -# nxdl_attributes = {} -# nxdl_groups = {} -# nxdl_fields = {} -# -# -# class NXDL_element__link(NXDL_Base): # TODO: -# ''' -# a complete description of a specific NXDL link -# ''' -# -# optional = True -# -# -# class NXDL_element__symbols(NXDL_Base): # TODO: -# ''' -# a complete description of a specific NXDL symbol -# ''' -# -# optional = True - - -class Mixin(object): +class NXDL__Mixin(object): + + """ + base class for each NXDL structure + """ - def __init__(self): # TODO: - pass + def __init__(self, nxdl_definition, *args, **kwds): + self.name = None + self.nxdl_definition = nxdl_definition + self.xml_attributes = {} def __str__(self, *args, **kwargs): - return punx.nxdl_schema.render_class_str(self) + return nxdl_schema.render_class_str(self) + + def parse_nxdl_xml(self, *args, **kwargs): + """parse the XML node and assemble NXDL structure""" + raise NotImplementedError('must override parse_nxdl_xml() in subclass') + + def parse_xml_attributes(self, defaults): + """ """ + for k, v in sorted(defaults.attributes.items()): + self.xml_attributes[k] = v + + def parse_attributes(self, xml_node): + """ """ + ns = nxdl_schema.get_xml_namespace_dictionary() + manager = self.nxdl_definition.nxdl_manager + nxdl_defaults = manager.nxdl_defaults + + for node in xml_node.xpath('nx:attribute', namespaces=ns): + obj = NXDL__attribute(self.nxdl_definition, nxdl_defaults=nxdl_defaults) + obj.parse_nxdl_xml(node) + + if self.nxdl_definition.category in ('applications', ): + # handle contributed definitions as base classes (for now, minOccurs = 0) + # TODO: test for hasattr(base class, "definition") + obj.xml_attributes['optional'].default_value = False + + # Does a default already exist? + if obj.name in self.attributes: + msg = "replace attribute @" + obj.name + msg += " in " + str(self) + logger.error(msg) + raise KeyError(msg) + self.attributes[obj.name] = obj + + def parse_fields(self, xml_node): + """ """ + ns = nxdl_schema.get_xml_namespace_dictionary() + manager = self.nxdl_definition.nxdl_manager + nxdl_defaults = manager.nxdl_defaults + + for node in xml_node.xpath('nx:field', namespaces=ns): + obj = NXDL__field(self.nxdl_definition, nxdl_defaults=nxdl_defaults) + obj.parse_nxdl_xml(node) + + if self.nxdl_definition.category in ('applications', ): + # handle contributed definitions as base classes (for now, minOccurs = 0) + obj.xml_attributes['minOccurs'].default_value = 1 + + self.ensure_unique_name(obj) + self.fields[obj.name] = obj + + def parse_groups(self, xml_node): + """ """ + ns = nxdl_schema.get_xml_namespace_dictionary() + manager = self.nxdl_definition.nxdl_manager + nxdl_defaults = manager.nxdl_defaults + + for node in xml_node.xpath('nx:group', namespaces=ns): + obj = NXDL__group(self.nxdl_definition, nxdl_defaults=nxdl_defaults) + obj.parse_nxdl_xml(node) + + if self.nxdl_definition.category in ('applications', ): + # handle contributed definitions as base classes (for now, minOccurs = 0) + obj.xml_attributes['minOccurs'].default_value = 1 + + self.ensure_unique_name(obj) + self.groups[obj.name] = obj + + def parse_links(self, xml_node): + """ """ + ns = nxdl_schema.get_xml_namespace_dictionary() + manager = self.nxdl_definition.nxdl_manager + nxdl_defaults = manager.nxdl_defaults + + for node in xml_node.xpath('nx:link', namespaces=ns): + obj = NXDL__link(self.nxdl_definition, nxdl_defaults=nxdl_defaults) + obj.parse_nxdl_xml(node) + if obj is None: + msg = "link with no content!" + msg += " line: %d" % node.sourceline + msg += " file: %s" % node.base + logger.error(msg) + raise ValueError(msg) + self.ensure_unique_name(obj) + self.links[obj.name] = obj + + def parse_symbols(self, xml_node): + """ """ + ns = nxdl_schema.get_xml_namespace_dictionary() + manager = self.nxdl_definition.nxdl_manager + nxdl_defaults = manager.nxdl_defaults + + for node in xml_node.xpath('nx:symbols', namespaces=ns): + obj = NXDL__symbols(self.nxdl_definition, nxdl_defaults=nxdl_defaults) + obj.parse_nxdl_xml(node) + if len(obj.symbols) > 0: + self.symbols += obj.symbols + + def ensure_unique_name(self, obj): + """ """ + name_list = [] + for k in 'groups fields links'.split(): + name_list += list(self.__getattribute__(k).keys()) + if obj.name in name_list: + base_name = obj.name + index = 1 + while base_name+str(index) in name_list: + index += 1 + obj.name = base_name+str(index) + + def assign_defaults(self): + """set default values for required components now""" + for k, v in sorted(self.xml_attributes.items()): + if v.required and not hasattr(self, k): + self.__setattr__(k, v.default_value) -class NXDL_element__definition(punx.singletons.Singleton, Mixin): - ''' +class NXDL__definition(NXDL__Mixin): + + """ contents of a *definition* element in a NXDL XML file :param str path: absolute path to NXDL definitions directory (has nxdl.xsd) - ''' - - def __init__(self, path): - self.nxdl_path = path - self.schema_file = os.path.join(path, punx.nxdl_schema.NXDL_XSD_NAME) + """ + + def __init__(self, nxdl_manager=None, *args, **kwds): + self.nxdl_definition = self + self.nxdl_manager = nxdl_manager + self.nxdl_path = self.nxdl_manager.nxdl_file_set.path + self.schema_file = os.path.join(self.nxdl_path, nxdl_schema.NXDL_XSD_NAME) assert(os.path.exists(self.schema_file)) - nxdl_defaults = punx.nxdl_schema.NXDL_Summary(self.schema_file) - - for k, v in nxdl_defaults.definition.__dict__.items(): - self.__setattr__(k, v) - del self.children - - # parse this content into classes in _this_ module - for k, v in self.attributes.items(): - attribute = NXDL_element__attribute(nxdl_defaults.attribute) - obj = copy.deepcopy(attribute) # ALWAYS make a copy of that - for item in 'name type required'.split(): - obj.__setattr__(item, v.__getattribute__(item)) # TODO: should override default - del obj.maxOccurs - del obj.minOccurs - # TODO: what else to retain? - self.attributes[k] = obj - - for k, v in self.elements.items(): # TODO: is this a field? - print(k, str(v)) -# field = NXDL_element__field(nxdl_defaults.field) -# obj = copy.deepcopy(field) # ALWAYS make a copy of that - - for k, v in self.groups.items(): - print(k, str(v)) -# group = NXDL_element__group(nxdl_defaults.group) -# obj = copy.deepcopy(group) # ALWAYS make a copy of that + + self.title = None + self.category = None + self.file_name = None + + self.attributes = {} + self.xml_attributes = {} + self.fields = {} + self.groups = {} + self.links = {} + self.symbols = [] + + nxdl_defaults = nxdl_manager.get_nxdl_defaults() + self._init_defaults_from_schema(nxdl_defaults) + + def __str__(self, *args, **kwargs): + s = self.title + "(" + args = [] + args.append("category=" + self.category) + for k in "attributes fields groups links symbols".split(): + args.append(k + ":%d" % len(self.__getattribute__(k))) + args.append("attributes:%d" % len(self.attributes)) + s += ", ".join(args) + s += ")" + return s + + def _init_defaults_from_schema(self, nxdl_defaults): + """ """ + # definition is special: it has structure of a group AND a symbols table + + self.minOccurs = 0 + self.maxOccurs = 1 + + self.parse_xml_attributes(nxdl_defaults.definition) + + # remove the recursion part + if "(group)" in self.groups: + del self.groups["(group)"] def set_file(self, fname): + """ + self.category: base_classes | applications | contributed_definitions + + determine the category of this NXDL + """ self.file_name = fname assert(os.path.exists(fname)) self.title = os.path.split(fname)[-1].split('.')[0] self.category = os.path.split(os.path.dirname(fname))[-1] + + def parse_nxdl_xml(self): + """parse the XML content""" + if self.file_name is None or not os.path.exists(self.file_name): + msg = 'NXDL file: ' + str(self.file_name) + logger.error(msg) + raise FileNotFound(msg) + + lxml_tree = lxml.etree.parse(self.file_name) + + try: + validate_xml_tree(lxml_tree) + except InvalidNxdlFile as exc: + msg = 'NXDL file is not valid: ' + self.file_name + msg += '\n' + str(exc) + logger.error(msg) + raise InvalidNxdlFile(msg) + + root_node = lxml_tree.getroot() + + # parse the XML content of this NXDL definition element + self.parse_symbols(root_node) + self.parse_attributes(root_node) + self.parse_groups(root_node) + self.parse_fields(root_node) + self.parse_links(root_node) + + +class NXDL__attribute(NXDL__Mixin): + + """ + contents of a *attribute* structure (XML element) in a NXDL XML file - def parse(self): - pass - - -class NXDL_element__attribute(Mixin): - ''' - contents of a *attribute* element in a NXDL XML file - ''' - - def __init__(self, nxdl_defaults): - for k, v in nxdl_defaults.__dict__.items(): - self.__setattr__(k, v) - - -class NXDL_element__field(Mixin): - ''' - contents of a *field* element in a NXDL XML file - ''' - - -class NXDL_element__group(Mixin): - ''' - contents of a *group* element in a NXDL XML file - ''' - - -class NXDL_element__link(Mixin): - ''' - contents of a *link* element in a NXDL XML file - ''' - - -class NXDL_element__symbols(Mixin): - ''' - contents of a *symbols* element in a NXDL XML file - ''' - - -# class NXDL_ElementFactory(object): -# ''' -# creates and serves new classes with proper default values from the NXDL rules -# -# called by :class:`punx.cache_manager.NXDL_File_Set()` -# ''' -# -# db = {} # internal set of known elements -# file_set = None -# creators = { -# 'definition': NXDL_element__definition, -# 'attribute': NXDL_element__attribute, -# 'field': NXDL_element__field, -# 'group': NXDL_element__group, -# 'link': NXDL_element__link, -# 'symbols': NXDL_element__symbols, -# } -# -# def __init__(self, file_set): -# self.file_set = file_set -# -# def get_element(self, element_name, parent=None): -# ''' -# create a new element or get one already built with defaults from the XML Schema -# ''' -# if element_name not in self.db: -# if element_name == 'definition': -# # special case -# self.db[element_name] = NXDL_element__definition(self.file_set) -# -# elif element_name in self.creators.keys(): -# self.db[element_name] = self.creators[element_name](parent) -# -# else: -# raise KeyError('unhandled NXDL element: ' + element_name) -# -# element = self.db[element_name] -# element.nxdl = self.file_set.schema_manager.nxdl -# -# schema_types = element.nxdl.schema_types # alias -# if element_name not in schema_types: -# msg = 'unexpected element type: ' + element_name -# msg += ', expected one of these: ' + ' '.join(sorted(schema_types.keys())) -# raise KeyError(msg) -# element.set_defaults(schema_types[element_name]) -# -# element = copy.deepcopy(self.db[element_name]) -# -# # TODO set the defaults accordingly for application definitions -# -# return element - - -def main(): - import punx.cache_manager - cm = punx.cache_manager.CacheManager() - if cm is not None and cm.default_file_set is not None: - nxdl_dict = NXDL_Manager(cm.default_file_set).classes - - _t = True - for k, v in nxdl_dict.items(): - print(v.category, k) - - -if __name__ == '__main__': - main() + ~parse_nxdl_xml + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + + self.enumerations = [] + + if hasattr(self, 'groups'): + del self.groups + if hasattr(self, 'minOccurs'): + del self.minOccurs + if hasattr(self, 'maxOccurs'): + del self.maxOccurs + + self._init_defaults_from_schema(nxdl_defaults) + + def _init_defaults_from_schema(self, nxdl_defaults): + self.parse_xml_attributes(nxdl_defaults.attribute) + self.assign_defaults() + + def parse_nxdl_xml(self, xml_node): + """ + parse the XML content + """ + self.name = xml_node.attrib['name'] + + ns = nxdl_schema.get_xml_namespace_dictionary() + + for enum_node in xml_node.xpath('nx:enumeration', namespaces=ns): + for node in enum_node.xpath('nx:item', namespaces=ns): + v = node.attrib.get('value') + if v is not None: + self.enumerations.append(v) + +class NXDL__dim(NXDL__Mixin): + + """ + contents of a *dim* structure (XML element) in a NXDL XML file + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + self._init_defaults_from_schema(nxdl_defaults) + + def _init_defaults_from_schema(self, nxdl_defaults): + """ """ + self.parse_xml_attributes(nxdl_defaults.field.components["dimensions"].components["dim"]) + + def parse_nxdl_xml(self, xml_node): + """ + parse the XML content + """ + for k in "index value ref refindex incr".split(): + self.__setattr__(k, xml_node.attrib.get(k)) + self.name = self.index + + +class NXDL__dimensions(NXDL__Mixin): + + """ + contents of a *dimensions* structure (XML element) in a NXDL XML file + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + + self.rank = None + self.dims = collections.OrderedDict() + self._init_defaults_from_schema(nxdl_defaults) + + def _init_defaults_from_schema(self, nxdl_defaults): + self.parse_xml_attributes(nxdl_defaults.field.components["dimensions"]) + + def parse_nxdl_xml(self, xml_node): + """ + parse the XML content + """ + ns = nxdl_schema.get_xml_namespace_dictionary() + nxdl_defaults = self.nxdl_definition.nxdl_manager.nxdl_defaults + + self.rank = xml_node.attrib.get("rank") # nxdl.xsd says NX_CHAR but should be NX_UINT? issue #571 + for node in xml_node.xpath('nx:dim', namespaces=ns): + obj = NXDL__dim(self.nxdl_definition, nxdl_defaults=nxdl_defaults) + obj.parse_nxdl_xml(node) + self.dims[obj.name] = obj + + + +class NXDL__field(NXDL__Mixin): + + """ + contents of a *field* structure (XML element) in a NXDL XML file + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + + self.attributes = {} + self.dimensions = None + self.enumerations = [] + + self._init_defaults_from_schema(nxdl_defaults) + + def _init_defaults_from_schema(self, nxdl_defaults): + self.parse_xml_attributes(nxdl_defaults.field) + self.assign_defaults() + + def parse_nxdl_xml(self, xml_node): + """parse the XML content""" + self.name = xml_node.attrib['name'] + + self.parse_attributes(xml_node) + + ns = nxdl_schema.get_xml_namespace_dictionary() + nxdl_defaults = self.nxdl_definition.nxdl_manager.nxdl_defaults + + dims_nodes = xml_node.xpath('nx:dimensions', namespaces=ns) + if len(dims_nodes) == 1: + self.dimensions = NXDL__dimensions( + self.nxdl_definition, + nxdl_defaults=nxdl_defaults) + self.dimensions.parse_nxdl_xml(dims_nodes[0]) + + for node in xml_node.xpath('nx:enumeration/nx:item', namespaces=ns): + self.enumerations.append(node.attrib.get("value")) + +class NXDL__group(NXDL__Mixin): + + """ + contents of a *group* structure (XML element) in a NXDL XML file + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + + self.attributes = {} + self.fields = {} + self.groups = {} + self.links = {} + + self._init_defaults_from_schema(nxdl_defaults) + + def _init_defaults_from_schema(self, nxdl_defaults): + self.parse_xml_attributes(nxdl_defaults.group) + self.assign_defaults() + + def parse_nxdl_xml(self, xml_node): + """parse the XML content""" + self.name = xml_node.attrib.get('name', xml_node.attrib['type'][2:]) + + self.parse_attributes(xml_node) + for k, v in xml_node.attrib.items(): + if k not in ("name", "type"): + self.attributes[k] = v # FIXME: should be NXDL__attribute instance + self.parse_groups(xml_node) + self.parse_fields(xml_node) + self.parse_links(xml_node) + + +class NXDL__link(NXDL__Mixin): + + """ + contents of a *link* structure (XML element) in a NXDL XML file + + example from NXmonopd:: + + <link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"> + <doc>Link to polar angle in /NXentry/NXinstrument/NXdetector</doc> + </link> + <link name="data" target="/NXentry/NXinstrument/NXdetector/data"> + <doc>Link to data in /NXentry/NXinstrument/NXdetector</doc> + </link> + + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + + self.name = None + self.target = None + + def parse_nxdl_xml(self, xml_node): + """parse the XML content""" + self.name = xml_node.attrib['name'] + self.target = xml_node.attrib.get('target') + + +class NXDL__symbols(NXDL__Mixin): + + """ + contents of a *symbols* structure (XML element) in a NXDL XML file + + example from NXcrystal:: + + <symbols> + <doc>These symbols will be used below to coordinate dimensions with the same lengths.</doc> + <symbol name="n_comp"><doc>number of different unit cells to be described</doc></symbol> + <symbol name="i"><doc>number of wavelengths</doc></symbol> + </symbols> + + """ + + def __init__(self, nxdl_definition, nxdl_defaults=None, *args, **kwds): + NXDL__Mixin.__init__(self, nxdl_definition) + + self.symbols = [] + + def parse_nxdl_xml(self, symbols_node): + """parse the XML content""" + for node in symbols_node: + if isinstance(node, lxml.etree._Comment): + continue + + element_type = node.tag.split('}')[-1] + if element_type == "symbol": + nm = node.attrib.get('name') + if nm is not None: + self.symbols.append(nm) +# +# +# def main(): +# from punx import cache_manager +# cm = cache_manager.CacheManager() +# cm.select_NXDL_file_set("master") +# if cm is not None and cm.default_file_set is not None: +# manager = NXDL_Manager(cm.default_file_set) +# counts_keys = 'attributes fields groups links symbols'.split() +# total_counts = {k: 0 for k in counts_keys} +# +# try: +# def count_group(g, counts): +# for k in counts_keys: +# if hasattr(g, k): +# n = len(g.__getattribute__(k)) +# if n > 0: +# counts[k] += n +# for group in g.groups.values(): +# counts = count_group(group, counts) +# return counts +# +# import pyRestTable +# t = pyRestTable.Table() +# t.labels = 'class category'.split() + counts_keys +# for v in manager.classes.values(): +# row = [v.title, v.category] +# counts = {k: 0 for k in counts_keys} +# counts = count_group(v, counts) +# for k in counts_keys: +# n = counts[k] +# total_counts[k] += n +# if n == 0: +# n = "" +# row.append(n) +# t.addRow(row) +# +# t.addRow(["TOTAL", "-"*4] + ["-"*4 for k in counts_keys]) +# row = [len(manager.classes), 3] +# for k in counts_keys: +# n = total_counts[k] +# if n == 0: +# n = "" +# row.append(n) +# t.addRow(row) +# print(t) +# except Exception: +# pass +# +# print(manager) +# +# +# if __name__ == '__main__': +# main() diff --git a/src/punx/nxdl_schema.py b/src/punx/nxdl_schema.py index 3297940e0d19e2953834535f87bb429422996bd7..26ab5eb31f32ce16d1b6b431a23ff8f2a27def01 100644 --- a/src/punx/nxdl_schema.py +++ b/src/punx/nxdl_schema.py @@ -4,7 +4,7 @@ #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2017, Pete R. Jemian +# :copyright: (c) 2017-2018, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # @@ -12,7 +12,7 @@ #----------------------------------------------------------------------------- -''' +""" Read the NeXus XML Schema .. autosummary:: @@ -39,26 +39,23 @@ NXDL structures. These internal structures are used: Note there is a recursion within :class:`NXDL_schema__group` since a *group* may contain a child *group*. -''' +""" from __future__ import print_function import lxml.etree import os -import sys -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -import punx.singletons +from . import utils + +logger = utils.setup_logger(__name__) NXDL_XSD_NAME = 'nxdl.xsd' -NXDL_TEST_FILE = os.path.join(os.path.dirname(__file__), 'cache', 'v3.2', NXDL_XSD_NAME) +NXDL_TEST_FILE = os.path.join(os.path.dirname(__file__), 'cache', 'v3.3', NXDL_XSD_NAME) def get_xml_namespace_dictionary(): - ''' - return the NeXus XML namespace dictionary - ''' + """return the NeXus XML namespace dictionary""" return dict( # TODO: generalize this nx="http://definition.nexusformat.org/nxdl/3.1", xs="http://www.w3.org/2001/XMLSchema", @@ -66,9 +63,7 @@ def get_xml_namespace_dictionary(): def get_named_parent_node(xml_node): - ''' - return the closest XML ancestor node with a ``name`` attribute or the schema node - ''' + """return closest XML ancestor node with a ``name`` attribute or the schema node""" parent = xml_node.getparent() if 'name' not in parent.attrib and not parent.tag.endswith('}schema'): parent = get_named_parent_node(parent) @@ -76,18 +71,22 @@ def get_named_parent_node(xml_node): def get_reference_keys(xml_node): - ''' - reference an xml_node in the catalog: ``catalog[section][line]`` - ''' + """reference an xml_node in the catalog: ``catalog[section][line]``""" section = xml_node.tag.split('}')[-1] line = 'Line %d' % xml_node.sourceline return section, line def render_class_str(obj): - ''' - for use in classes: ``def __str__(self): return render_class_str(self)`` - ''' + """ + useful optimization for classes + + USAGE:: + + def __str__(self): + return render_class_str(self) + + """ excluded = (list, dict) msg = '%s(' % type(obj).__name__ l = [] @@ -99,29 +98,31 @@ def render_class_str(obj): return msg -class Mixin(object): +class NXDL_schema__Mixin(object): + + """ """ def __str__(self, *args, **kwargs): return render_class_str(self) -class NXDL_schema__attribute(Mixin): - ''' +class NXDL_schema__attribute(NXDL_schema__Mixin): + + """ node matches XPath query: ``//xs:attribute`` xml_node is ``xs:attribute`` a complete description of a specific NXDL attribute element - notes on attributes - ------------------- + NOTES ON ATTRIBUTES In nxdl.xsd, "attributeType" is used by fieldType and groupGroup to define the NXDL "attribute" element used in fields and groups, respectively. It is not necessary for this code to parse "attributeType" from the rules. Each of these XML *complexType* elements defines its own set of - attributes and defaults for use in corresponding NXDL elements: + attributes and defaults for use in corresponding NXDL components: * attributeType * basicComponent @@ -158,7 +159,7 @@ class NXDL_schema__attribute(Mixin): The XPath query for ``//xs:attribute`` from the root node will pick up all of these. It will be necessary to walk through the parent nodes to determine where each should be applied. - ''' + """ def __init__(self): self.name = None @@ -171,11 +172,11 @@ class NXDL_schema__attribute(Mixin): self.nxdl_attributes = {} def parse(self, xml_node): - ''' + """ read the attribute node content from the XML Schema xml_node is xs:attribute - ''' + """ assert(xml_node.tag.endswith('}attribute')) ns = get_xml_namespace_dictionary() @@ -184,71 +185,57 @@ class NXDL_schema__attribute(Mixin): self.required = xml_node.attrib.get('use', self.required) in ('required', True) self.default_value = xml_node.attrib.get('default', self.default_value) - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - - elif node.tag.endswith('}annotation'): - pass + nodelist = xml_node.xpath('xs:simpleType/xs:restriction/xs:pattern', namespaces=ns) + if len(nodelist) == 1: + self.patterns.append(nodelist[0].attrib['value']) - elif node.tag.endswith('}simpleType'): - nodelist = node.xpath('xs:restriction/xs:pattern', namespaces=ns) - if len(nodelist) == 1: - self.patterns.append(nodelist[0].attrib['value']) - else: - msg = node.getparent().attrib['name'] - msg += ' (line %d)' % node.sourceline - msg += ': unexpected xs:attribute child node: ' - msg += node.tag - raise ValueError(msg) - - -class NXDL_schema__attributeGroup(Mixin): - ''' +class NXDL_schema__attributeGroup(NXDL_schema__Mixin): + + """ node matches XPath query: ``/xs:schema/xs:attributeGroup`` xml_node is ``xs:attributeGroup`` - ''' + """ def __init__(self): self.name = None self.children = [] def parse(self, xml_node): - ''' + """ read the attributeGroup node content from the XML Schema xml_node is xs:attributeGroup - ''' + """ assert(xml_node.tag.endswith('}attributeGroup')) + ns = get_xml_namespace_dictionary() + self.name = xml_node.attrib.get('name', self.name) - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - elif node.tag.endswith('}attribute'): - obj = NXDL_schema__attribute() - obj.parse(node) - self.children.append(obj) + for node in xml_node.xpath('xs:attribute', namespaces=ns): + obj = NXDL_schema__attribute() + obj.parse(node) + self.children.append(obj) -class NXDL_schema_complexType(Mixin): - ''' +class NXDL_schema__complexType(NXDL_schema__Mixin): + + """ node matches XPath query: ``/xs:schema/xs:complexType`` xml_node is ``xs:complexType`` - ''' + """ def __init__(self): self.children = [] self.name = None def parse(self, xml_node, catalog): - ''' - read the element node content from the XML Schema - ''' + """read the element node content from the XML Schema""" assert(xml_node.tag.endswith('}complexType')) + ns = get_xml_namespace_dictionary() + self.name = xml_node.attrib.get('name', self.name) handlers = dict( @@ -259,104 +246,78 @@ class NXDL_schema_complexType(Mixin): attributeGroup = self._parse_attributeGroup, ) - tags_ignored = ['annotation',] - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - - tag = node.tag.split('}')[-1] - if tag in handlers.keys(): + element_list = """sequence complexContent + group attribute attributeGroup""".split() + for element_type in element_list: + for node in xml_node.xpath('xs:'+element_type, namespaces=ns): + tag = node.tag.split('}')[-1] handlers[tag](node, catalog) - - elif tag not in tags_ignored: - print('!\t', xml_node.attrib['name'], tag, node.sourceline) def _parse_attribute(self, xml_node, catalog): - ''' - parse a xs:attribute node - ''' + """parse a xs:attribute node""" assert(xml_node.tag.endswith('}attribute')) section, line = get_reference_keys(xml_node) obj = catalog[section][line] self.children.append(obj) def _parse_attributeGroup(self, xml_node, catalog): - ''' - parse a xs:attributeGroup node - ''' + """parse a xs:attributeGroup node""" assert(xml_node.tag.endswith('}attributeGroup')) ref = xml_node.attrib['ref'].split(':')[-1] obj = catalog['schema'][ref] self.children += obj.children def _parse_complexContent(self, xml_node, catalog): - ''' - parse a xs:complexContent node - ''' + """parse a xs:complexContent node""" assert(xml_node.tag.endswith('}complexContent')) self._parse_extension(xml_node[0], catalog) def _parse_element(self, xml_node, catalog): - ''' - parse a xs:element node - ''' + """parse a xs:element node""" assert(xml_node.tag.endswith('}element')) section, line = get_reference_keys(xml_node) obj = catalog[section][line] self.children.append(obj) def _parse_extension(self, xml_node, catalog): - ''' - parse a xs:extension node - ''' + """parse a xs:extension node""" assert(xml_node.tag.endswith('}extension')) + ns = get_xml_namespace_dictionary() + base = xml_node.attrib.get('base', None) if base is not None: base = base.split(':')[-1] obj = catalog['schema'][base] self.children += obj.children - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - - elif node.tag.endswith('}sequence'): - self._parse_sequence(node, catalog) - - elif node.tag.endswith('}attribute'): - self._parse_attribute(node, catalog) + + for node in xml_node.xpath('xs:sequence', namespaces=ns): + self._parse_sequence(node, catalog) + for node in xml_node.xpath('xs:attribute', namespaces=ns): + self._parse_attribute(node, catalog) def _parse_group(self, xml_node, catalog): - ''' - parse a xs:group node - ''' + """parse a xs:group node""" assert(xml_node.tag.endswith('}group')) section, line = get_reference_keys(xml_node) obj = catalog[section][line] self.children.append(obj) def _parse_sequence(self, xml_node, catalog): - ''' - parse a xs:sequence node - ''' + """parse a xs:sequence node""" assert(xml_node.tag.endswith('}sequence')) - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - - elif node.tag.endswith('}element'): - self._parse_element(node, catalog) - - elif node.tag.endswith('}group'): - self._parse_group(node, catalog) + ns = get_xml_namespace_dictionary() - elif node.tag.endswith('}any'): - pass + for node in xml_node.xpath('xs:element', namespaces=ns): + self._parse_element(node, catalog) + for node in xml_node.xpath('xs:group', namespaces=ns): + self._parse_group(node, catalog) + # for node in xml_node.xpath('xs:any', namespaces=ns): + # pass # and do what? -class NXDL_schema__element(Mixin): - ''' - a complete description of a specific NXDL xs:element node - ''' +class NXDL_schema__element(NXDL_schema__Mixin): + + """a complete description of a specific NXDL xs:element node""" def __init__(self): self.children = [] @@ -366,10 +327,10 @@ class NXDL_schema__element(Mixin): self.maxOccurs = None def parse(self, xml_node): - ''' - read the element node content from the XML Schema - ''' + """read the element node content from the XML Schema""" assert(xml_node.tag.endswith('}element')) + ns = get_xml_namespace_dictionary() + self.name = xml_node.attrib.get('name', self.name) self.type = xml_node.attrib.get('type', self.type) if self.type is not None: @@ -377,31 +338,25 @@ class NXDL_schema__element(Mixin): self.minOccurs = xml_node.attrib.get('minOccurs', self.minOccurs) self.maxOccurs = xml_node.attrib.get('maxOccurs', self.maxOccurs) - ns = get_xml_namespace_dictionary() nodes = xml_node.xpath('xs:complexType', namespaces=ns) if len(nodes) == 1: - for node in nodes[0]: - if isinstance(node, lxml.etree._Comment): - continue - - elif node.tag.endswith('}sequence'): - for subnode in node.xpath('xs:element', namespaces=ns): - obj = NXDL_schema__element() - obj.parse(subnode) - self.children.append(obj) - - elif node.tag.endswith('}attribute'): - obj = NXDL_schema__attribute() - obj.parse(node) - self.children.append(obj) - - -class NXDL_schema__group(Mixin): - ''' + for node in nodes[0].xpath('xs:sequence/xs:element', namespaces=ns): + obj = NXDL_schema__element() + obj.parse(node) + self.children.append(obj) + for node in nodes[0].xpath('xs:attribute', namespaces=ns): + obj = NXDL_schema__attribute() + obj.parse(node) + self.children.append(obj) + + +class NXDL_schema__group(NXDL_schema__Mixin): + + """ node matches XPath query: ``//xs:group`` xml_node is ``xs:group`` - ''' + """ def __init__(self): self.children = [] @@ -411,35 +366,30 @@ class NXDL_schema__group(Mixin): self.maxOccurs = None def parse(self, xml_node): - ''' - read the element node content from the XML Schema - ''' + """read the element node content from the XML Schema""" assert(xml_node.tag.endswith('}group')) + ns = get_xml_namespace_dictionary() + self.name = xml_node.attrib.get('name', self.name) self.ref = xml_node.attrib.get('ref', self.ref) if self.ref is not None: self.ref = self.ref.split(':')[-1] self.minOccurs = xml_node.attrib.get('minOccurs', self.minOccurs) self.maxOccurs = xml_node.attrib.get('maxOccurs', self.maxOccurs) - - ns = get_xml_namespace_dictionary() - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - elif node.tag.endswith('}sequence'): - for subnode in node.xpath('xs:element', namespaces=ns): - obj = NXDL_schema__element() - obj.parse(subnode) - self.children.append(obj) + for node in xml_node.xpath('xs:sequence/xs:element', namespaces=ns): + obj = NXDL_schema__element() + obj.parse(node) + self.children.append(obj) -class NXDL_schema_named_simpleType(Mixin): - ''' +class NXDL_schema_named_simpleType(NXDL_schema__Mixin): + + """ node matches XPath query: ``/xs:schema/xs:simpleType`` xml_node is ``xs:simpleType`` - ''' + """ def __init__(self): self.children = [] @@ -450,45 +400,32 @@ class NXDL_schema_named_simpleType(Mixin): #self.enums = [] def parse(self, xml_node): - ''' - read the attribute node content from the XML Schema - ''' + """read the attribute node content from the XML Schema""" assert(xml_node.tag.endswith('}simpleType')) ns = get_xml_namespace_dictionary() + self.name = xml_node.attrib.get('name', self.name) - - for node in xml_node: - if isinstance(node, lxml.etree._Comment): - continue - - elif node.tag.endswith('}annotation'): - pass - - elif node.tag.endswith('}restriction'): - self.base = node.attrib.get('base', self.base) - if self.base is not None: - self.base = self.base.split(':')[-1] - for subnode in node.xpath('xs:pattern', namespaces=ns): - self.patterns.append(subnode.attrib['value']) - for subnode in node.xpath('xs:maxLength', namespaces=ns): - self.maxLength = int(subnode.attrib['value']) - - elif node.tag.endswith('}union'): - # TODO: nonNegativeUnbounded - # either xs:nonNegativeInteger or xs:string = "unbounded" - # How to represent this? - pass - - else: - msg = node.getparent().attrib['name'] - msg += ' (line %d)' % node.sourceline - msg += ': unexpected xs:attribute child node: ' - msg += node.tag - raise ValueError(msg) + + for node in xml_node.xpath('xs:annotation', namespaces=ns): + pass + for node in xml_node.xpath('xs:union', namespaces=ns): + # TODO: nonNegativeUnbounded + # either xs:nonNegativeInteger or xs:string = "unbounded" + # How to represent this? + pass + for node in xml_node.xpath('xs:restriction', namespaces=ns): + self.base = node.attrib.get('base', self.base) + if self.base is not None: + self.base = self.base.split(':')[-1] + for subnode in node.xpath('xs:pattern', namespaces=ns): + self.patterns.append(subnode.attrib['value']) + for subnode in node.xpath('xs:maxLength', namespaces=ns): + self.maxLength = int(subnode.attrib['value']) class NXDL_item_catalog(object): - ''' + + """ content from the NeXus XML Schema (``nxdl.xsd``) EXAMPLE: @@ -497,7 +434,7 @@ class NXDL_item_catalog(object): catalog = NXDL_item_catalog(nxdl_xsd_file_name) definition = catalog.definition_element - ''' + """ def __init__(self, nxdl_file_name): self.db = {} @@ -556,6 +493,7 @@ class NXDL_item_catalog(object): apply_substitutions(self.definition_element, self.db) def add_to_catalog(self, node, obj, key=None): + """ """ section, line = get_reference_keys(node) section = key or section if section not in self.db: @@ -579,7 +517,7 @@ class NXDL_item_catalog(object): # only look at root node children: 'xs:complexType', not '//xs:complexType' for node in root.xpath('xs:complexType', namespaces=self.ns): if 'name' in node.attrib: - obj = NXDL_schema_complexType() + obj = NXDL_schema__complexType() obj.parse(node, self.db) self.add_to_catalog(node, obj, key = 'schema') self.db['schema'][obj.name] = obj # for cross-reference @@ -620,8 +558,9 @@ class NXDL_item_catalog(object): v.base = known_base.base -class NXDL_Summary(punx.singletons.Singleton): - ''' +class NXDL_Summary(object): + + """ provide an easy interface for the nxdl_manager USAGE:: @@ -630,7 +569,7 @@ class NXDL_Summary(punx.singletons.Singleton): ... summary.simpleType['validItemName'].patterns - ''' + """ def __init__(self, nxdl_xsd_file_name): self.definition = None @@ -650,14 +589,14 @@ class NXDL_Summary(punx.singletons.Singleton): self.build_tree(catalog.definition_element) self.definition = catalog.definition_element - self.group = self.definition.groups.values()[0] - self.group.attributes = self.group.elements['group'].attributes - self.attribute = self.group.elements['attribute'] - self.doc = self.group.elements['doc'] - self.field = self.group.elements['field'] - self.group.elements['group'] = 'recursion' - self.link = self.group.elements['link'] - self.symbols = self.definition.elements.values()[0] + self.group = list(self.definition.groups.values())[0] + self.group.attributes = self.group.components['group'].attributes + self.attribute = self.group.components['attribute'] + self.doc = self.group.components['doc'] + self.field = self.group.components['field'] + self.group.components['group'] = 'recursion' + self.link = self.group.components['link'] + self.symbols = list(self.definition.components.values())[0] self.simpleType = catalog.db['simpleType'] @@ -675,9 +614,14 @@ class NXDL_Summary(punx.singletons.Singleton): nm = child.name or '(%s)' % kind target[nm] = child self.build_tree(child) + + # rename this + obj.components = obj.elements + del obj.elements def print_tree(obj, level=0): + """ """ indent = ' '*4*level k = type(obj).__name__.split('_')[-1] count = 1 @@ -707,13 +651,3 @@ def print_tree(obj, level=0): c, d = print_tree(child, level+1) count = keep_stats(count, db, c, d) return count, db - - -def issue_67_main(): - summary = NXDL_Summary(NXDL_TEST_FILE) - count, db = print_tree(summary.definition) - print(count, db) - - -if __name__ == '__main__': - issue_67_main() diff --git a/src/punx/nxdltree.py b/src/punx/nxdltree.py new file mode 100644 index 0000000000000000000000000000000000000000..ad12220dcb88a7839f830dfe841dd4e645a8c562 --- /dev/null +++ b/src/punx/nxdltree.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2014-2018, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +""" +Describe the tree structure of a NXDL XML file + +.. autosummary:: + + ~NxdlTreeView +""" + + +import os +import lxml.etree + +from . import cache_manager + + +class NxdlTreeView(object): + """ + Describe the tree structure of a NXDL XML file + + Example usage showing default display:: + + mc = NxdlTreeView(nxdl_file_name) + mc.array_items_shown = 5 + show_attributes = False + txt = mc.report(show_attributes) + """ + + def __init__(self, nxdl_file): + """store nxdl_file and test if file is NeXus HDF5""" + self.requested_nxdl_file = nxdl_file + self.nxdl_file = None + self.show_attributes = True + if os.path.exists(nxdl_file): + self.nxdl_file = nxdl_file + self.nxdl_category = self._determine_category_() + + def report(self, show_attributes=True): + """ + return the structure of the NXDL file in a list of strings + + The work of parsing the data file is done in this method. + """ + cm = cache_manager.CacheManager() + file_set = cm.default_file_set + + xslt_file = os.path.join(file_set.path, self.nxdl_category, "nxdlformat.xsl") + if not os.path.exists(xslt_file): + raise ValueError('XSLT file not found: ' + xslt_file) + + text = self._xslt_(xslt_file) + result = [ + "file: " + self.nxdl_file, + "XSLT: " + xslt_file, + ] + result += text.splitlines() + return result + + def _determine_category_(self): + """determine the NXDL category of this file + + Could be: + + * base_classes + * applications + * contributed_definition + * None + """ + xref = dict( + application = "applications", + base = "base_classes", + contributed = "contributed_definitions", + ) + + doc = __parse_xml__(self.nxdl_file) + root = doc.getroot() + category = root.get("category") + if category is None: + msg = "missing category attribute in NXDL file: " + self.nxdl_file + raise ValueError(msg) + path = xref.get(category) + if path is None: + msg = "unknown category (%s) in NXDL file: %s" % ( + category, self.nxdl_file + ) + raise ValueError(msg) + return path + + def _xslt_(self, xslt_file): + ''' + convenience routine for XSLT transformations + + For a given XSLT file *abcdefg.xsl*, will produce a file *abcdefg.html*:: + + abcdefg.xsl + xml_data --> abcdefg.html + + ''' + buf = xslt_transformation(xslt_file, self.nxdl_file) + return buf + + +def xslt_transformation(xslt_file, src_xml_file): + ''' + return the transform of an XML file using an XSLT + + :param str xslt_file: name of XSLT file + :param str src_xml_file: name of XML file + ''' + src_doc = __parse_xml__(src_xml_file) + if src_doc is None: + return + + xslt_doc = __parse_xml__(xslt_file) + if xslt_doc is None: + return + + transform = lxml.etree.XSLT(xslt_doc) + result_doc = transform(src_doc) + _r = str(result_doc) + + return _r + + +def __parse_xml__(xml_file_name): + ''' + common handler for lxml.etree.parse to catch certain exceptions + ''' + try: + src_doc = lxml.etree.parse(xml_file_name) + except (IOError, lxml.etree.XMLSyntaxError) as _exc: + msg = 'problem with ' + xml_file_name + ': ' + str(_exc) + # FIXME: logMessage(msg) + return + return src_doc diff --git a/src/punx/reserved_code.txt b/src/punx/reserved_code.txt new file mode 100644 index 0000000000000000000000000000000000000000..d91e9d0fc8abb98e0a50c9f7ace2d4cd7db4ee45 --- /dev/null +++ b/src/punx/reserved_code.txt @@ -0,0 +1,249 @@ +from nxdl_manager.py + + + +# class NXDL_Base(object): +# ''' +# a complete description of a specific NXDL definition +# ''' +# +# parent = None +# +# def __init__(self, parent): +# self.parent = parent +# +# def set_defaults(self, rules): +# ''' +# use the NXDL Schema to set defaults +# +# do not call this from the constructor due to infinite loop +# ''' +# pass +# +# +# class NXDL_element__definition(NXDL_Base): +# ''' +# a complete description of a specific NXDL definition +# ''' +# +# title = None +# category = None +# file_name = None +# nxdl = None +# lxml_tree = None +# nxdl_file_set = None +# +# nxdl_attributes = {} +# nxdl_groups = {} +# nxdl_fields = {} +# nxdl_symbols = {} +# +# __parsed__ = False +# +# def __init__(self, file_set): +# self.nxdl_file_set = file_set +# NXDL_Base.__init__(self, None) +# +# def __getattribute__(self, *args, **kwargs): +# ''' +# implement lazy load of definition content +# ''' +# if len(args) == 1 and args[0] == 'lxml_tree' and not self.__parsed__: +# self.parse() # only parse this file once content is requested +# return object.__getattribute__(self, *args, **kwargs) +# +# def set_defaults(self, rules): +# ''' +# use the NXDL Schema to set defaults +# +# :param obj rules: instance of Schema_Attribute +# +# do not call this from the constructor due to infinite loop +# ''' +# get_element = self.nxdl_file_set.nxdl_element_factory.get_element # alias +# +# for k, v in rules.attrs.items(): +# self.nxdl_attributes[k] = get_element('attribute', parent=self) +# +# _breakpoint = True # TODO: +# +# def set_file(self, fname): +# self.file_name = fname +# self.title = os.path.split(fname)[-1].split('.')[0] +# self.category = os.path.split(os.path.dirname(fname))[-1] +# +# def parse(self): +# ''' +# parse the XML content +# +# This step is deferred until self.lxml_tree is requested +# since only a small subset of the NXDL files are typically +# referenced in a single data file. +# ''' +# if self.__parsed__: +# return # only parse this file when content is requested +# +# if self.file_name is None or not os.path.exists(self.file_name): +# raise __init__.FileNotFound('NXDL file: ' + str(self.file_name)) +# +# self.lxml_tree = lxml.etree.parse(self.file_name) +# self.__parsed__ = True # NOW, the file has been parsed +# +# try: +# validate_xml_tree(self.lxml_tree) +# except __init__.InvalidNxdlFile as exc: +# msg = 'NXDL file is not valid: ' + self.file_name +# msg += '\n' + str(exc) +# +# # parse the XML content of this NXDL definition element +# for node in self.lxml_tree.getroot(): +# if isinstance(node, lxml.etree._Comment): +# continue +# +# element_type = node.tag.split('}')[-1] +# if element_type not in ('doc',): +# obj = self.nxdl_file_set.nxdl_element_factory.get_element(element_type) +# _break = True +# +# +# class NXDL_element__attribute(NXDL_Base): +# ''' +# a complete description of a specific NXDL attribute element +# +# :param obj parent: instance of NXDL_Base +# ''' +# +# def __init__(self, parent): +# NXDL_Base.__init__(self, parent) +# self.name = None +# self.type = 'str' +# self.required = False +# self.default_value = None +# self.enum = [] +# self.patterns = [] +# self.nxdl_attributes = {} +# +# def __str__(self, *args, **kwargs): +# msg = '%s(' % type(self).__name__ +# l = [] +# for k in 'name type required default_value enum patterns'.split(): +# l.append('%s=%s' % (k, str(self.__getattribute__(k)))) +# msg += ', '.join(l) +# msg += ')' +# +# return msg +# +# def set_defaults(self, rules): +# ''' +# use the NXDL Schema to set defaults +# +# :param obj rules: instance of Schema_Attribute +# ''' +# if self.parent is not None: +# get_element = self.parent.nxdl_file_set.nxdl_element_factory.get_element +# elif hasattr(self, 'nxdl_file_set'): +# get_element = self.nxdl_file_set.nxdl_element_factory.get_element # alias +# else: +# raise RuntimeError('cannot locate get_element()') +# +# for k in 'required default_value enum patterns name type'.split(): +# if hasattr(rules, k): +# self.__setattr__(k, rules.__getattribute__(k)) +# # TODO: convert type (such as nx:validItemName into pattern +# # self.parent.nxdl.children['attribute'] +# +# for k, v in rules.attrs.items(): +# self.nxdl_attributes[k] = get_element('attribute', parent=self) +# +# _breakpoint = True # TODO: +# +# +# class NXDL_element__field(NXDL_Base): # TODO: +# ''' +# a complete description of a specific NXDL field +# ''' +# +# optional = True +# +# nxdl_attributes = {} +# +# +# class NXDL_element__group(NXDL_Base): # TODO: +# ''' +# a complete description of a specific NXDL group +# ''' +# +# optional = True +# +# nxdl_attributes = {} +# nxdl_groups = {} +# nxdl_fields = {} +# +# +# class NXDL_element__link(NXDL_Base): # TODO: +# ''' +# a complete description of a specific NXDL link +# ''' +# +# optional = True +# +# +# class NXDL_element__symbols(NXDL_Base): # TODO: +# ''' +# a complete description of a specific NXDL symbol +# ''' +# +# optional = True + + +# class NXDL_ElementFactory(object): +# ''' +# creates and serves new classes with proper default values from the NXDL rules +# +# called by :class:`punx.cache_manager.NXDL_File_Set()` +# ''' +# +# db = {} # internal set of known elements +# file_set = None +# creators = { +# 'definition': NXDL_element__definition, +# 'attribute': NXDL_element__attribute, +# 'field': NXDL_element__field, +# 'group': NXDL_element__group, +# 'link': NXDL_element__link, +# 'symbols': NXDL_element__symbols, +# } +# +# def __init__(self, file_set): +# self.file_set = file_set +# +# def get_element(self, element_name, parent=None): +# ''' +# create a new element or get one already built with defaults from the XML Schema +# ''' +# if element_name not in self.db: +# if element_name == 'definition': +# # special case +# self.db[element_name] = NXDL_element__definition(self.file_set) +# +# elif element_name in self.creators.keys(): +# self.db[element_name] = self.creators[element_name](parent) +# +# else: +# raise KeyError('unhandled NXDL element: ' + element_name) +# +# element = self.db[element_name] +# element.nxdl = self.file_set.schema_manager.nxdl +# +# schema_types = element.nxdl.schema_types # alias +# if element_name not in schema_types: +# msg = 'unexpected element type: ' + element_name +# msg += ', expected one of these: ' + ' '.join(sorted(schema_types.keys())) +# raise KeyError(msg) +# element.set_defaults(schema_types[element_name]) +# +# element = copy.deepcopy(self.db[element_name]) +# +# # TODO set the defaults accordingly for application definitions +# +# return element diff --git a/src/punx/schema_manager.py b/src/punx/schema_manager.py index a486695e1a71c30125e5f7f44115cdc9926c1044..9b0d4449d6598a22d9a393472a83935da1e1e041 100644 --- a/src/punx/schema_manager.py +++ b/src/punx/schema_manager.py @@ -4,16 +4,19 @@ #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2016, Pete R. Jemian +# :copyright: (c) 2016-2017, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # # The full license is in the file LICENSE.txt, distributed with this software. #----------------------------------------------------------------------------- -''' +""" manages the XML Schema of this project +The *schema_manager* calls the *cache_manager* and +is called by *nxdl_manager*. + Public .. autosummary:: @@ -35,75 +38,77 @@ Internal ~_GroupParsing ~_Recursion -''' +""" from __future__ import print_function import lxml.etree import os -import sys +from . import NAMESPACE_DICT, FileNotFound, InvalidNxdlFile +from . import singletons +from . import utils + -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -import punx.singletons +logger = utils.setup_logger(__name__) def strip_ns(ref): - ''' + """ strip the namespace prefix from ``ref`` :param str ref: one word, colon delimited string, such as *nx:groupGroup* :returns str: the part to the right of the last colon - ''' + """ return ref.split(':')[-1] def raise_error(node, text, obj): - ''' + """ standard *ValueError* exception handling :param obj node: instance of :param str text: label for ``obj`` :param str obj: value - ''' + """ msg = 'line ' + str(node.sourceline) msg += ': ' + text + str(obj) raise ValueError(msg) def get_default_schema_manager(): - ''' + """ internal: convenience function - ''' - import punx.cache_manager - cm = punx.cache_manager.CacheManager() + """ + from punx import cache_manager + cm = cache_manager.CacheManager() assert(cm is not None) assert(cm.default_file_set is not None) return cm.default_file_set.schema_manager class SchemaManager(object): - ''' + + """ describes the XML Schema for the NeXus NXDL definitions files - ''' + """ - ns = punx.NAMESPACE_DICT + ns = NAMESPACE_DICT def __init__(self, path=None): - import punx.cache_manager + from punx import cache_manager if path is None: - cm = punx.cache_manager.CacheManager() + cm = cache_manager.CacheManager() if cm is None or cm.default_file_set is None: raise ValueError('Could not get NXDL file set from the cache') path = cm.default_file_set.path schema_file = os.path.join(path, 'nxdl.xsd') if not os.path.exists(schema_file): - raise punx.FileNotFound(schema_file) + raise FileNotFound(schema_file) self.schema_file = schema_file if not os.path.exists(self.schema_file): - raise punx.FileNotFound('XML Schema file: ' + self.schema_file) + raise FileNotFound('XML Schema file: ' + self.schema_file) self.lxml_tree = lxml.etree.parse(self.schema_file) self.lxml_schema = lxml.etree.XMLSchema(self.lxml_tree) @@ -111,7 +116,7 @@ class SchemaManager(object): nodes = self.lxml_root.xpath('xs:element', namespaces=self.ns) if len(nodes) != 1: - raise punx.InvalidNxdlFile(self.schema_file) + raise InvalidNxdlFile(self.schema_file) self.nxdl = Schema_Root( nodes[0], ns_dict=self.ns, @@ -124,9 +129,9 @@ class SchemaManager(object): del self.lxml_tree def parse_nxdl_patterns(self): - ''' + """ get regexp patterns for validItemName, validNXClassName, & validTargetName from nxdl.xsd - ''' + """ db = {} for node in self.lxml_root.xpath('xs:simpleType', namespaces=self.ns): key = node.attrib['name'] @@ -158,21 +163,21 @@ class SchemaManager(object): return db def parse_nxdlTypes(self): - ''' + """ get the allowed data types and unit types from nxdlTypes.xsd - ''' + """ if os.path.exists(self.schema_file): path = os.path.dirname(self.schema_file) else: - import punx.cache_manager - cm = punx.cache_manager.CacheManager() + from punx import cache_manager + cm = cache_manager.CacheManager() if cm is None or cm.default_file_set is None: raise ValueError('Could not get NXDL file set from the cache') path = cm.default_file_set.path self.types_file = os.path.join(path, 'nxdlTypes.xsd') if not os.path.exists(self.types_file): - raise punx.FileNotFound(self.types_file) + raise FileNotFound(self.types_file) lxml_types_tree = lxml.etree.parse(self.types_file) db = {} @@ -188,7 +193,7 @@ class SchemaManager(object): db[obj.name] = obj # re-arrange - units = list(db['anyUnitsAttr'].values) + units = list(db['anyUnitsAttr'].values or []) del db['anyUnitsAttr'] del db['primitiveType'] @@ -196,9 +201,10 @@ class SchemaManager(object): class Schema_pattern(object): - ''' + + """ describe the regular expression patterns ofr names of NeXus things - ''' + """ def __init__(self): self.base = 'token' @@ -208,9 +214,10 @@ class Schema_pattern(object): class Schema_nxdlType(object): - ''' + + """ one of the types defined in the file *nxdlTypes.xsd* - ''' + """ def __init__(self, xml_obj, ns_dict=None, schema_root=None): self.name = xml_obj.attrib.get('name') @@ -242,28 +249,29 @@ class Schema_nxdlType(object): class _Mixin(object): - ''' + + """ common code for NXDL Rules classes below :param lxml.etree.Element xml_obj: XML element :param str obj_name: optional, default taken from ``xml_obj`` - :param dict ns_dict: optional, default taken from :data:`punx.NAMESPACE_DICT` + :param dict ns_dict: optional, default taken from :data:`__init__.NAMESPACE_DICT` :param obj schema_root: optional, instance of lxml.etree._Element - ''' + """ def __init__(self, xml_obj, obj_name=None, ns_dict=None, schema_root=None): self.name = obj_name or xml_obj.attrib.get('name') - self.ns = ns_dict or punx.NAMESPACE_DICT + self.ns = ns_dict or NAMESPACE_DICT self.lxml_root = schema_root def get_named_node(self, tag, attribute, value): - ''' + """ return a named node from the XML Schema :param str tag: XML Schema tag (such as "complexType") to match :param str attribute: attribute name to match :param str value: attribute value to match - ''' + """ if self.lxml_root is None: raise ValueError root = self.lxml_root @@ -278,28 +286,28 @@ class _Mixin(object): return node_list[0] def copy_to(self, target): - ''' + """ copy results into target object :param obj target: instance of _Mixin, such as Schema_Element - ''' + """ for k, v in self.attrs.items(): target.attrs[k] = v for k, v in self.children.items(): target.children[k] = v def parse_attribute(self, node): - ''' ''' + """ """ obj = Schema_Attribute(node, schema_root=self.lxml_root) self.attrs[obj.name] = obj def parse_attributeGroup(self, node): - ''' ''' + """ """ obj = Schema_Type(node.attrib.get('ref'), schema_root=self.lxml_root) obj.copy_to(self) def parse_complexContent(self, node): - ''' ''' + """ """ for subnode in node: if subnode.tag.endswith('}extension'): ref = subnode.attrib.get('base') @@ -323,20 +331,21 @@ class _Mixin(object): raise_error(subnode, 'unexpected tag=', subnode.tag) def parse_group(self, node): - ''' ''' + """ """ obj = Schema_Type(node.attrib.get('ref'), schema_root=self.lxml_root) obj.copy_to(self) class Schema_Root(_Mixin): - ''' + + """ root element of the nxdl.xsd file :param lxml.etree.Element xml_obj: XML element :param str obj_name: optional, default taken from ``xml_obj`` :param dict ns_dict: optional, default taken from :data:`NAMESPACE_DICT` :param obj schema_root: optional, instance of lxml.etree._Element - ''' + """ attrs = {} children = {} @@ -381,9 +390,9 @@ class Schema_Root(_Mixin): self.schema_types.update(self.children) def parse_sequence(self, seq_node): - ''' + """ parse the sequence used in the root element - ''' + """ for node in seq_node: if node.tag.endswith('}element'): obj = Schema_Element(node, schema_root=self.lxml_root) @@ -395,15 +404,17 @@ class Schema_Root(_Mixin): msg = 'unhandled tag in ``definitionType``: ' raise_error(node, msg, node.tag) -class Schema_Attribute(_Mixin): - ''' + +class Schema_Attribute(_Mixin): + + """ xs:attribute element :param lxml.etree.Element xml_obj: XML element :param str obj_name: optional, default taken from ``xml_obj`` :param dict ns_dict: optional, default taken from :data:`NAMESPACE_DICT` :param obj schema_root: optional, instance of lxml.etree._Element - ''' + """ def __init__(self, xml_obj, obj_name=None, ns_dict=None, schema_root=None): assert(xml_obj is not None) @@ -448,12 +459,13 @@ class Schema_Attribute(_Mixin): s += ' = ' s += ' | '.join(self.enum) return s - except: + except Exception: return _Mixin.__str__(self, *args, **kwargs) -class Schema_Element(_Mixin): - ''' +class Schema_Element(_Mixin): + + """ xs:element :param lxml.etree.Element xml_obj: XML element @@ -463,7 +475,7 @@ class Schema_Element(_Mixin): :see: http://download.nexusformat.org/doc/html/nxdl.html :see: http://download.nexusformat.org/doc/html/nxdl_desc.html#nxdl-elements - ''' + """ def __init__(self, xml_obj, obj_name=None, ns_dict=None, schema_root=None): _Mixin.__init__( @@ -501,8 +513,9 @@ class Schema_Element(_Mixin): type_obj.copy_to(self) -class Schema_Type(_Mixin): - ''' +class Schema_Type(_Mixin): + + """ a named NXDL structure type (such as groupGroup) :param str ref: name of NXDL structure type (such as ``groupGroup``) @@ -511,12 +524,12 @@ class Schema_Type(_Mixin): :see: http://download.nexusformat.org/doc/html/nxdl.html :see: http://download.nexusformat.org/doc/html/nxdl_desc.html#nxdl-data-types-internal - ''' + """ def __init__(self, ref, tag = '*', schema_root=None): # _Mixin.__init__(self, xml_obj) # do the _Mixin.__init__ directly here - self.ns = punx.NAMESPACE_DICT + self.ns = NAMESPACE_DICT self.lxml_root = schema_root xml_obj = self.get_named_node(tag, 'name', strip_ns(ref)) @@ -544,7 +557,7 @@ class Schema_Type(_Mixin): raise_error(node, 'unexpected tag=', node.tag) def parse_sequence(self, node): - ''' ''' + """ """ for subnode in node: if subnode.tag.endswith('}element'): obj = Schema_Element(subnode, schema_root=self.lxml_root) @@ -559,25 +572,27 @@ class Schema_Type(_Mixin): raise_error(subnode, 'unexpected tag=', subnode.tag) -class _GroupParsing(punx.singletons.Singleton): - ''' +class _GroupParsing(singletons.Singleton): + + """ internal: avoid a known recursion of group in a group - ''' + """ started = False -class _Recursion(_Mixin): - ''' +class _Recursion(_Mixin): + + """ internal: an element used in recursion, such as child group of group :param str obj_name: optional, default taken from ``xml_obj`` - ''' + """ def __init__(self, obj_name): _Mixin.__init__(self, None, obj_name=obj_name, ns_dict=None) -if __name__ == '__main__': - sm = SchemaManager() - _breakpoint = True +# if __name__ == '__main__': +# sm = SchemaManager() +# _breakpoint = True diff --git a/src/punx/singletons.py b/src/punx/singletons.py index 6f2d4c4d27bf52544626cacfc5564c4d3010a82b..c49ad0a62ff5121af3972da70cb77ed99ac6c173 100644 --- a/src/punx/singletons.py +++ b/src/punx/singletons.py @@ -1,5 +1,5 @@ -''' +""" singletons: Python 2 and 3 Compatible Version :see: http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python @@ -9,14 +9,20 @@ USAGE:: class Logger(Singleton): pass -''' +""" class _Singleton(type): - """ A metaclass that creates a Singleton base class when called. """ + + """A metaclass that creates a Singleton base class when called.""" + _instances = {} def __call__(self, *args, **kwargs): if self not in self._instances: self._instances[self] = super(_Singleton, self).__call__(*args, **kwargs) return self._instances[self] -class Singleton(_Singleton('SingletonMeta', (object,), {})): pass +class Singleton(_Singleton('SingletonMeta', (object,), {})): + + """public interface to Singleton class""" + + pass diff --git a/src/punx/utils.py b/src/punx/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..5abed6b99802805f43cb644ddf03e3ebae27c67c --- /dev/null +++ b/src/punx/utils.py @@ -0,0 +1,166 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017-2018, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +""" +utility routines + +.. autosummary:: + + ~decode_byte_string + ~isHdf5FileObject + ~isHdf5Group + ~isHdf5Dataset + ~isHdf5Link + ~isHdf5ExternalLink + ~isNeXusFile + ~isNeXusGroup + ~isNeXusDataset + ~isNeXusLink + ~setup_logger + +""" + +import h5py +import logging +import os +import numpy +import sys + + +def decode_byte_string(text): + """ + in python3, HDF5 attributes can be byte strings or numpy.ndarray strings + """ + if isinstance(text, (numpy.ndarray)): + if len(text) > 0: + text = text[0] + else: + text = None + if isinstance(text, (bytes, numpy.bytes_)): + text = text.decode(sys.stdout.encoding or "utf8") + return text + +def string_list_to_hdf5(string_list): + """ + converts string lists (incl unicode) to h5py-compatible + """ + return [v.encode("utf8") for v in string_list] + +def isHdf5FileObject(obj): + """is `obj` an HDF5 File?""" + return isinstance(obj, h5py.File) + + +def isHdf5Group(obj): + """is `obj` an HDF5 Group?""" + return isinstance(obj, h5py.Group) and not isHdf5FileObject(obj) + + +def isHdf5Dataset(obj): + """is `obj` an HDF5 Dataset?""" + return isinstance(obj, h5py.Dataset) + + +def isHdf5Link(obj): + """is `obj` an HDF5 Link?""" +# if isHdf5Group(obj.parent) or isHdf5FileObject(obj.parent): +# details = obj.parent.get(obj.name, getlink=True) +# return isinstance(details, h5py.HardLink) + if not hasattr(obj, "parent"): + return False + details = obj.parent.get(obj.name, getlink=True) + return isinstance(details, h5py.HardLink) + + +def isHdf5ExternalLink(parent, obj): + """ + is `parent[objname]` an HDF5 ExternalLink? + + Tricky to detect this one. + If external file is available with valid path, + this will look like the target's data structure + and the result will be False. + + Note: In the external link object, there are + two attributes: ``@filename`` and ``@path``. + """ + # if (isHdf5Group(parent) or isHdf5FileObject(parent)) and hasattr(obj, "file"): + # return parent.file != obj.file + return (isHdf5Group(parent) or isHdf5FileObject(parent)) and hasattr(obj, "filename") and hasattr(obj, "path") + + +def __isHdf5ExternalLink(obj): + """is `obj` an HDF5 ExternalLink?""" + if isHdf5Group(obj.parent) or isHdf5FileObject(obj.parent): + thing = isinstance(obj, h5py.ExternalLink) + details = obj.parent.get(obj.name, getclass=True, getlink=True) + return obj.file != obj.parent.file + # return str(details).find(".ExternalLink") > 0 + return isinstance(obj, h5py.ExternalLink) + + +def isNeXusFile(filename): + """is `filename` is a NeXus HDF5 file?""" + if not os.path.exists(filename): + return None + + f = h5py.File(filename, "r") + if isHdf5FileObject(f): + for item in f: + if isNeXusGroup(f[item], "NXentry"): + f.close() + return True + f.close() + return False + + +def isNeXusGroup(obj, NXtype): + """is `obj` a NeXus group?""" + nxclass = None + if isHdf5Group(obj): + nxclass = obj.attrs.get('NX_class', None) + if isinstance(nxclass, numpy.ndarray): + nxclass = nxclass[0] + nxclass = decode_byte_string(nxclass) + return nxclass == str(NXtype) + + +def isNeXusDataset(obj): + """is `obj` a NeXus dataset?""" + return isHdf5Dataset(obj) + + +def isNeXusLink(obj): + """is `obj` linked to another NeXus item?""" + target = decode_byte_string(obj.attrs.get('target', '')) + return len(target) > 0 and target != obj.name + + +def setup_logger(log_name, level=None): + """ + setups up python logging handler for named entity + + without this setup, logging produces errors such as:: + + No handlers could be found for logger "punx.validate" + + """ + level = level or logging.CRITICAL + logger = logging.getLogger(log_name) + # https://docs.python.org/2/library/logging.html + #ch = logging.StreamHandler() + logger .setLevel(level) + # formatter = logging.Formatter( + # '[%(levelname)s %(asctime)s.%(msecs)03d %(name)s:%(lineno)d] %(message)s') + # ch.setFormatter(formatter) + # logger.addHandler(ch) + # see also: https://docs.python.org/2/howto/logging-cookbook.html + return logger diff --git a/src/punx/validate.py b/src/punx/validate.py index c9f826fd8467ae896c02b9aacaf8d48ca9e84f28..5a4b1a88ad629e3381c003cfca42437208507ee5 100644 --- a/src/punx/validate.py +++ b/src/punx/validate.py @@ -4,1337 +4,486 @@ #----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2016, Pete R. Jemian +# :copyright: (c) 2017-2018, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # # The full license is in the file LICENSE.txt, distributed with this software. #----------------------------------------------------------------------------- -''' -validate NeXus NXDL and HDF5 data files + +""" +validate files against the NeXus/HDF5 standard + +PUBLIC .. autosummary:: - ~validate_xml - ~NxdlPattern - ~CustomNxdlPattern ~Data_File_Validator -.. rubric:: CHECKLIST - -These are considerata for the validation of NeXus HDF5 data files. -Compare these validation steps with rules and documentation -in the NeXus manual and the XML Schema files (``nxdl.xsd`` and ``nxdlTypes.xsd``). -Checkboxes indicate which steps have been implemented in code below. - -* [x] make a list of all address nodes in the file to be evaluated -* [x] attributes are also in this list -* [x] use a structure to hold results for each node - -.. rubric:: File - -#. [x] verify attributes -#. [x] verify file level as group using NX_class = NXroot -#. [ ] identify any objects at root level that are not in NXroot (which is OK) -#. [x] verify default plot identified - - #. [x] version 1 - #. [x] version 2 - #. [x] version 3 - #. [x] version 3+niac2014 - -.. rubric:: Groups - -#. [x] compare name with pattern *validItemName* -#. [x] determine NX_class, if any -#. [x] verify NX_class in nxdl_dict -#. [ ] is name flexible? -#. [ ] What to do with NXDL symbol tables? -#. [x] observe attribute: minOccurs -#. [ ] observe attribute: maxOccurs -#. [ ] check for items defined by NX_class -#. [ ] check for items required by NX_class -#. [ ] check for items not defined by NX_class -#. [x] observe NXDL specification: ignoreExtraGroups -#. [x] observe NXDL specification: ignoreExtraFields -#. [x] observe NXDL specification: ignoreExtraAttributes -#. [x] validate any attributes -#. [x] validate any links -#. [x] validate any fields - -.. rubric:: Links - -#. [x] compare name with pattern *validItemName* -#. [ ] is name flexible? -#. [x] is target attribute defined? -#. [x] is target address absolute? -#. [x] does target address exist? -#. [ ] construct NX classpath from target -#. [ ] compare NX classpath with NXDL specification - -.. rubric:: Fields - -#. [x] compare name with pattern -#. [x] is name flexible? -#. [x] observe attribute: minOccurs -#. [x] is units attribute defined? -#. [x] check units are consistent against NXDL -#. [x] check data shape against NXDL -#. [x] check data type against NXDL -#. [x] check for attributes defined by NXDL -#. [x] check AXISNAME_indices are each within signal data rank +INTERNAL -.. rubric:: Attributes +.. autosummary:: + + ~ValidationItem -#. [x] compare name with pattern -#. [ ] check data type against NXDL -#. [ ] check nxdl.xsd for how to handle these attributes regarding finding.WARN -''' +""" import collections import h5py -import lxml.etree -import numpy +import logging import os -import re -import sys - -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import punx -from punx import finding -from punx import h5structure - -# TODO: issue #14: http://download.nexusformat.org/doc/html/search.html?q=warning&check_keywords=yes&area=default +import pyRestTable -__url__ = 'http://punx.readthedocs.org/en/latest/validate.html' +from . import FileNotFound, HDF5_Open_Error +from . import finding +from . import utils +from . import nxdl_manager -def validate_xml(xml_file_name): - ''' - validate an NXDL XML file against an XML Schema file +SLASH = "/" +INFORMATIVE = int((logging.INFO + logging.DEBUG)/2) +CLASSPATH_OF_NON_NEXUS_CONTENT = "non-NeXus content" +VALIDITEMNAME_STRICT_PATTERN = r'[a-z_][a-z0-9_]*' +logger = utils.setup_logger(__name__) - :param str xml_file_name: name of XML file - ''' - from punx import cache - xml_tree = lxml.etree.parse(xml_file_name) - xsd = cache.get_XML_Schema() - try: - result = xsd.assertValid(xml_tree) - except lxml.etree.DocumentInvalid as exc: - msg = 'DocumentInvalid:\n' - msg += 'file: ' + xml_file_name + '\n' - msg += str(exc) - raise punx.InvalidNxdlFile(msg) - return result - -class NxdlPattern(object): - ''' - common regular expression pattern for validation +class Data_File_Validator(object): - :param obj parent: instance of :class:`Data_File_Validator` - :param str pname: pattern identifying name - :param str xpath_str: XPath search string, expect list of length = 1 - ''' + """ + manage the validation of a NeXus HDF5 data file - def __init__(self, parent, pname, xpath_str): - from punx import cache - self.name = pname - self.xpath_str = xpath_str - rules = cache.get_nxdl_xsd() + USAGE - r = rules.xpath(xpath_str, namespaces=parent.ns) - if r is None or len(r) != 1: - msg = 'could not read *' + pname + '* from *nxdl.xsd*' - raise ValueError(msg) - - self.regexp_pattern_str = r[0].attrib.get('value', None) - self.re_obj = re.compile('^' + self.regexp_pattern_str + '$') + 1. make a validator with a certain schema:: + + validator = punx.validate.Data_File_Validator() # default - def match(self, text): - '''regular expression search''' - return self.re_obj.match(text) - + You may have downloaded additional NeXus Schema (NXDL file sets). + If so, pick any of these by name as follows:: -class CustomNxdlPattern(NxdlPattern): - ''' - custom regular expression pattern for validation - - :param obj parent: instance of :class:`Data_File_Validator` - :param str pname: pattern identifying name - :param str regexp_pattern_str: regular expression to match - ''' - - def __init__(self, parent, pname, regexp_pattern_str): - self.name = pname - self.xpath_str = None + validator = punx.validate.Data_File_Validator("v3.2") + validator = punx.validate.Data_File_Validator("master") + + 2. use to validate a file or files:: + + result = validator.validate(hdf5_file_name) + result = validator.validate(another_file) + + 3. close the HDF5 file when done with validation:: + + validator.close() - self.regexp_pattern_str = regexp_pattern_str - self.re_obj = re.compile('^' + self.regexp_pattern_str + '$') + PUBLIC METHODS - def match(self, text): - '''regular expression search''' - return self.re_obj.match(text) + .. autosummary:: + + ~close + ~validate + ~print_report + INTERNAL METHODS -class Data_File_Validator(object): - ''' - manage the validation of a NeXus HDF5 data file - ''' - - def __init__(self, fname): - from punx import cache - from punx import nxdlstructure - if not os.path.exists(fname): - raise punx.FileNotFound(fname) - self.fname = fname + .. autosummary:: + + ~build_address_catalog + ~_group_address_catalog_ + ~validate_item_name - self.findings = [] # list of Finding() instances - self.addresses = collections.OrderedDict() # dictionary of all HDF5 address nodes in the data file + """ - self.ns = cache.NX_DICT - self.nxdl_rules = nxdlstructure.get_nxdl_rules() - self.get_data_types() - self.nxdl_dict = nxdlstructure.get_NXDL_specifications() + def __init__(self, ref=None): + self.h5 = None + self.__init_local__() + self.manager = nxdl_manager.NXDL_Manager(ref) - try: - self.h5 = h5py.File(fname, 'r') - except IOError: - raise punx.HDF5_Open_Error(fname) - self._init_patterns() - - def _init_patterns(self): - self.patterns = {} - for item in ('validItemName', 'validNXClassName', - 'validTargetName'): - xps = '//*[@name="' # XPath String query - xps += item - xps += '"]/xs:restriction/xs:pattern' - self.patterns[item] = NxdlPattern(self, item, xps) - - # strict match: [a-z_][a-z\d_]* - # flexible match: [A-Za-z_][\w_]* but gets finding.WARN per manual - # advisory changed to finding.NOTE - p = CustomNxdlPattern(self, 'validItemName-strict', r'[a-z_][a-z0-9_]*') - self.patterns[p.name] = p - self.__unique_findings__ = {} - + def __init_local__(self): + self.validations = [] # list of Finding() instances + self.addresses = collections.OrderedDict() # dictionary of all HDF5 address nodes in the data file + self.classpaths = {} + self.regexp_cache = {} def close(self): - if self.h5 is not None: + """ + close the HDF5 file (if it is open) + """ + if utils.isHdf5FileObject(self.h5): self.h5.close() self.h5 = None - def get_data_types(self): - ''' - generate dictionary of acceptable Python data types, based on NeXus data type keys - ''' - # Is there a better way to define these? Using nxdlTypes.xsd? - # TODO: #21 : augment from self.nxdl_rules.nxdlTypes - - self.data_types = { - 'NX_CHAR': [str, numpy.string_, numpy.ndarray], - 'NX_UINT': (numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64), - 'NX_INT': (int, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.int64), - 'NX_FLOAT': (float, numpy.float, numpy.float16, numpy.float32, numpy.float64), - 'NX_BINARY': (None, ), # #FIXME: - 'NX_BOOLEAN': (None, ), # FIXME: - } - if sys.version_info.major == 2: # python2 only - self.data_types['NX_CHAR'].append(unicode) # not in python3 - # definitions dependent on other definitions - # (can add the lists together as needed) - self.data_types['NX_INT'] += self.data_types['NX_UINT'] - self.data_types['NX_POSINT'] = self.data_types['NX_INT'] # need to restrict this - self.data_types['NX_NUMBER'] = self.data_types['NX_INT'] + self.data_types['NX_FLOAT'] - self.data_types['ISO8601'] = self.data_types['NX_CHAR'] - self.data_types['NX_DATE_TIME'] = self.data_types['NX_CHAR'] - - def validate(self): - ''' - start the validation process from the file root - ''' - self.validate_HDF5_group(self.h5) - t = self.validate_default_plot() - f = finding.TF_RESULT[t] - title = "* valid NeXus data file" - msg = 'This file is ' - if not t: - msg += 'not ' - title = "!" + title[1:] - msg += 'valid by the NeXus standard.' - self.new_finding(title, "/", f, msg) - - def validate_HDF5_group(self, group): - ''' - review the HDF5 group: group - - :param obj group: instance of h5py.File of h5py.Group - - Verify that items presented in data file are valid. - ''' - nx_class_name = self.get_hdf5_attribute(group, 'NX_class', report=True) - if nx_class_name is None: - if isinstance(group, h5py.File): - nx_class_name = 'NXroot' - msg = 'file root (assumed): NXroot' - self.new_finding('@NX_class', group.name, finding.OK, msg) - else: - self.validate_item_name(group.name, 'validNXClassName') - msg = 'no @NX_class attribute, not a NeXus group' - self.new_finding('@NX_class', group.name, finding.NOTE, msg) - return # evaluate any further? + def record_finding(self, v_item, key, status, comment): + """ + prepare the finding object and record it + """ + f = finding.Finding(v_item.h5_address, key, status, comment) + self.validations.append(f) + v_item.validations[key] = f + return f + + def finding_score(self): + """ + return a numerical score for the set of findings + + count: number of findings + total: sum of status values for all findings + score: total / count -- average status / finding + """ + total= 0 + count = 0 + for f in self.validations: + if f.status.value != 0: + total += f.status.value + count += 1 + if count == 0: + return total, count, 0 else: - self.validate_item_name(group.name) - - aname = group.name + '@NX_class' - t = nx_class_name in self.nxdl_dict - f = finding.TF_RESULT[t] - msg = {True: 'known: ', False: 'unknown: '}[t] + str(nx_class_name) - self.new_finding('@NX_class', aname, f, msg) - - nx_class_object = self.nxdl_dict.get(nx_class_name) - if nx_class_object is None: - msg = 'ignoring content in group not defined by NeXus' - self.new_finding('not NeXus group', group.name, finding.UNUSED, msg) - return # ignore content in HDF5 groups that are not NeXus classes - - nx_class_defaults = nx_class_object.attributes['defaults'] - - for k in group.attrs.keys(): # review the group's attributes - k = punx.h5structure.decode_byte_string(k) - if k in ('NX_class', ): - pass # handled elsewhere - else: - aname = group.name + '@' + k - if not nx_class_defaults['ignoreExtraAttributes']: - # TODO: don't validate attribute names defined in NXDL rules! - self.validate_item_name(k, parent=group) - if k == 'default' and nx_class_name in ('NXroot', 'NXentry', 'NXsubentry'): - target = self.get_hdf5_attribute(group, 'default') - t = target in group - f = {True: finding.OK, False: finding.ERROR}[t] - msg = {True: 'exists: ', False: 'does not exist: '}[t] + target - self.new_finding('default plot group', aname, f, msg) - - for child_name in group: # review the group's children - try: - child = group[child_name] - except KeyError as _exc: - if True: - filename = self.missing_file_link(str(_exc)) - if filename is not None: - title = 'external file link' - msg = 'missing file: ' + filename - self.new_finding(title, group.name+'/'+child_name, finding.ERROR, msg) - continue - if h5structure.isNeXusLink(child): - if nx_class_defaults['ignoreExtraGroups']: # TODO: Is this proper for links? - title = nx_class_name+'@ignoreExtraGroups' - msg = 'link ignored per NXDL specification' - self.new_finding(title, child.name, finding.UNUSED, msg) - else: - self.validate_NeXus_link(child, group) - elif h5structure.isHdf5Group(child): - if nx_class_defaults['ignoreExtraGroups']: - title = nx_class_name+'@ignoreExtraGroups' - msg = 'subgroup ignored per NXDL specification' - self.new_finding(title, child.name, finding.UNUSED, msg) - else: - self.validate_HDF5_group(child) - elif h5structure.isHdf5Dataset(child): - if nx_class_defaults['ignoreExtraFields']: - title = nx_class_name+'@ignoreExtraFields' - msg = 'field ignored per NXDL specification' - self.new_finding(title, child.name, finding.UNUSED, msg) - else: - self.validate_HDF5_dataset(child, group) - else: - msg = str(_exc) + '\n' + 'unexpected: ' + child.name - raise ValueError(msg) - - self.validate_NXDL_specification(group, nx_class_name) - # FIXME: need special handling for application definitions -# if nx_class_name in ('NXsubentry', 'NXentry') and 'definition' in group: -# # application definition masquerading as NXentry or NXsubentry -# app_def_name = group['definition'][0] -# self.validate_NXDL_specification(group, app_def_name) - - def validate_HDF5_dataset(self, dataset, group): - ''' - review the HDF5 dataset: dataset + return total, count, float(total)/count + + def finding_summary(self, report_statuses=None): + """ + return a summary dictionary of the count of findings by status + + summary statistics + ======= ===== =========================================================== + status count description + ======= ===== =========================================================== + OK 10 meets NeXus specification + NOTE 1 does not meet NeXus specification, but acceptable + WARN 0 does not meet NeXus specification, not generally acceptable + ERROR 0 violates NeXus specification + TODO 3 validation not implemented yet + UNUSED 2 optional NeXus item not used in data file + COMMENT 0 comment from the punx source code + -- -- -- + TOTAL 16 -- + ======= ===== =========================================================== + """ + report_statuses = report_statuses or finding.VALID_STATUS_LIST + summary = collections.OrderedDict() + for status in report_statuses: + summary[status] = 0 + for f in self.validations: + summary[f.status] += 1 + return summary + + def print_report(self): + """ + print a validation report + """ + print("data file: " + self.fname) + print("NeXus definitions ({}): {}, dated {}, sha={}\n".format( + self.manager.nxdl_file_set.ref_type, + self.manager.nxdl_file_set.ref, + self.manager.nxdl_file_set.last_modified, + self.manager.nxdl_file_set.sha, + )) + + def sort_validations(f): + value = f.h5_address + value += " %3d" % -f.status.value # sort from best to worst + value += " " + f.status.description + value = value.replace("@", " @") # keep attributes with group or dataset + return value + + print("findings") + t = pyRestTable.Table() + for label in "address status test comments".split(): + t.addLabel(label) + for f in sorted(self.validations, key=sort_validations): + if f.status == finding.OPTIONAL: + continue # enable if you like verbose reports + row = [] + row.append(f.h5_address) + row.append(f.status) + row.append(f.test_name) + row.append(f.comment) + t.addRow(row) + print(str(t)) + + summary = self.finding_summary() + t = pyRestTable.Table() + for label in "status count description (value)".split(): + t.addLabel(label) + for s, c in summary.items(): + row = [s.key, c, s.description, s.value] + t.addRow(row) + t.addRow(["", "--", "", ""]) + t.addRow(["TOTAL", sum(summary.values()), "", ""]) + print("\nsummary statistics") + print(str(t)) + total, count, average = self.finding_score() + print("<finding>=%f of %d items reviewed" % (average, count)) + + def validate(self, fname): + """start the validation process from the file root""" + from .validations import default_plot - :param obj dataset: instance of h5py.Dataset - :param obj group: instance of h5py.Group or h5py.File, needed to check against NXDL - ''' - self.validate_item_name(dataset.name) - field_rules = self.nxdl_rules.nxdl.children['field'] - nx_class_name = self.get_hdf5_attribute(group, 'NX_class') - nx_class_object = self.nxdl_dict.get(nx_class_name) + if not os.path.exists(fname): + raise FileNotFound(fname) + self.fname = fname - for k in dataset.attrs.keys(): # review the dataset's attributes - k = punx.h5structure.decode_byte_string(k) - aname = dataset.name + '@' + k - self.validate_item_name(k, parent=dataset) - v = self.get_hdf5_attribute(dataset, k, report=True) - if k in field_rules.attrs: - rules = field_rules.attrs[k] - if len(rules.enum) > 0: - t = v in rules.enum - f = {True: finding.OK, False: finding.WARN}[t] - msg = 'value=' + v - if t: - msg += ' :recognized' - else: - msg += ' : expected one of these: ' + '|'.join(rules.enum) - self.new_finding('enumeration: @' + k, aname, f, msg) + if self.h5 is not None: + self.close() # left open from previous call to validate() + try: + self.h5 = h5py.File(fname, 'r') + except IOError: + logger.error("Could not open as HDF5: " + fname) + raise HDF5_Open_Error(fname) + + self.__init_local__() + self.build_address_catalog() + + # 1. check all objects in file (name is valid, ...) + for v_list in self.classpaths.values(): + for v_item in v_list: + self.validate_item_name(v_item) + self.validate_attribute(v_item) + + # 2. check all base classes against defaults + for k, v_item in self.addresses.items(): + if utils.isHdf5Group(v_item.h5_object) \ + or utils.isHdf5FileObject(v_item.h5_object): + self.validate_group(v_item) + + # 3. check application definitions + for k in ("/NXentry/definition", "/NXentry/NXsubentry/definition"): + if k in self.classpaths: + for v_item in self.classpaths[k]: + self.validate_application_definition(v_item.parent) + + # 4. check for default plot + default_plot.verify(self) + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + def build_address_catalog(self): + """ + find all HDF5 addresses and NeXus class paths in the data file + """ + self._group_address_catalog_(None, self.h5) + + def _group_address_catalog_(self, parent, group): + """ + catalog this group's address and all its contents + """ + def addClasspath(v): + if v.classpath not in self.classpaths: + self.classpaths[v.classpath] = [] + self.classpaths[v.classpath].append(v) + logger.log(INFORMATIVE, "NeXus classpath: " + v.classpath) + def get_subject(parent, o): + v = ValidationItem(parent, o) + self.addresses[v.h5_address] = v + logger.log(INFORMATIVE, "HDF5 address: " + v.h5_address) + addClasspath(v) + for k, a in sorted(o.attrs.items()): + av = ValidationItem(v, a, attribute_name=k) + self.addresses[av.h5_address] = av + addClasspath(av) + return v + + obj = get_subject(parent, group) + parent = self.classpaths[obj.classpath][-1] + for item in group: + if utils.isHdf5Group(group[item]): + self._group_address_catalog_(parent, group[item]) else: - if k not in ('target',): # link target attribute checked elsewhere - if nx_class_object is not None: # only check if NXDL exists - if nx_class_object.attributes['defaults']['ignoreExtraAttributes']: - msg = 'attribute ignored per NXDL specification' - self.new_finding(nx_class_name + '@ignoreExtraAttributes', aname, finding.NOTE, msg) - else: - msg = 'attribute not defined in NXDL' - self.new_finding(nx_class_name + '@' + k, aname, finding.NOTE, msg) - - self.validate_numerical_dataset(dataset, group) - - # check the type of this field - # https://github.com/prjemian/punx/blob/b595fdf9910dbab113cfe8febbb37e6c5b48d74f/src/punx/validate.py#L761 - - # review the dataset's content - nx_class_name = self.get_hdf5_attribute(group, 'NX_class') - if nx_class_name in self.nxdl_dict: - nx_class = self.nxdl_dict[nx_class_name] - rules = nx_class.fields.get(dataset.name.split('/')[-1]) - if rules is not None: - if len(rules.enum) > 0: - pass # TODO: - defaults = rules.attributes['defaults'] - nx_type = defaults['type'] # TODO: check for this - minO = defaults['minOccurs'] # TODO: check for this - # in either case, validation of maxOccurs for datasets is not informative - # HDF5 will not allow more than one instance of a name within a group - # maxOccurs: is either 1 or, if name is flexible, unbounded - - isSpecifiedName = defaults['nameType'] == 'specified' - f = finding.OK - msg = 'name is ' + {True: 'specified', False: 'flexible'}[isSpecifiedName] - self.new_finding('@nameType', dataset.name, f, msg) - - def validate_NeXus_link(self, link, group): - ''' - review the NeXus link: link - - :param obj link: instance of h5py.Group or h5py.Dataset - :param obj group: instance of h5py.Group, needed to check against NXDL - ''' - self.validate_item_name(link.name, 'validTargetName') - - target = self.get_hdf5_attribute(link, 'target', report=True) - if target is not None: - aname = link.name + '@target' - target_exists = target in self.h5 - f = finding.TF_RESULT[target_exists] - msg = {True: target, False: 'does not exist'}[target_exists] - self.new_finding('link target exists', aname, f, msg) - else: - self.new_finding('link', link.name, finding.ERROR, 'no target') - - def validate_NXDL_specification(self, group, nx_class_name): - ''' - validate the group with the NXDL specification - - :param obj group: instance of h5py.Group or h5py.File - :param str nx_class_name: name of a NeXus NXDL class - - Verify that items specified in NXDL file are present in the data file. - ''' - nx_class_object = self.nxdl_dict.get(nx_class_name) - if nx_class_object is None: + get_subject(parent, group[item]) + + def validate_item_name(self, v_item, key=None): + from .validations import item_name + item_name.verify(self, v_item, key) + + def validate_attribute(self, v_item): + from .validations import attribute + attribute.verify(self, v_item) + + def validate_group(self, v_item): + """ + validate the NeXus content of a HDF5 data file group + """ + from .validations import hdf5_group_items_in_base_class + from .validations import base_class_items_in_hdf5_group + + key = "NeXus_group" + if v_item.classpath == CLASSPATH_OF_NON_NEXUS_CONTENT: + self.record_finding( + v_item, + key, + finding.OK, + "not a NeXus group") return - msg = 'validate with ' + nx_class_name + ' specification (incomplete)' - self.new_finding('NXDL review', group.name, finding.TODO, msg) - - # specified group attributes are handled elsewhere - # group_defaults = nx_class_object.attributes['defaults'] - - # validate provided, required, and optional fields - for field_name, rules in sorted(nx_class_object.fields.items()): - self.validate_NXDL_field_specification(field_name, group, rules) - - # validate provided, required, and optional groups (recursive as directed) - for subgroup_name, rules in nx_class_object.groups.items(): - self.validate_NXDL_group_specification(subgroup_name, group, rules) - - def validate_NXDL_group_specification(self, subgroup_name, group, rules): - ''' - validate the group/subgroup with the NXDL specification - - :param str subgroup_name: name of subgroup in group - :param obj group: instance of h5py.Group or h5py.File - :param obj rules: instance of nxdlstructure.NX_group - - Verify this HDF5 group conforms to the NXDL specification - ''' - #nx_class_name = self.get_hdf5_attribute(group, 'NX_class') - defaults = rules.attributes['defaults'] - target_exists = subgroup_name in group - - deprecated = defaults['deprecated'] - if deprecated is not None: - if target_exists: - obj = group[subgroup_name] - nm = '/'.join(rules.NX_class, subgroup_name) + '@deprecated' - self.new_finding(nm, obj.name, finding.NOTE, deprecated) - - minO = defaults['minOccurs'] - maxO = defaults['maxOccurs'] - if int(minO) > 0: - if defaults['name'] is None: - matches = [node for node in group.values() if h5structure.isNeXusGroup(node, rules.NX_class)] - if len(matches) < int(minO): - nm = group.name - m = 'must have at least ' + str(minO) + ' group: ' + rules.NX_class - f = finding.WARN - self.new_finding(rules.NX_class+' required group', nm, f, m) - else: - nm = group.name + '/' + subgroup_name - f = {True: finding.OK, False: finding.WARN}[target_exists] - m = rules.NX_class + {True: ' found', False: ' not found'}[target_exists] - self.new_finding(rules.NX_class+' required group', nm, f, m) - if maxO == 'unbounded': - pass - # TODO: what else? - - def validate_NXDL_field_specification(self, field_name, group, rules): - ''' - validate the group/field with the NXDL specification - - :param str field_name: name of field in group - :param obj group: instance of h5py.Group or h5py.File - :param obj rules: instance of nxdlstructure.NX_field - - Verify this HDF5 field conforms to the NXDL specification - ''' - nx_class_name = self.get_hdf5_attribute(group, 'NX_class') - defaults = rules.attributes['defaults'] - nx_type = self.data_types[defaults['type']] - target_exists = field_name in group - if target_exists: - try: - dataset = group[field_name] - except KeyError as _exc: - filename = self.missing_file_link(str(_exc)) - if filename is not None: - title = 'external file link' - msg = 'missing file: ' + filename - self.new_finding(title, group.name+'/'+field_name, finding.ERROR, msg) - return + if v_item.classpath.startswith("/NX"): + nx_class = v_item.nx_class + elif v_item.classpath == "": + nx_class = "NXroot" # handle as NXroot else: - dataset = None - nm = '/'.join((nx_class_name, field_name)) + raise ValueError("unexpected: " + str(v_item)) - # check the attributes specified in NXDL rules - for k, attr in rules.attributes['nxdl.xsd'].items(): - if k in ('minOccurs maxOccurs name nameType type units'.split()): - pass - elif target_exists: - if k == 'deprecated': - m = defaults['deprecated'] - if m is not None: - self.new_finding(nm+'@deprecated', dataset.name, finding.NOTE, m) - elif k in dataset.attrs: - aname = dataset.name + '@' + k - ttl = 'NXDL attribute type: ' - ttl += '/'.join((nx_class_name, field_name)) - ttl += '@' + k - v = self.get_hdf5_attribute(dataset, k) - - # check type against NXDL - attr_type = attr.type.split(':')[-1] # strip off XML namespace prefix, if found - if attr_type not in self.data_types: - if attr_type == 'str': - attr_type = 'NX_CHAR' - else: - msg = 'type(' + aname - msg += ') = "' + attr_type - msg += '" not in known data types' - raise KeyError(msg) - t = type(v) in self.data_types[attr_type] - f = {True: finding.OK, False: finding.WARN}[t] - if isinstance(v, numpy.ndarray) and isinstance(v[0], numpy.bytes_): - m = 'byte-string' - elif isinstance(v, numpy.ndarray): - m = type(v[0]).__name__ - else: - m = type(v).__name__ - m += ' : ' + attr_type - self.new_finding(ttl, aname, f, m) - - # check if value matches enumeration - if len(attr.enum) > 0: - t = v in attr.enum - f = {True: finding.OK, False: finding.WARN}[t] - m = str(v) - if t: - m += ': expected' - else: - m += ': not in list: ' + ','.join(attr.enum) - ttl = 'NXDL attribute enum: ' - ttl += '/'.join((nx_class_name, field_name)) - ttl += '@' + k - self.new_finding(ttl, aname, f, m) - elif attr.required: - if k not in ('name', 'minOccurs', 'maxOccurs',): - nm = 'NXDL attribute: ' + '/'.join((nx_class_name, field_name)) - nm += '@' + k - m = 'required attribute not found' - self.new_finding(nm, dataset.name, finding.WARN, m) - - minO = defaults['minOccurs'] - maxO = defaults['maxOccurs'] - required_name = defaults['nameType'] == 'specified' - if int(minO) > 0 and required_name: - f = {True: finding.OK, False: finding.WARN}[target_exists] - m = {True: '', False: ' not'}[target_exists] + ' found' - nm = group.name + '/' + field_name - self.new_finding(nx_class_name+' required field', nm, f, m) - - t = len(dataset.shape) == len(rules.dims) # check rank against specification - f = {True: finding.OK, False: finding.WARN}[t] # TODO: ? change WARN to NOTE ? - m = {True: 'matches', False: 'does not match'}[target_exists] + ' NXDL specification' - self.new_finding(nx_class_name+' field rank', nm, f, m) - - if target_exists: - if str(dataset.dtype).startswith('|S'): - t = type('numpy string array') in nx_type - m = 'str' - elif str(dataset.dtype).startswith('|O'): - t = type(dataset[0]) in nx_type - m = 'str' - else: - t = dataset.dtype in nx_type - m = str(dataset.dtype) - if 'object' == m: - if dataset.ndim == 0: - m = type(dataset.value).__name__ - else: - m = type(dataset[0]).__name__ - if 'unicode' == m: - m = 'str' - f = {True: finding.OK, False: finding.WARN}[t] - m += {True: ' : ', False: ' not '}[t] + defaults['type'] - nm = group.name + '/' + field_name - ttl = '/'.join((nx_class_name, field_name)) - self.new_finding('NXDL data type: '+ttl, nm, f, m) + # print(str(v_item), v_item.name, v_item.classpath) + self.validate_NX_class_attribute(v_item, nx_class) - # TODO: #16 check if unknown names are allowed to be flexible - - def validate_item_name(self, h5_addr, key=None, parent=None): - ''' - validate *h5_addr* using *validItemName* regular expression - - This is used for the names of groups, fields, links, and attributes. - - :param str h5_addr: full HDF5 address of item, for reference only, - for attributes, use an @ symbol, such as these examples: - - ============================= ============ - *h5_addr* *short_name* - ============================= ============ - ``/entry/user`` ``user`` - ``/entry/data01/data`` ``data`` - ``/entry/data01/data@signal`` ``signal`` - ============================= ============ - - :param str key: named key to search, default: None (``validItemName``) - :param obj parent: HDF5 parent object, default: None - - This method will separate out the last part of the name for validation. - Then, it is tested against the strict or relaxed regular expressions for - a valid item name. The finding for each name is classified by the - next table: - - ===== ======= ======= ================================================================ - order finding match description - ===== ======= ======= ================================================================ - 1 OK strict matches most stringent NeXus specification - 2 NOTE relaxed matches NeXus specification that is most generally accepted - 3 ERROR UTF8 specific to strings with UnicodeDecodeError (see issue #37) - 4 WARN HDF5 acceptable to HDF5 but not NeXus - ===== ======= ======= ================================================================ - - :see: http://download.nexusformat.org/doc/html/datarules.html?highlight=regular%20expression - ''' - full_name = h5_addr - if key is None: - key_relaxed = 'validItemName' - key_strict = 'validItemName-strict' - - short_name = h5_addr.split('/')[-1] - if parent is not None: - full_name = parent.name + '@' + h5_addr - - if short_name == 'NX_class': - # special case - self.new_finding('NeXus internal attribute', - full_name, - finding.OK, - 'marks this HDF5 group as NeXus group') - return - - # strict match: [a-z_][a-z\d_]* - # flexible match: [A-Za-z_][\w_]* but gets finding.WARN per manual - - p = self.patterns[key_strict] - m = p.match(short_name) - if m is not None and m.string == short_name: - f = finding.OK - key = key_strict - msg = 'strict re: ' + p.regexp_pattern_str - else: - p = self.patterns[key_relaxed] - m = p.match(short_name) - if m is not None and m.string == short_name: - f = finding.NOTE - key = key_relaxed - msg = 'relaxed re: ' + p.regexp_pattern_str - else: - # test if string rendering raises UnicodeDecodeError - key = 'validItemName' - if parent is None: - msg = 'valid HDF5 item name, not valid with NeXus' - else: - msg = 'valid HDF5 attribute name, not valid with NeXus' - try: # to raise the exception - _test = '%s' % str(m) - f = finding.WARN - except UnicodeDecodeError as _exc: - f = finding.ERROR - msg += ', UnicodeDecodeError' + base_class = self.manager.classes.get(nx_class) + if base_class is None: + c = "unknown NeXus base class: " + nx_class + self.record_finding(v_item, "NeXus base class", finding.ERROR, c) else: - # TODO: validate full_name against other keys - # validNXClassName - # validTargetName - f = finding.TODO - msg = 'TODO: validate full_name against ' + key - pass - - self.new_finding(key, full_name, f, msg) + hdf5_group_items_in_base_class.verify(self, v_item, base_class) + base_class_items_in_hdf5_group.verify(self, v_item, base_class) - def validate_default_plot(self): - ''' - check that data file defines the default plottable data - - :see: http://download.nexusformat.org/doc/html/datarules.html#find-the-plottable-data - ''' - classpath_dict = collections.OrderedDict() - for results in self.addresses.values(): - cp = results.classpath - if cp not in classpath_dict: - classpath_dict[cp] = [] - classpath_dict[cp].append(results.h5_address) - candidates = self.identify_default_plot_candidates() - - if self.default_plot_addr_v3(candidates['v3'], classpath_dict) is not None: - return True - elif self.default_plot_addr_v2(candidates['v2']) is not None: - return True - elif self.default_plot_addr_v1(candidates['v1']) is not None: - return True - elif self.no_NXdata_children_of_NXentry(candidates['niac2016']): - return True - - k = '/NXentry/NXdata/field' - if k in classpath_dict and len(classpath_dict[k]) == 1: - m = 'only one /NXentry/NXdata/field exists but no signal indicated' - else: - m = '/NXentry/NXdata/field exists but no signal indicated' - f = finding.WARN - self.new_finding('NeXus default plot', k, f, m) - - f = finding.TF_RESULT['/NXentry/NXdata/field' in classpath_dict] - return f != finding.ERROR + # TODO: validate attributes - both HDF5-supplied & NXDL-specified + # TODO: validate symbols - both HDF5-supplied & NXDL-specified + # TODO: validate fields - both HDF5-supplied & NXDL-specified + # TODO: validate links - both HDF5-supplied & NXDL-specified + c = nx_class + ": more validations needed" + self.record_finding(v_item, "NeXus base class", finding.TODO, c) + + def validate_application_definition(self, v_item): + """ + validate group as a NeXus application definition + """ + from .validations import application_definition + application_definition.verify(self, v_item) - def identify_default_plot_candidates(self): - ''' - find the HDF5 addresses that might provide the default plottable data - - :see: http://download.nexusformat.org/doc/html/datarules.html#find-the-plottable-data - :see: http://download.nexusformat.org/doc/html/preface.html?highlight=class%20path#class-path-specification - - There are different methods to identify the default data to be plotted. - These can be distinguished by differences in the NeXus class path - (the sequence of NeXus classes and other elements that describe an object in - a NeXus HDF5 data file). As used here, the text ``field`` is used - instead of the name of the field (as shown in the NeXus manual) but the name of the - attribute is given. - - =========== ======================================= - version NeXus classpath signature - =========== ======================================= - niac2016 /NXentry (no NXdata group) - v3 /NXentry/NXdata@signal - v3+niac2014 /@default/NXentry@default/NXdata@signal - v2 /NXentry/NXdata/field@signal - v1 /NXentry/NXdata/field@signal - =========== ======================================= - - Versions *v1* and *v2* differ in their use of other attributes - such as *axes* (v2) versus *axis* (v1) and *primary* (v1). - with other attributes such as */NXentry/NXdata/field2@primary*. - Since these other attributes are not always present, or - might be used to indicate alternatives, a test for *v1* - can fail due to both false negatives and false positives. - ''' - # prepare dictionaries of candidates for the default plot - candidates = dict(v1 = {}, v2 = {}, v3 = {}, niac2016 = {}) - for node_name in self.h5: - node = self.h5[node_name] - if h5structure.isNeXusGroup(node, 'NXentry'): - candidates['niac2016'][node.name] = '/NXentry' - for subnode_name in node: - subnode = node[subnode_name] - if h5structure.isNeXusGroup(subnode, 'NXdata'): - if node.name in candidates['niac2016']: - # reject this node from niac2016 since it has NXdata group - del candidates['niac2016'][node.name] - - signal = self.get_hdf5_attribute(subnode, 'signal') - if isinstance(signal, (bytes, numpy.bytes_)): - signal = signal.decode() - if signal is not None: - k = subnode.name + '@signal' - candidates['v3'][k] = '/NXentry/NXdata@signal' - for ss_node_name in subnode: - try: - ss_node = subnode[ss_node_name] - except KeyError: - continue - if not h5structure.isNeXusDataset(ss_node): - continue - if self.get_hdf5_attribute(ss_node, 'signal') is not None: - k = ss_node.name + '@signal' - # TODO: verify the value is a number (either as float, int, or str of some sort) - candidates['v2'][k] = '/NXentry/NXdata/field@signal' - candidates['v1'][k] = '/NXentry/NXdata/field@signal' - return candidates - - def default_plot_addr_v1(self, group_dict): - ''' - return the HDF5 address of the v1 default plottable data or None - - :see: http://download.nexusformat.org/doc/html/datarules.html#version-1 - ''' - default_plot_addr = [] - for primary_field_addr, nx_classpath in group_dict.items(): - title = 'NXdata group default plot v1' - # need the NXdata group of this field - primary = self.h5[primary_field_addr.split('@')[0]] - nxdata_addr = '/'.join(primary.name.split('/')[:-1]) - nxdata = self.h5[nxdata_addr] - signal_field_list = [] - for field_name in nxdata: - field = nxdata[field_name] - if h5structure.isNeXusDataset(field): - signal = self.get_hdf5_attribute(field, 'signal', report=True) - if signal is None: - continue - elif signal in (1, '1'): - signal_field_list.append(field) - else: - m = 'expected @signal=1, found: ' + signal - addr = field.name + '@signal' - self.new_finding(title, addr, finding.ERROR, m) - continue - # TODO: @axis, @primary, and dimension scales - # TODO: signal and dimension scales data shape - - if len(signal_field_list) == 1: - m = 'NXdata group default plot using v1' - self.new_finding(title, signal_field_list[0], finding.OK, m) - default_plot_addr.append(signal_field_list[0]) - elif len(signal_field_list) == 0: - m = 'NXdata group does not define a default plot using v1' - self.new_finding(title, nxdata_addr, finding.WARN, m) - else: - m = 'NXdata group defines more than one default plot using v1' - self.new_finding(title, nxdata_addr, finding.NOTE, m) - - cp = '/NXentry/NXdata/field@signal' - title = 'NeXus default plot v1' - if len(default_plot_addr) == 1: - m = 'NeXus data file default plot defined' - self.new_finding(title, default_plot_addr[0], finding.OK, m) - return default_plot_addr[0] - elif len(default_plot_addr) == 0: - m = 'NeXus data file does not define a default plot using v1' - #self.new_finding(title, cp, finding.WARN, m) - else: - m = 'NeXus data file defines more than one default plot using v1' - self.new_finding(title, cp, finding.WARN, m) - return default_plot_addr + def validate_NX_class_attribute(self, v_item, nx_class): + from .validations import nx_class_attribute + nx_class_attribute.validate_NX_class_attribute( + self, v_item, nx_class) + + def usedAsBaseClass(self, nx_class): + """ + returns bool: is the nx_class a base class? + + NXDL specifications in the contributed definitions directory + could be intended as either a base class or an + application definition. NeXus provides no easy identifier + for this difference. The most obvious distinction between + them is the presence of the `definition` field + in the `NXentry` group of an application definition. + This field is not present in base classes. + """ + nxdl_def = self.manager.classes.get(nx_class, None) + if nxdl_def is None: + return False + if nxdl_def.category == "applications": + return False + if nxdl_def.category == "base_classes": + return True + # now, need to work at it a bit + # *Should* only be one NXentry group but that is not a rule. + if len(nxdl_def.fields) == 0 and \ + len(nxdl_def.links) == 0 and \ + len(nxdl_def.groups) == 1: # maybe ... + entry_group = nxdl_def.groups.values()[0] + # TODO: test entry_group.NX_class == "NXentry" but that attribute is not ready yet! + # assume OK + return "definition" not in entry_group.fields + return True + + +class ValidationItem(object): - def default_plot_addr_v2(self, group_dict): - ''' - return the HDF5 address of the v2 default plottable data or None - - :see: http://download.nexusformat.org/doc/html/datarules.html#version-2 - ''' - default_plot_addr = [] - for h5_addr, nx_classpath in group_dict.items(): - title = 'NeXus default plot v2' - try: - field = self.h5[h5_addr.split('@')[0]] - except KeyError: - continue - signal = self.get_hdf5_attribute(field, 'signal', report=True) - if signal in (1, '1'): - m = nx_classpath + ' = 1' - self.new_finding(title, field.name, finding.OK, m) - default_plot_addr.append(field.name) - else: - m = 'expected @signal=1, found: ' + signal - self.new_finding(title, h5_addr, finding.ERROR, m) - # TODO: @axes and dimension scales (see issue #41) - # TODO: signal and dimension scales data shape - - cp = '/NXentry/NXdata/field@signal' - title = 'NeXus default plot v2' - if len(default_plot_addr) == 1: - m = 'NeXus data file default plot defined using v2' - self.new_finding(title, default_plot_addr[0], finding.OK, m) - return default_plot_addr[0] - elif len(default_plot_addr) == 0: - m = 'NeXus data file does not define a default plot using v2' - #self.new_finding(title, cp, finding.WARN, m) - else: - m = 'NeXus data file defines more than one default plot using v2' - self.new_finding(title, cp, finding.NOTE, m) - return default_plot_addr + """HDF5 data file object for validation""" - def default_plot_addr_v3(self, group_dict, classpath_dict): - ''' - return the HDF5 address of the v3 default plottable data or None - - :see: http://download.nexusformat.org/doc/html/datarules.html#version-3 - ''' - # TODO: this change will be disruptive, better in a branch -# if '/NXentry/NXdata/field@signal' in classpath_dict: -# pass -# elif '/NXentry/NXdata/field' in classpath_dict: -# field_list = classpath_dict['/NXentry/NXdata/field'] -# for entry in classpath_dict['/NXentry']: -# count = len([i for i in field_list if i.startswith(entry)]) -# pass - - default_plot_addr = [] - for h5_addr, nx_classpath in group_dict.items(): - dimension_scales = [] - dimension_scales_ok = True # assume until proven otherwise - title = 'NXdata group default plot v3' - nxdata = self.h5[h5_addr.split('@')[0]] - signal_name = self.get_hdf5_attribute(nxdata, 'signal', report=True) - if signal_name not in nxdata: - m = nx_classpath + ' field not found: ' + signal_name - self.new_finding(title, nxdata.name + '@signal', finding.ERROR, m) - continue + def __init__(self, parent, obj, attribute_name=None): + assert(isinstance(parent, (ValidationItem, type(None)))) + self.parent = parent + self.validations = {} # validation findings go here + self.h5_object = obj + if hasattr(obj, 'name'): + self.h5_address = obj.name + if obj.name == SLASH: + self.name = SLASH else: - signal_data = nxdata[signal_name] - m = 'NXdata@signal = ' + signal_name - addr = nxdata.name - self.new_finding(title, addr+'@signal', finding.OK, m) - - axes_names = self.get_hdf5_attribute(nxdata, 'axes', report=True) - if axes_names is None: # no axes attribute: use array indices as dimension scales - for dim in signal_data.shape: - dimension_scales.append(numpy.ndarray(dim)) - else: - if isinstance(axes_names, str): - for delim in (':', ' '): - # replace alternate delimiters (":", " ") with "," - axes_names = axes_names.replace(delim, ',') - axes_names = axes_names.split(',') - for axis_name in axes_names: - ttl = 'NXdata@axes' - if axis_name == '.': - pass - elif axis_name in nxdata: # does axis exist? - m = 'axes dataset found: ' + axis_name - f = finding.OK - self.new_finding(ttl+'='+axis_name, addr+'@axes', f, m) - # check @AXISNAME_indices holds index of dimension scale data to use - # dimension scale = index 'indices' of nxdata[axis_name] - axis_data = nxdata[axis_name] - indices = self.get_hdf5_attribute(nxdata, axis_name+'_indices') - if indices is None: - if len(axis_data.shape) == 1: - m = 'not provided, assume = 0' - self.new_finding('NXdata@'+axis_name+'_indices', - nxdata.name+'@'+axis_name+'_indices', - finding.NOTE, - m) - else: - m = 'not provided, uncertain how to use' - self.new_finding('NXdata@'+axis_name+'_indices', - nxdata.name+'@'+axis_name+'_indices', - finding.WARN, - m) - dimension_scales_ok = False - else: - if not isinstance(indices, (tuple, numpy.ndarray)): - indices = [indices,] - indices = numpy.array([int(v) for v in indices], dtype=int) - t = numpy.all(indices < len(signal_data.shape)) - if len(indices) == 1: - indices = indices[0] - f = finding.TF_RESULT[t] - m = 'value = ' + str(indices) - m += {True:': ok', False:': invalid'}[t] - self.new_finding('NXdata@'+axis_name+'_indices', - nxdata.name+'@'+axis_name+'_indices', - f, - m) - if not t: - dimension_scales_ok = False - - if len(axis_data.shape) == 1: - dimension_scales.append(axis_data) - elif len(axis_data.shape) == 2: - if not isinstance(indices, numpy.ndarray): - dimension_scales.append(axis_data[indices]) - else: - for indx in indices: - dimension_scales.append(axis_data[indx]) - else: - m = axis_data.name + '@axes, axis=' + axis_name - m += ' has rank=' + str(len(axis_data.shape)) - m += '\n This needs special handling. Send email to the developer.' - raise ValueError(m) - else: - m = 'axes dataset not found: ' + axis_name - f = finding.WARN - self.new_finding(ttl+'='+axis_name, addr+'@axes', f, m) - dimension_scales_ok = False - - if len(dimension_scales) == len(signal_data.shape): - if len(dimension_scales) == 1: - length_ok = dimension_scales[0].shape[0] - signal_data.shape[0] in (0, 1) - # 0 : dimension scale values are bin centers - # 1 : dimension scale values are bin edges - if not length_ok: - ttl = 'dimension scale for NXdata@signal' - m = 'array lengths are not the same' - self.new_finding(ttl, signal_data.name, finding.WARN, m) - dimension_scales_ok = False - else: - for i, dscale in enumerate(dimension_scales): - length_ok = dscale.shape[0] - signal_data.shape[i] in (0, 1) - if not length_ok: - ttl = 'dimension scale for NXdata@signal[' + str(i) + ']' - m = 'array lengths are not the same' - self.new_finding(ttl, signal_data.name, finding.WARN, m) - dimension_scales_ok = False - else: - m = 'rank(' + signal_name + ') != number of dimension scales' - self.new_finding('NXdata@signal rank', signal_data.name, finding.WARN, m) - default_plot_addr.append(addr) - if dimension_scales_ok: - m = 'dimension scale(s) verified' - self.new_finding('NXdata dimension scale(s)', nxdata.name, finding.OK, m) - - title = 'NeXus default plot v3' - # TODO: report default plot in each NXdata group - # TODO: report if file has one clearly designated default plot - # TODO: report if file has one default plot - if len(default_plot_addr) == 1: - m = 'NeXus data file default plot: /NXentry/NXdata@signal' - cp = nx_classpath + '=' - cp += self.get_hdf5_attribute(self.h5[default_plot_addr[0]], 'signal') - self.new_finding(cp, default_plot_addr[0], finding.OK, title) - return default_plot_addr[0] - elif len(default_plot_addr) == 0: - m = 'NeXus data file does not define a default plot using v3' - # self.new_finding(title, cp, finding.WARN, m) + self.name = obj.name.split(SLASH)[-1] + self.classpath = self.determine_NeXus_classpath() else: - # use NIAC2014 terms to find unique address - unique_list = self.default_plot_addr_v3_niac2014(default_plot_addr) - m = title + '+niac2014' - if len(unique_list) == 1: - self.new_finding(nx_classpath, unique_list[0], finding.OK, m) - return unique_list[0] + self.name = attribute_name + if parent.classpath == CLASSPATH_OF_NON_NEXUS_CONTENT: + self.h5_address = None + self.classpath = CLASSPATH_OF_NON_NEXUS_CONTENT else: - for _addr in default_plot_addr: - cp = nx_classpath + '=' - cp += self.get_hdf5_attribute(self.h5[_addr], 'signal') - self.new_finding(cp, _addr, finding.NOTE, title) - return default_plot_addr + self.h5_address = "%s@%s" % (parent.h5_address, self.name) + self.classpath = str(parent.classpath) + "@" + str(self.name) + self.object_type = self.identify_object_type() - def default_plot_addr_v3_niac2014(self, address_list): - ''' - return a list of default plottable data as directed by @default attributes - - :param [str] address_list: list of absolute HDF5 addresses with v3 default plottable data - - Each address fits this NeXus class path: /NXentry/NXdata/field - ''' - unique_list = [] - for k in address_list: - nxentry_name = k.split('/')[1] - root_default = self.get_hdf5_attribute(self.h5, 'default', nxentry_name) - if root_default == nxentry_name: - nxentry = self.h5[nxentry_name] - nxdata_name = k.split('/')[2] - nxentry_default = self.get_hdf5_attribute(nxentry, 'default', nxdata_name) - if nxentry_default == nxdata_name: - unique_list.append(k) - return unique_list + def __str__(self, *args, **kwargs): + try: + terms = collections.OrderedDict() + terms["name"] = self.name + terms["type"] = self.object_type + terms["classpath"] = self.classpath + s = ", ".join(["%s=%s" % (k, str(v)) for k, v in terms.items()]) + return "ValidationItem(" + s + ")" + except Exception: + return object.__str__(self, *args, **kwargs) - def no_NXdata_children_of_NXentry(self, group_dict): - ''' - As of NIAC2016, it is not required that there be any NXdata as a child of NXentry - ''' - title = 'NXdata optional per NIAC2016' - cp = '/NXentry' - m = 'NeXus allows NXentry without NXdata subgroup' - if len(group_dict) == 1: - for h5_addr, nx_classpath in group_dict.items(): - t = h5_addr in self.h5 - f = finding.TF_RESULT[t] - self.new_finding(title, cp, finding.NOTE, m) - return t - - return False - - def validate_numerical_dataset(self, dataset, group): - ''' - review the units attribute of an HDF5 dataset - - :param obj dataset: instance of h5py.Dataset - :param obj group: instance of h5py.Group or h5py.File, needed to check against NXDL - ''' - if dataset.dtype not in self.data_types['NX_NUMBER']: - return - - # check the units of numerical fields - title = 'field@units' - units = self.get_hdf5_attribute(dataset, 'units', report=True) - t = units is not None - f = {True: finding.OK, False: finding.NOTE}[t] - msg = {True: 'exists', False: 'does not exist'}[t] - if t: - t = len(units) > 0 - f = {True: finding.OK, False: finding.NOTE}[t] - msg = {True: 'value: ' + units, False: 'has no value'}[t] - self.new_finding(title, dataset.name + '@units', f, msg) - # TODO: compare value of dataset@units with NXDL@units specification - # this could easily require a deep analysis - - # TODO: issue #13: check field dimensions against "rank" : len(shape) == len(NXDL/dims) - shape = dataset.shape - if shape != (1,): # ignore scalars - __ = None # used as a NOP breakpoint after previous definition + def identify_object_type(self, *args, **kwargs): + import h5py._hl + if isinstance(self.h5_object, h5py._hl.files.File): + object_type = "HDF5 file root" + elif isinstance(self.h5_object, h5py._hl.group.Group): + object_type = "HDF5 group" + elif isinstance(self.h5_object, h5py._hl.dataset.Dataset): + object_type = "HDF5 dataset" + else: + object_type = type(self.h5_object) + if object_type in ("HDF5 file root", "HDF5 group", "HDF5 dataset"): + if utils.isNeXusLink(self.h5_object): + object_type = "NeXus link" + return object_type - def get_hdf5_attribute(self, obj, attribute, default=None, report=False): - ''' - HDF5 attribute strings might be coded in several ways + def determine_NeXus_classpath(self): + """ + determine the NeXus class path - :param obj obj: instance of h5py.File, h5py.Group, or h5py.Dataset - :param str attribute: name of requested attribute - :param obj default: value if attribute not found (usually str) - :param bool report: check & report if value is an ndarray of variable length string - ''' - a = obj.attrs.get(attribute, default) - if isinstance(a, numpy.ndarray): - if len(a) > 0: - if isinstance(a[0], (bytes, numpy.bytes_)): - a = [str(v.decode()) for v in a] - if report: - gname = obj.name + '@' + attribute - msg = 'variable length string' - if len(a) > 1: - msg += ' array' - msg += ': ' + str(a) - self.new_finding('attribute data type', gname, finding.NOTE, msg) - if len(a) == 1: - a = a[0] - elif isinstance(a, (int, numpy.int16, numpy.int32, numpy.int64)): - a = str(a) - if sys.version_info.major == 3: - if isinstance(a, bytes): - a = str(a.decode()) - return a - - def reconstruct_classpath(self, h5_address, *args, **kwargs): - ''' - build the classpath from the h5_address - ''' - path = h5_address.lstrip('/').split('@')[0] - if len(path) == 0: - return - - # reconstruct the NeXus classpath - cp = '' # classpath to be built - hp = '' # HDF5 address to be built - for item in path.split('/'): - hp += '/' + item - if hp in self.h5: - try: - item = self.h5[hp] - except KeyError as _exc: - cp += '/missing_external_file_link' - continue - if h5structure.isHdf5Dataset(item): - cp += '/field' - else: - obj = self.h5[hp] - nx_class = self.get_hdf5_attribute(obj, 'NX_class', '-') - cp += '/' + str(nx_class) - if '@' in h5_address: - cp += '@' + h5_address.split('@')[-1] - - return cp - - def new_finding(self, test_name, h5_address, status, comment): - ''' - accumulate a list of findings + :see: http://download.nexusformat.org/sphinx/preface.html#class-path-specification - :param str test_name: brief name of this test - :param str h5_address: HDF5 address - :param obj status: instance of finding.ValidationResultStatus, - should be the same text as other instances of this test - :param str comment: free-form explanation - ''' - - addr = str(h5_address) - unique_key = addr + ':' + test_name - if unique_key in self.__unique_findings__: - # ensure that each test is only recorded once - return - f = finding.Finding(test_name, addr, status, comment) - self.findings.append(f) - self.__unique_findings__[unique_key] = f - if addr not in self.addresses: - # accumulate a dictionary of HDF5 object addresses - self.addresses[addr] = finding.CheckupResults(addr) - self.addresses[addr].classpath = self.reconstruct_classpath(addr) - self.addresses[addr].findings.append(f) - - def report_findings(self, statuses=()): - ''' - make a table of the validation findings + EXAMPLE - :param statuses: List (or tuple) of finding statuses to be shown. - Use the `finding.VALID_STATUS_LIST` (as shown below) - or create your own list: - - :data:`finding.VALID_STATUS_LIST` ``(OK, NOTE, WARN, ERROR, TODO, UNUSED, COMMENT)`` + Given this NeXus data file structure:: - See :mod:`finding` for details. - - :returns str: table of results or `None` if no results match. - ''' - import pyRestTable - - t = pyRestTable.Table() - t.labels = 'address validation status comment(s)'.split() - if isinstance(statuses, finding.ValidationResultStatus): - statuses = [statuses,] - for f in sorted(self.findings, key=self.findings_comparator): - if f.status in statuses: - t.rows.append((f.h5_address, f.test_name, f.status, f.comment)) - if len(t.rows) == 0: - return 'None' - return t.reST() - - def findings_comparator(self, finding): - ''' - custom sorting key for all HDF5 addresses - ''' - if finding.h5_address.find('@') >= 0: - address, attribute = finding.h5_address.split('@') + / + entry: NXentry + data: NXdata + @signal = data + data: NX_NUMBER + + For the "signal" attribute of this HDF5 address: ``/entry/data``, + its NeXus class path is: ``/NXentry/NXdata@signal`` + + The ``@signal`` attribute has the value of ``data`` which means + that the local field named ``data`` is the plottable data. + + The HDF5 address of the plottable data is: ``/entry/data/data``, + its NeXus class path is: ``/NXentry/NXdata/data`` + """ + if self.name == SLASH: + return "" else: - address = finding.h5_address - attribute = None - try: - if attribute is not None: - k = '!_4_' - elif isinstance(self.h5[address], h5py.Dataset): - k = '!_3_' - elif isinstance(self.h5[address], h5py.Group): - k = '!_1_' - elif isinstance(self.h5[address], h5py.File): - k = '!_0_' - else: - k = '!_5_' - except KeyError as exc: - k = '!_6_' - key = address + k - if attribute is not None: - key += '@' + attribute - key += '!__status_' + finding.status.key - key += '!__title_' + finding.test_name - return key - - def report_findings_summary(self): - ''' - make a summary table of the validation findings (count how many of each status) - ''' - import pyRestTable - - # count each category - summary = collections.OrderedDict() - for k in finding.VALID_STATUS_LIST: - summary[str(k.key)] = 0 - xref = {str(k): k for k in finding.VALID_STATUS_LIST} - for f in self.findings: - summary[str(f.status)] += 1 - - t = pyRestTable.Table() - t.labels = 'status count description'.split() - for k, v in summary.items(): - t.rows.append((k, v, xref[k].description)) - t.rows.append(('--', '--', '--')) - t.rows.append(('TOTAL', len(self.findings), '--')) - return t.reST() - - def report_classpath(self): - ''' - make a table of the known NeXus class paths - ''' - import pyRestTable - t = pyRestTable.Table() - t.labels = 'HDF5-address NeXus-classpath'.split() - for k, v in self.addresses.items(): - t.rows.append((k, v.classpath)) - return t.reST() - - def missing_file_link(self, text): - ''' - Return file name if error message from KeyError due to missing external file link, else None - - Such as:: - - Unable to open object (Unable to open file: name = 'data\\../nt15698-1/processing/waxs_mask.nxs', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0) - - Returns:: - - data\\../nt15698-1/processing/waxs_mask.nxs - - ''' - filename = None - m1 = 'Unable to open object (Unable to open file: name = ' - p1 = text.find(m1) - if p1 >= 0: - p2 = text.find(', errno =') - filename = text[p1 + len(m1) : p2].strip("'") - return filename - -if __name__ == '__main__': - print("Start this module using: python main.py validate ...") - exit(0) + h5_obj = self.h5_object + + classpath = str(self.parent.classpath) + if classpath == CLASSPATH_OF_NON_NEXUS_CONTENT: + logger.log(INFORMATIVE, "%s is not NeXus content", h5_obj.name) + return CLASSPATH_OF_NON_NEXUS_CONTENT + + if not classpath.endswith(SLASH): + if utils.isHdf5Group(h5_obj): + if "NX_class" in h5_obj.attrs: + nx_class = utils.decode_byte_string(h5_obj.attrs["NX_class"]) + if nx_class.startswith("NX"): + self.nx_class = nx_class # only for groups + logger.log(INFORMATIVE, "NeXus base class: " + nx_class) + else: + logger.log(INFORMATIVE, "HDF5 group is not NeXus: " + self.h5_address) + return CLASSPATH_OF_NON_NEXUS_CONTENT + else: + logger.log(INFORMATIVE, "HDF5 group is not NeXus: " + self.h5_address) + return CLASSPATH_OF_NON_NEXUS_CONTENT + else: + nx_class = self.name + classpath += SLASH + nx_class + return classpath diff --git a/src/punx/validations/__init__.py b/src/punx/validations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/punx/validations/application_definition.py b/src/punx/validations/application_definition.py new file mode 100644 index 0000000000000000000000000000000000000000..0ebd959117efcac1c8f93de0ffc7cd475770c086 --- /dev/null +++ b/src/punx/validations/application_definition.py @@ -0,0 +1,76 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017-2018, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .. import finding +from .. import utils +from ..validate import ValidationItem + + +def verify(validator, v_item): + """ + Verify items specified in application definition are present in HDF5 data file + """ + ad_name = utils.decode_byte_string(v_item.h5_object["definition"].value) + key = "NeXus application definition" + + ad = validator.manager.classes.get(ad_name) + status = finding.TF_RESULT[ad is not None] + msg = ad_name + ": recognized NXDL specification" + validator.record_finding(v_item, "known NXDL", status, msg) + if ad is None: + return + + msg = ad_name + if ad.category == "applications": + msg += ": known NeXus application definition" + elif ad.category == "contributed": + msg += ": known NeXus contributed definition used as application definition" + else: + status = finding.ERROR + msg += ": unknown application definition" + validator.record_finding(v_item, key, status, msg) + + c = ad_name + ": more validations needed" + validator.record_finding(v_item, key, finding.TODO, c) + + # TODO: groups, attributes, links, type, ... in separate functions + ad_entry = list(ad.groups.values())[0] # only 1 at this level of the application definition (ad) + for field, spec in ad_entry.fields.items(): + + msg = "%s:%s" % (ad_name, field) + h5_obj = v_item.h5_object.get(field) + status = finding.TF_RESULT[h5_obj is not None] + if h5_obj is None: + msg += " not" + msg += " found" + v_obj = ValidationItem(v_item, h5_obj) + validator.record_finding(v_obj, "NXDL field", status, msg) + + if len(spec.enumerations) > 0: + found = False + for enum in spec.enumerations: + found = enum == utils.decode_byte_string(h5_obj.value) + if found: + break + msg = "%s:%s" % (ad_name, field) + required = spec.xml_attributes["minOccurs"].default_value == 1 # TODO: is this right? + if required: + msg += " (required)" + else: + msg += " (optional)" + status = finding.TF_RESULT[found] + if found: + msg += " has expected value: " + enum + else: + msg += " does not have value: " + " | ".join(spec.enumerations) + validator.record_finding(v_obj, "NXDL field enumerations", status, msg) + + # TODO: attributes, xml_attributes, dimensions, ... diff --git a/src/punx/validations/attribute.py b/src/punx/validations/attribute.py new file mode 100644 index 0000000000000000000000000000000000000000..f3b96c1a88833e4965a9ae12cf1fb5ec50c29977 --- /dev/null +++ b/src/punx/validations/attribute.py @@ -0,0 +1,192 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .. import finding +from .. import utils +from . import item_name + + +TEST_NAME = "attribute value" + + +def verify(validator, v_item): + """ + Verify given item as attribute + """ + if v_item.h5_address is None: + return + if v_item.h5_address.find("@") < 0: + return + + special_handlers = { + "NX_class": nxclass_handler, + "target": target_handler, + "default": generic_handler, + "signal": signal_handler, + "axes": axes_handler, + "axis": generic_handler, + "primary": generic_handler, + "units": units_handler, + } + + handler = special_handlers.get(v_item.name) or generic_handler + handler(validator, v_item) + + +def isBaseClassNXDL(nxdl): + """ + Is the given NXDL intended for use as a base class? + + The situation os obvious for base classes and application definitions. + For contributed definitions, deeper analysis is necessary. + Application definitions define this additional substructure:: + + entry/ + definition = nxdl name (such as NXspecdata) + + If any of that structure is missing, report it as a base class. + """ + if nxdl.category == "base_classes": + return True + elif nxdl.category == "applications": + return False + elif nxdl.category == "contributed_definitions": + nxentry = nxdl.groups.get("entry") + if nxentry is None: + return True + definition = nxentry.fields.get("definition") + return definition is None + return False + + +def axes_handler(validator, v_item): + """ + validate @axes + """ + axes_attr = v_item.h5_object + # if this is not an array, make it axes_attr_array + + # TODO: need to know shape of signal data + # TODO: compare len(axes_attr_array) with range of signal data + # TODO: check each value of array that is a validItemName and points to actual local field + + generic_handler(validator, v_item) + + +def nxclass_handler(validator, v_item): + """validate @NX_class""" + nx_class = utils.decode_byte_string(v_item.h5_object) + nxdl = validator.manager.classes.get(nx_class) + if nxdl is None: + c = "not a recognized NXDL class: " + nx_class + status = finding.ERROR + elif isBaseClassNXDL(nxdl): + c = "recognized NXDL base class: " + nx_class + status = finding.OK + else: + c = "incorrect use of @NX_class attribute: " + nx_class + # should place the application definition name in the entry/definition field + status = finding.ERROR + validator.record_finding(v_item, TEST_NAME, status, c) + + +def signal_handler(validator, v_item): + """ + validate @signal + + The signal attribute is used as part of the NeXus default + plot identification. It could be used either with a field + (to mark the field as plottable data) or a group (to name + the child field that is the plottable data). + """ + signal = utils.decode_byte_string(v_item.h5_object) + if utils.isNeXusDataset(v_item.parent.h5_object): + if str(signal).isdigit() and int(signal) == 1: # could error if signal is other text! + status = finding.OK + c = "found plottable data marker" + else: + status = finding.NOTE + c = "@signal=" + str(signal) + validator.record_finding(v_item, TEST_NAME, status, c) + elif utils.isHdf5Group(v_item.parent.h5_object): + k = item_name.validItemName_match_key(validator, signal) + test_name = "valid name @signal=" + signal + if k is None: + status = finding.ERROR + k = "not a valid NeXus name" + else: + if k.startswith("strict"): + status = finding.OK + else: + status = finding.NOTE + validator.record_finding(v_item, test_name, status, k) + + test = signal in v_item.parent.h5_object + status = finding.TF_RESULT[test] + c = {True: "found", False: "not found"}[test] + c += ": @signal=" + signal + validator.record_finding(v_item, TEST_NAME, status, c) + else: + generic_handler(validator, v_item) + + +def target_handler(validator, v_item): + """validate @target""" + target = utils.decode_byte_string(v_item.h5_object) + + if not target.startswith("/"): + status = finding.ERROR + c = "value be must absolute HDF5 address, start with \"/\"" + validator.record_finding(v_item, TEST_NAME, status, c) + return + addr = "" + for p in target[1:].split("/"): + k = item_name.validItemName_match_key(validator, p) + if k is None: + status = finding.ERROR + c = "value must match with a NeXus validItemName" + validator.record_finding(v_item, TEST_NAME, status, c) + return + else: + addr += "/" + p + if addr not in validator.h5: + status = finding.ERROR + c = "partial HDF5 address not found in file: " + addr + validator.record_finding(v_item, TEST_NAME, status, c) + return + + test = target in validator.h5 + status = finding.TF_RESULT[test] + c = {True: "found", False: "not found"}[test] + c += ": @target=" + target + validator.record_finding(v_item, TEST_NAME, status, c) + + +def units_handler(validator, v_item): + """ + validate @units + + :see: https://bitbucket.org/cfpython/cfunits-python + :see: https://pypi.python.org/pypi/cfunits/1.5.1 + + But, cfunits is not ready for Python3 + Requires a python version from 2.6 up to, but not including, 3.0. + + :see: https://github.com/SciTools/cf_units/pull/22 + """ + generic_handler(validator, v_item) + + +def generic_handler(validator, v_item): + """validate any attribute""" + if v_item.name.endswith("_indices"): + pass + validator.record_finding(v_item, TEST_NAME, finding.TODO, "implement") diff --git a/src/punx/validations/base_class_items_in_hdf5_group.py b/src/punx/validations/base_class_items_in_hdf5_group.py new file mode 100644 index 0000000000000000000000000000000000000000..0e18610d0da2f238772a5cfac73c4bc5671cd773 --- /dev/null +++ b/src/punx/validations/base_class_items_in_hdf5_group.py @@ -0,0 +1,60 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .. import finding +# from .. import utils + + +def verify(validator, v_item, base_class): + """ + Verify items specified in base class NXDL with data file + """ + # TODO: need to match up NXDL objects with flexible names with the HDF5 file counterparts + for field_name in sorted(base_class.fields.keys()): + test = "NXDL field in data file" + f = finding.OK + found = field_name in v_item.h5_object + if found: + c = "found" + else: + # TODO: check if name is flexible + c = "not found" + f = finding.OPTIONAL + c += ": " + v_item.h5_address + if not c.endswith("/"): + c += "/" + c += field_name + validator.record_finding(v_item, test, f, c) + + for group_name, group_object in sorted(base_class.groups.items()): + test = "NXDL group in data file" + f = finding.OK + found = group_name in v_item.h5_object + if found: + t = "found: " + else: + # TODO: check if name is flexible + t = "not found: " + f = finding.OPTIONAL + t += " in " + v_item.h5_address + "/" + group_name + validator.record_finding(v_item, test, f, t) + + #---------- this code is in the wrong place: to nxdl_manager ----- + minOccurs = 0 + if hasattr(base_class, "definition"): # application definition + minOccurs = 1 + minOccurs = int(group_object.attributes.get("minOccurs", minOccurs)) + group_object.minOccurs = minOccurs + #--------------------------------------------------------- + pass # FIXME: report if required item is present, name could be flexible + + for link_name, link_obj in base_class.links.items(): # noqa + pass # TODO: complete diff --git a/src/punx/validations/default_plot.py b/src/punx/validations/default_plot.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab865f4acdfea5f19be41cd0fec58a676a99f9 --- /dev/null +++ b/src/punx/validations/default_plot.py @@ -0,0 +1,183 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + + +"""validate the setup identifying the default plot""" + +import collections + +from .. import finding +from .. import utils + + +def verify(validator): + """entry function of this module""" + # TODO: isn't this validation needed for each NXentry and NXsubentry? + c = "need to validate existence of default plot" + obj = validator.addresses["/"] + status = None + + methods = collections.OrderedDict() + methods["v3"] = default_plot_v3 + methods["v2"] = default_plot_v2 + methods["v1"] = default_plot_v1 + for k, method in methods.items(): + addr = method(validator) + if addr is not None: + c = "found by %s: %s" % (k, addr) + status = finding.OK + break # no need to look further + if status is None: + c = "no default plot described" + data_group = validator.manager.classes["NXentry"].groups["data"] + if hasattr(data_group, "minOccurs"): + minOccurs = data_group.minOccurs + else: + minOccurs = 1 + if minOccurs > 0: + status = finding.ERROR + else: + # even though not "required" it is strongly recommended + # thus NOTE rather than OK + status = finding.NOTE + + validator.record_finding(obj, "NeXus default plot", status, c) + + +def default_plot_v3(validator): + """ + return the HDF5 address of the v3 default plottable data or None + + :see: http://download.nexusformat.org/doc/html/datarules.html#version-3 + """ + # The default plot is described only at classpath: /NXentry/NXdata@signal + # This must result in plottable data.. + # Assume the attribute values are tested elsewhere + def build_h5_address(v_item, pointer): + "create the HDF5 address" + if isinstance(v_item.h5_object, str): + parent = v_item.parent or v_item + addr = parent.h5_object.name + else: + addr = v_item.h5_object.name + if not addr.endswith("/"): + addr += "/" + addr += utils.decode_byte_string(pointer) + return addr + def attribute_points_at_target(v_item, attribute_name, v_target): + "test if attribute value actually points at target" + pointer = v_item.h5_object.attrs.get(attribute_name) + if pointer is None: + return False + addr = build_h5_address(v_item, pointer) + if addr not in v_item.h5_object: + return False + return v_target == addr + + test_name = "NeXus default plot v3" + short_list = list(validator.classpaths.get("/NXentry/NXdata@signal", [])) + # TODO: why not look at every NXdata@signal? + + h5_address = None + niac2014_path = [] + for v_item in short_list: + # check existence of @default attributes, as well + _root, entry, data = v_item.h5_address.split("@")[0].split("/") # noqa + nxdata = validator.addresses["/" + entry + "/" + data] + nxentry = validator.addresses["/" + entry] + nxroot = validator.addresses["/"] + signal_h5_addr = build_h5_address(nxdata, nxdata.h5_object.attrs["signal"]) + t1 = attribute_points_at_target(nxroot, "default", nxentry.h5_address) + t2 = attribute_points_at_target(nxentry, "default", nxdata.h5_address) + t3 = attribute_points_at_target(nxdata, "signal", signal_h5_addr) + t4 = utils.isNeXusDataset(validator.addresses[signal_h5_addr].h5_object) + if t3 and t4: + status = finding.OK + c = "correct default plot setup in /NXentry/NXdata" + validator.record_finding(v_item, test_name + ", NXdata@signal", status, c) + h5_address = signal_h5_addr + if t1 and t2 and t3 and t4: + # this is the NIAC2014 test + niac2014_path.append(v_item) + + # TODO: could also test /NXentry/NXdata@axes + if len(niac2014_path) == 1: + v_item = niac2014_path[0] + status = finding.OK + c = "default plot setup in /NXentry/NXdata" + validator.record_finding(v_item, test_name + " NIAC2014", status, c) + return v_item.h5_address + + return h5_address + + +def default_plot_v2(validator): + """ + return the HDF5 address of the v2 default plottable data or None + + :see: http://download.nexusformat.org/doc/html/datarules.html#version-2 + """ + test_name = "NeXus default plot v2" + review_dict = {} + for k, v in validator.classpaths.items(): + if k.endswith("@signal"): + for v_item in v: + if utils.isNeXusDataset(v_item.parent.h5_object): + signal = str(v_item.h5_object) + if signal == "1": + status = finding.OK + c = "found field with @signal=1: " + v_item.h5_address + validator.record_finding( + v_item, + test_name + ", @signal=1", + status, + c) + + gparent = v_item.parent.parent + group_name = gparent.h5_address + if group_name not in review_dict: + review_dict[group_name] = [] + review_dict[group_name].append(v_item) + else: + status = finding.WARN + c = "found field with @signal!=1: " + v_item.h5_address + c += "=" + signal + validator.record_finding( + v_item, + test_name + ", @signal!=1", + status, + c) + + addr = None + for group_name, v_item_list in review_dict.items(): + if len(v_item_list) == 1: + addr = v_item_list[0].parent.h5_address + status = finding.OK + c = "found plottable data: " + v_item_list[0].h5_address + validator.record_finding(v_item_list[0], test_name, status, c) + elif len(v_item_list) > 1: + status = finding.ERROR + c = "multiple fields found with @signal=1 in: " + group_name + validator.record_finding( + v_item_list[0].parent.parent, + test_name + ", multiple @signal=1", + status, + c) + return addr + + +def default_plot_v1(validator): # noqa + """ + return the HDF5 address of the v1 default plottable data or None + + :see: http://download.nexusformat.org/doc/html/datarules.html#version-1 + """ + test_name = "NeXus default plot v1" # noqa diff --git a/src/punx/validations/hdf5_group_items_in_base_class.py b/src/punx/validations/hdf5_group_items_in_base_class.py new file mode 100644 index 0000000000000000000000000000000000000000..8928ba0549c3a204a038400cb94f9f53b6751a0f --- /dev/null +++ b/src/punx/validations/hdf5_group_items_in_base_class.py @@ -0,0 +1,145 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .. import finding +from .. import utils + + +def verify(validator, v_item, base_class): + """ + Verify items presented in group (of data file) with base class NXDL + """ + verify_group_attributes(validator, v_item, base_class) + verify_group_children(validator, v_item, base_class) + + +def child_exists(validator, test_name, v, v_item, a_item): + """Is v a child of v_item?""" + found = v in v_item.h5_object + if found: + status = finding.OK + c = "found" + else: + status = finding.ERROR + c = "not found" + c += ": " + v_item.h5_address + if not c.endswith("/"): + c += "/" + c += v + validator.record_finding(a_item, test_name, status, c) + + +def verify_group_attributes(validator, v_item, base_class): + """verify the group's attributes""" + for k, v in sorted(v_item.h5_object.attrs.items()): + k = utils.decode_byte_string(k) + v = utils.decode_byte_string(v) + known = k in base_class.attributes + status = finding.OK + c = "known" + if not known and k != "NX_class": + # NX_class is a special case since it is not defined in the nxdl.xsd Schema + c = "unknown" + c += ": " + base_class.title + "@" + k + a_item = validator.addresses[v_item.h5_address + "@" + k] + validator.record_finding(a_item, "known attribute", status, c) + + if not known: # ignore details of the unknown + continue + + spec = base_class.attributes[k] + + if len(spec.enumerations) > 0: + match = v in spec.enumerations + status = finding.TF_RESULT[match] + if match: + c = "found" + else: + c = "not found" + c += ": " + v + test_name = "attribute value enumeration" + validator.record_finding(a_item, test_name, status, c) + # TODO: ... + + # TODO: if spec.xml_attributes["deprecated"] + + # @default attribute points to child group in these classpaths + if k == "default" and v_item.classpath in ("", + "/NXentry", + "/NXentry/NXsubentry"): + test_name = "value of @default" + child_exists(validator, test_name, v, v_item, a_item) + + elif k == "signal": + test_name = "value of @signal" + child_exists(validator, test_name, v, v_item, a_item) + + elif k == "target": + test_name = "value of @target" + found = v in v_item.manager.addresses + if found: + status = finding.OK + c = "found" + else: + status = finding.ERROR + c = "not found" + c += ": " + v_item.h5_address + "/@target = " + v + validator.record_finding(a_item, test_name, status, c) + + elif k == "axes": + pass + + else: + test_name = "value of @" + k + status = finding.TODO + c = "TODO: need to validate" + c += ": @" + k + " = " + v + validator.record_finding(a_item, test_name, status, c) + + + +def verify_group_children(validator, v_item, base_class): + """verify the group's children (groups, fields)""" + for child_name in v_item.h5_object: + obj = v_item.h5_object[child_name] + v_sub_item = validator.addresses[obj.name] + # TODO: need an algorithm to know if v_item is defined in base class + + if utils.isNeXusDataset(obj): + if child_name in base_class.fields: + t = "defined: " + else: + t = "not defined: " + t += base_class.title + "/" + child_name + validator.record_finding( + v_sub_item, + "field in base class", + finding.OK, + t) + + elif utils.isHdf5Group(obj): + if child_name in base_class.groups: + t = "defined: " + else: + t = "not defined: " + t += base_class.title + "/" + child_name + validator.record_finding( + v_sub_item, + "group in base class", + finding.OK, + t) + + else: + validator.record_finding( + v_sub_item, + "unhandled: group_items_in_base_class", + finding.TODO, + "TODO: ") diff --git a/src/punx/validations/item_name.py b/src/punx/validations/item_name.py new file mode 100644 index 0000000000000000000000000000000000000000..e64395fefcdcf5e0c214dcc2086e488ec394903e --- /dev/null +++ b/src/punx/validations/item_name.py @@ -0,0 +1,183 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017-2018, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + + +import re +import collections + +from .. import finding +from .. import utils +from ..validate import CLASSPATH_OF_NON_NEXUS_CONTENT +from ..validate import logger +from ..validate import INFORMATIVE +from ..validate import VALIDITEMNAME_STRICT_PATTERN + + +TEST_NAME = "validItemName" +LINK_TARGET = "target" +LINK_SOURCE = "source" +NOT_LINKED = "not linked" + + +def isNeXusLinkTarget(v_item): + """ + Is v_item a NeXus link target? + + It is a "target" if its HDF5 address does not match the target value. + It is a "source" if its HDF5 address matches the target attribute value. + """ + if "target" in v_item.h5_object.attrs: + source_name = utils.decode_byte_string(v_item.h5_address) + target_name = utils.decode_byte_string(v_item.h5_object.attrs["target"]) + return target_name != source_name + return False # no @target attribute at all + + +def verify(validator, v_item, key=None): + """ + check :class:`ValidationItem` *v_item* using *validItemName* regular expression + + This is used for the names of groups, fields, links, and attributes. + + :param obj v_item: instance of :class:`ValidationItem` + :param str key: named key to search, default: None (``validItemName``) + + This method will test the object's name for validation, + comparing with the strict or relaxed regular expressions for + a valid item name. + The finding for each name is classified by the next table: + + ===== ======= ======= ================================================================ + order finding match description + ===== ======= ======= ================================================================ + 1 OK strict matches most stringent NeXus specification + 2 NOTE relaxed matches NeXus specification that is most generally accepted + 3 ERROR UTF8 specific to strings with UnicodeDecodeError (see issue #37) + 4 WARN HDF5 acceptable to HDF5 but not NeXus + ===== ======= ======= ================================================================ + + :see: http://download.nexusformat.org/doc/html/datarules.html?highlight=regular%20expression + """ + if v_item.parent is None: + msg = "no name validation on the HDF5 file root node" + logger.log(INFORMATIVE, msg) + return + if "name" in v_item.validations: + return # do not repeat this + + key = key or "validItemName" + + if v_item.h5_address is not None and v_item.h5_address.endswith("@NX_class"): + handle_NX_class(validator, v_item) + + # attribute + elif v_item.classpath.find("@") > -1 and isNeXusLinkTarget(v_item.parent): + # Do not validate the attributes of linked items. + # They will be validated with the source item. + pass + elif v_item.classpath.find("@") > -1: + handle_any_attribute(validator, v_item) + + elif (utils.isHdf5Dataset(v_item.h5_object) or + utils.isHdf5Group(v_item.h5_object) or + utils.isHdf5Link(v_item.h5_object) or + utils.isHdf5ExternalLink(v_item.parent, v_item.name)): + handle_groups_and_fields(validator, v_item) + + elif v_item.classpath == CLASSPATH_OF_NON_NEXUS_CONTENT: + pass # nothing else to do here + + else: + status = finding.TODO # TODO: + c = "not handled yet" + validator.record_finding(v_item, TEST_NAME, status, c) + + +def handle_NX_class(validator, v_item): + """validate the value of the NX_class attribute""" + nxdl = validator.manager.nxdl_file_set.schema_manager.nxdl + key = "validNXClassName" + patterns = collections.OrderedDict() + for i, p in enumerate(nxdl.patterns[key].re_list): + patterns[key + "-" + str(i)] = p + + status = finding.ERROR + for k, p in patterns.items(): + if k not in validator.regexp_cache: + validator.regexp_cache[k] = re.compile('^' + p + '$') + s = utils.decode_byte_string(v_item.h5_object) + m = validator.regexp_cache[k].match(s) + matches = m is not None and m.string == s + msg = "checking %s with %s: %s" % (v_item.h5_address, k, str(matches)) + logger.debug(msg) + if matches: + status = finding.OK + break + validator.record_finding(v_item, TEST_NAME, status, "pattern: " + p) + + +def handle_any_attribute(validator, v_item, key=None): + """validate the names of attributes""" + k = validItemName_match_key(validator, v_item.name) + status = finding.TF_RESULT[k is not None] + k = k or "no matching pattern found" + key = key or "validItemName" + f = finding.Finding(v_item.h5_address, TEST_NAME, status, k) # noqa + validator.validations.append(f) + v_item.validations[key] = f + + +def getValidItemNamePatterns(validator, key=None): + """get regular expression patterns for validItemName""" + key = key or "validItemName" + patterns = collections.OrderedDict() + nxdl = validator.manager.nxdl_file_set.schema_manager.nxdl + + # build the regular expression patterns to match + k = "strict pattern: " + VALIDITEMNAME_STRICT_PATTERN + patterns[k] = VALIDITEMNAME_STRICT_PATTERN + if key in nxdl.patterns: + expression_list = nxdl.patterns[key].re_list + for p in expression_list: + patterns["relaxed pattern: " + p] = p + return patterns + + +def validItemName_match_key(validator, text): + """Return the validItemName key that matches text, or None""" + patterns = getValidItemNamePatterns(validator) + for k, p in patterns.items(): + if k not in validator.regexp_cache: + validator.regexp_cache[k] = re.compile('^' + p + '$') + + s = utils.decode_byte_string(text) + m = validator.regexp_cache[k].match(s) + matches = m is not None and m.string == s + logger.debug("checking %s with %s: %s", s, k, str(matches)) + if matches: + return k + + +def handle_groups_and_fields(validator, v_item): + """validate the names of groups and fields""" + # check against patterns until a match is found + try: + k = validItemName_match_key(validator, v_item.name) + if k is None: + status = finding.ERROR + k = "valid HDF5 item name, not valid with NeXus" + elif k.startswith("strict"): + status = finding.OK + else: + status = finding.NOTE + except UnicodeDecodeError: # TODO: see issue #37 + status = finding.ERROR + validator.record_finding(v_item, TEST_NAME, status, k) diff --git a/src/punx/validations/nx_class_attribute.py b/src/punx/validations/nx_class_attribute.py new file mode 100644 index 0000000000000000000000000000000000000000..080ef24e4ba45702b1e7af65690d8449acd16e1e --- /dev/null +++ b/src/punx/validations/nx_class_attribute.py @@ -0,0 +1,40 @@ + +#----------------------------------------------------------------------------- +# :author: Pete R. Jemian +# :email: prjemian@gmail.com +# :copyright: (c) 2017, Pete R. Jemian +# +# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. +# +# The full license is in the file LICENSE.txt, distributed with this software. +#----------------------------------------------------------------------------- + + +from .. import finding + + +def validate_NX_class_attribute(validator, v_item, nx_class): + """ + validate proper use of NeXus groups + + Only known base classes (and contributed definitions intended + for use as base classes) can be used as groups in a NeXus data file. + Application definitions are used in a different way, as an overlay + on a parent NXentry or NXsubentry group, and declared in the + `definition` field of that parent group. + """ + known = nx_class in validator.manager.classes + status = finding.TF_RESULT[known] + msg = nx_class + ": recognized NXDL specification" + validator.record_finding(v_item, "known NXDL", status, msg) + + if known: + as_base = validator.usedAsBaseClass(nx_class) + status = finding.TF_RESULT[as_base] + # ??? validator.manager.classes[nx_class].category + msg = nx_class + if validator.manager.classes[nx_class].category == "base_classes": + msg += ": known NeXus base class" + else: + msg += ": known NeXus contributed definition used as base class" + validator.record_finding(v_item, "NeXus base class", status, msg) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1f314363717bc12ba42dc1a49b0e42982fb76143 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,61 @@ +# advice: http://stackoverflow.com/questions/191673/preferred-python-unit-testing-framework?rq=1 +# advice: http://stackoverflow.com/questions/17001010/how-to-run-unittest-discover-from-python-setup-py-test#21726329 +# advice: http://stackoverflow.com/questions/6164004/python-package-structure-setup-py-for-running-unit-tests?noredirect=1&lq=1 + + +import os +import unittest +import sys + +_path = os.path.join(os.path.dirname(__file__), '..',) +if _path not in sys.path: + sys.path.insert(0, _path) +from tests import common + + +def suite(*args, **kw): + from tests import common_test + #from tests import cache_test + from tests import cache_manager_test + #from tests import default_plot_test + #from tests import external_links + from tests import finding_test + from tests import github_handler_test + #from tests import h5structure_test +# from tests import logs_test + from tests import nxdl_manager_test + from tests import nxdl_schema_test + #from tests import nxdlstructure_test + from tests import schema_manager_test + from tests import utils_test + from tests import validate_test + #from tests import warnings_test + + test_suite = unittest.TestSuite() + test_list = [ + common_test, + #cache_test, + cache_manager_test, + #default_plot_test, + #external_links, + finding_test, +# github_handler_test, + #h5structure_test, +# logs_test, + nxdl_manager_test, + nxdl_schema_test, + #nxdlstructure_test, + schema_manager_test, + utils_test, + validate_test, + #warnings_test, + ] + + for test in test_list: + test_suite.addTest(test.suite()) + return test_suite + + +if __name__ == '__main__': # pragma: no cover + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/__main__.py b/tests/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..630e6238ab2117e36cf1b2e56326f8737f068e44 --- /dev/null +++ b/tests/__main__.py @@ -0,0 +1,8 @@ + +import unittest + +import __init__ + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(__init__.suite()) diff --git a/tests/cache_manager_test.py b/tests/cache_manager_test.py new file mode 100644 index 0000000000000000000000000000000000000000..fee5f611ae583a91cd19b91cc4e654d08a389440 --- /dev/null +++ b/tests/cache_manager_test.py @@ -0,0 +1,123 @@ + +''' +test punx tests/cache_manager module + +ISSUES + +.. note:: + Add new issues here with empty brackets, add "*" when issue is fixed. + Issues will only be marked "fixed" on GitHub once this branch is merged. + Then, this table may be removed. + +* [ ] #94 lazy load NXDL details until needed +''' + +import io +import os +import shutil +import sys +import tempfile +import unittest +import zipfile + +import github + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))) +import punx, punx.cache_manager + + +class Test_CacheManager_class(unittest.TestCase): + + def test_basic_setup(self): + self.assertEqual( + punx.cache_manager.SOURCE_CACHE_SUBDIR, + u'cache', + u'source cache directory: <SRC>/cache') + self.assertEqual( + punx.cache_manager.INFO_FILE_NAME, + u'__github_info__.json', + u'source cache directory: ' + punx.cache_manager.INFO_FILE_NAME) + self.assertEqual( + punx.cache_manager.SOURCE_CACHE_SETTINGS_FILENAME, + u'punx.ini', + u'source cache directory: ' + punx.cache_manager.SOURCE_CACHE_SETTINGS_FILENAME) + self.assertEqual( + punx.cache_manager.SHORT_SHA_LENGTH, + 7, + u'source cache directory: ' + str(punx.cache_manager.SHORT_SHA_LENGTH)) + + def test_instance(self): + import punx.github_handler + cm = punx.cache_manager.CacheManager() + self.assertTrue( + isinstance(cm, (type(None),punx.cache_manager.CacheManager)), + u'instance: ' + str(type(cm))) + if cm is not None: + self.assertTrue( + isinstance(cm, punx.cache_manager.CacheManager), + u'instance created' + str(cm)) + + self.assertTrue( + len(cm.NXDL_file_sets) > 0, + u'at least one NXDL file set in a cache') + self.assertTrue( + punx.github_handler.DEFAULT_NXDL_SET in cm.NXDL_file_sets, + u'the default NXDL file set is in the cache') + cm.cleanup() + + def test_selected_file_set(self): + import punx.github_handler + cm = punx.cache_manager.CacheManager() + if cm is not None: + fs = cm.select_NXDL_file_set(punx.github_handler.DEFAULT_NXDL_SET) + self.assertEqual(fs.ref, punx.github_handler.DEFAULT_NXDL_SET, u'ref: ' + fs.ref) + self.assertEqual(fs.cache, u'source', u'in source cache: ' + fs.cache) + cm.cleanup() + + def test_missing_file_set(self): + import punx.github_handler + cm = punx.cache_manager.CacheManager() + if cm is not None: + self.assertRaises(KeyError, cm.select_NXDL_file_set, '**missing**') + cm.cleanup() + + +class Test_NXDL_File_Set_class(unittest.TestCase): + + def test_class_raw(self): + fs = punx.cache_manager.NXDL_File_Set() + self.assertTrue(isinstance(fs, punx.cache_manager.NXDL_File_Set)) + self.assertRaises( + ValueError, + fs.read_info_file) + self.assertTrue( + str(fs).startswith('<punx.cache_manager.NXDL_File_Set')) + self.assertRaises( + IOError, + # TODO: should be: punx.FileNotFound, + fs.read_info_file, 'this file does not exist') + + def test_class(self): + cm = punx.cache_manager.CacheManager() + assert(cm is not None and cm.default_file_set is not None) + fs = cm.default_file_set + self.assertTrue( + str(fs).startswith('NXDL_File_Set(')) + + # TODO: more + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_CacheManager_class, + Test_NXDL_File_Set_class, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/common.py b/tests/common.py new file mode 100644 index 0000000000000000000000000000000000000000..6db7529d8eff584c4e9523bef3e7e1d2519e47a5 --- /dev/null +++ b/tests/common.py @@ -0,0 +1,196 @@ +''' +common code for unit testing of punx +''' + + +import h5py +import os +import sys +import tempfile +import unittest +from six import StringIO + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) + + +__test_file_name__ = None # singleton + + +def create_test_file(content_function=None, suffix='.hdf5'): + """ + create a new (HDF5) test file + + :param obj content_function: method to add content(s) to hdf5root + """ + hfile = tempfile.NamedTemporaryFile(suffix=suffix, delete=False) + hfile.close() + if suffix == '.hdf5': + hdf5root = h5py.File(hfile.name, "w") + if content_function is not None: + content_function(hdf5root) + hdf5root.close() + return str(hfile.name) + + +def getTestFileName(set_contents_function=None, suffix='.hdf5'): + ''' + create (or identify) the file to be tested + ''' + global __test_file_name__ + __test_file_name__ = __test_file_name__ or create_test_file(set_contents_function, + suffix=suffix) + return __test_file_name__ + + +def cleanup(): + ''' + cleanup after all tests are done + ''' + global __test_file_name__ + if __test_file_name__ is not None: + if os.path.exists(__test_file_name__): + os.remove(__test_file_name__) + __test_file_name__ = None + + +def punx_data_file_name(fname): + ''' + return the absolute path to the file in src/punx/data/fname + ''' + path = os.path.join(os.path.dirname(__file__), '..', 'src', 'punx', 'data') + return os.path.abspath(os.path.join(path, fname)) + + +def read_filelines(fname): + ''' + read a text file and split into lines + ''' + with open(fname, 'r') as fp: + buf = fp.read() + return buf.strip().splitlines() + + +class CustomHdf5File(unittest.TestCase): + ''' + build tests for a custom-built HDF5 file + ''' + + def setUp(self): + self.testfile = getTestFileName(self.createContent) + + def tearDown(self): + testfile = None + + def createContent(self, hdf5root): + ''' + override this method in each subclass + + :param obj hdf5root: instance of h5py.File + ''' + pass + + +class BaseHdf5File(unittest.TestCase): + + # testfile = 'writer_1_3.hdf5' + # expected_output = ['file',] + # ... + NeXus = True + + def test_00_report_length(self): + ''' + test number of lines in the report + ''' + n_exp = len(self.expected_output) + n_act = len(self.report) + msg = "expected != reported" + self.assertEqual(n_exp, n_act, msg) + + def test_expected_output__line_by_line(self): + ''' + test output of structure analysis on a HDF5 file + ''' + for item, actual in enumerate(self.report): + actual = str(actual).rstrip() + expected = str(self.expected_output[item]).rstrip() + if actual != expected: + _test = True # for debugging break point + msg = "validation different on line " + str(item+1) + ':' + msg += '\n expected: ' + str(expected) + msg += '\n reported: ' + str(actual) + self.assertEqual(expected, actual, msg) + + +class StructureHdf5File(BaseHdf5File): + + # testfile = 'writer_1_3.hdf5' + # expected_output = ['file',] + # ... + NeXus = True + + def setUp(self): + ''' + read the self.testfile from the punx data file collection + ''' + import punx.h5structure + + fname = punx_data_file_name(self.testfile) + self.expected_output[0] = fname + if self.NeXus: + self.expected_output[0] += " : NeXus data file" + + # :param int limit: maximum number of array items to be shown (default = 5) + limit = 1 + # :param bool show_attributes: display attributes in output + show_attributes = True + + xture = punx.h5structure.h5structure(fname) + xture.array_items_shown = limit + self.report = xture.report(show_attributes) + + +class ValidHdf5File(BaseHdf5File): + + # testfile = 'writer_1_3.hdf5' + # expected_output = ['file',] + # ... + NeXus = True + + def setUp(self): + ''' + read the self.testfile from the punx data file collection + ''' + import punx.validate, punx.finding, punx.logs + + punx.logs.ignore_logging() + + fname = punx_data_file_name(self.testfile) + # self.expected_output[0] = fname + # if self.NeXus: + # self.expected_output[0] += " : NeXus data file" + + validator = punx.validate.Data_File_Validator(fname) + validator.validate() + self.report = [] + + self.report += validator.report_findings(punx.finding.VALID_STATUS_LIST).splitlines() + self.report.append('') + self.report += validator.report_findings_summary().splitlines() + + +class Capture_stdout(list): + ''' + capture all printed output (to stdout) into list + + # http://stackoverflow.com/questions/16571150/how-to-capture-stdout-output-from-a-python-function-call + ''' + def __enter__(self): + sys.stdout.flush() + self._stdout = sys.stdout + sys.stdout = self._stringio = StringIO() + return self + + def __exit__(self, *args): + self.extend(self._stringio.getvalue().splitlines()) + del self._stringio # free up some memory + sys.stdout = self._stdout diff --git a/tests/common_test.py b/tests/common_test.py new file mode 100644 index 0000000000000000000000000000000000000000..8a269ff2e3a0be251ca8c5facaeb50784d73cae3 --- /dev/null +++ b/tests/common_test.py @@ -0,0 +1,103 @@ + +''' +test punx tests/common module (supports unit testing) +''' + +import os +import h5py +import sys +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..',) +if _path not in sys.path: + sys.path.insert(0, _path) +from tests import common + + +class TestCommon(unittest.TestCase): + + def setUp(self): + self.file_list = [] + + def tearDown(self): + for fname in self.file_list: + if os.path.exists(fname): + os.remove(fname) + common.cleanup() + + def test_create_test_file(self): + '''test that file creation and deletion are working''' + fname = common.create_test_file() + self.file_list.append(fname) + self.assertTrue(os.path.exists(fname), 'test file exists') + os.remove(fname) + self.assertFalse(os.path.exists(fname), 'test file deleted') + + def test_get_test_file(self): + '''verify that getTestFileName() gives a singleton name''' + fname = common.getTestFileName() + self.assertTrue(os.path.exists(fname), 'test file exists') + fname2 = common.getTestFileName() + self.assertEqual(fname, fname2, 'same test file name') + common.cleanup() + self.assertFalse(os.path.exists(fname), 'test file deleted') + fname = common.getTestFileName() + self.assertNotEqual(fname, fname2, 'different test file names') + common.cleanup() + self.assertFalse(os.path.exists(fname), 'new test file deleted') + + def test_is_hdf5_file(self): + '''make an HDF5 file and test it by reading''' + fname = common.create_test_file() + self.file_list.append(fname) + fp = h5py.File(fname, 'r') + self.assertIsInstance(fp, h5py.File, 'is HDF5 file') + self.assertEqual(None, fp.get('entry', None)) + fp.close() + + def test_hdf5_file_with_simple_content(self): + '''make an HDF5 file, add more content, and test it by reading''' + # - - - - - - - - - - - - - - - + def set_content(hdf5root): + entry = hdf5root.create_group('entry') + ds = entry.create_dataset('counter', data=[1,221,33]) + entry.attrs["signal"] = "counter" + ds.attrs["units"] = "counts" + # - - - - - - - - - - - - - - - + fname = common.getTestFileName(set_content) + fp = h5py.File(fname, 'r') + self.assertIsInstance(fp, h5py.File, 'is HDF5 file') + self.assertIsInstance(fp['entry'], h5py.Group) + self.assertEqual('counter', fp['entry'].attrs['signal']) + self.assertIsInstance(fp['entry/counter'], h5py.Dataset) + self.assertEqual('counts', fp['entry/counter'].attrs['units']) + fp.close() + + def test_is_not_hdf5_file(self): + '''try to open this python code file as if it were HDF5''' + self.assertRaises((IOError, OSError), h5py.File, __file__, 'r') + + def test_punx_data_file_name(self): + '''verify a punx data file exists and verify that it is HDF5''' + fname = common.punx_data_file_name('writer_1_3.hdf5') + self.assertTrue(os.path.exists(fname), 'test file exists') + fp = h5py.File(fname, 'r') + self.assertIsInstance(fp, h5py.File, 'is HDF5 file') + fp.close() + + def test_read_filelines(self): + path = os.path.abspath(os.path.dirname(__file__)) + fname = os.path.join(path, 'data', 'structures', 'writer_1_3.txt') + lines = common.read_filelines(fname) + self.assertEqual(12, len(lines), 'number of lines in a text file') + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_suite.addTest(unittest.makeSuite(TestCommon)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/data/structures/02_03_setup.txt b/tests/data/structures/02_03_setup.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c5b7b674e3b038cce09962681b11f5eff8f11ab --- /dev/null +++ b/tests/data/structures/02_03_setup.txt @@ -0,0 +1,364 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\02_03_setup.h5 : NeXus data file + @SPEC_date = 2016-02-03T16:51:31 + @SPEC_file = /home/oxygen/JEMIAN/Documents/eclipse/spec2nexus/src/spec2nexus/data/02_03_setup.dat + @SPEC_epoch = 1454539891 + @spec2nexus = 2016.0204.0 + @SPEC_user = usaxs + @SPEC_comments = Setup with new A stage User = usaxs +Wed Feb 03 16:51:38 2016. do ./usaxs.mac. +Wed Feb 03 16:51:38 2016. do USAXS_conf.mac. +Wed Feb 03 16:51:38 2016. do ./USAXS_user_macros.mac. +Wed Feb 03 16:51:38 2016. do ~/spec/macros/local/usaxs_startscan.mac. +Wed Feb 03 16:51:40 2016. USAXS I0 dark current range 5 = 983 +/- 19.5576 c/s. +Wed Feb 03 16:51:40 2016. USAXS I00 dark current range 5 = 1959 +/- 26.0768 c/s. +Wed Feb 03 16:51:40 2016. USAXS TRD dark current range 5 = 5 +/- 0 c/s. +Wed Feb 03 16:51:41 2016. USAXS I0 dark current range 4 = 5 +/- 0 c/s. +Wed Feb 03 16:51:41 2016. USAXS I00 dark current range 4 = 1800 +/- 0 c/s. +Wed Feb 03 16:51:41 2016. USAXS TRD dark current range 4 = 5 +/- 0 c/s. +Wed Feb 03 16:51:42 2016. USAXS I0 dark current range 3 = 83 +/- 8.3666 c/s. +Wed Feb 03 16:51:42 2016. USAXS I00 dark current range 3 = 1789 +/- 2.23607 c/s. +Wed Feb 03 16:51:42 2016. USAXS TRD dark current range 3 = 5 +/- 0 c/s. +Wed Feb 03 16:51:44 2016. USAXS I0 dark current range 2 = 5 +/- 0 c/s. +Wed Feb 03 16:51:44 2016. USAXS I00 dark current range 2 = 1786 +/- 5.47723 c/s. +Wed Feb 03 16:51:44 2016. USAXS TRD dark current range 2 = 5 +/- 0 c/s. +Wed Feb 03 16:51:45 2016. USAXS I0 dark current range 1 = 130 +/- 0 c/s. +Wed Feb 03 16:51:45 2016. USAXS I00 dark current range 1 = 1792 +/- 4.47214 c/s. +Wed Feb 03 16:51:45 2016. USAXS TRD dark current range 1 = 5 +/- 0 c/s. +Wed Feb 03 16:51:48 2016. USAXS upd2 FemtoPD dark current range 5 = 5 +/- 0 c/s. +Wed Feb 03 16:51:50 2016. USAXS upd2 FemtoPD dark current range 4 = 5 +/- 0 c/s. +Wed Feb 03 16:51:51 2016. USAXS upd2 FemtoPD dark current range 3 = 5 +/- 0 c/s. +Wed Feb 03 16:51:52 2016. USAXS upd2 FemtoPD dark current range 2 = 5 +/- 0 c/s. +Wed Feb 03 16:51:54 2016. USAXS upd2 FemtoPD dark current range 1 = 5 +/- 0 c/s. +Wed Feb 03 16:51:54 2016. Runing preUSAXStune since it was requested on start of the measurements. . +Wed Feb 03 16:51:54 2016. Moving USAXS slits and guard slits to correct place. +Wed Feb 03 16:51:59 2016. Ready for USAXS mode. +Wed Feb 03 16:52:00 2016. Moving USAXS slits and guard slits to correct place. +Wed Feb 03 16:52:01 2016. tuning USAXS motor mr. + @SPEC_num_headers = 1 + @file_name = /home/oxygen/JEMIAN/Desktop/02_03_setup + @file_time = 2016-06-01T11:46:41.553149 + @HDF5_Version = 1.8.15 + @h5py_version = 2.5.0 + scan_1:NXentry + @NX_class = NXentry + T:NX_FLOAT64[] = [ ... ] + @units = seconds + @description = SPEC scan with constant counting time + command:NX_CHAR = ascan mr 10.3467 10.3426 30 0.1 + comments:NX_CHAR = tuning USAXS motor mr +Wed Feb 03 16:52:14 2016. setting motor mr to 10.3446. +Wed Feb 03 16:52:14 2016. tuning USAXS motor m2rp. + counting_basis:NX_CHAR = SPEC scan with constant counting time + date:NX_CHAR = 2016-02-03T16:52:03 + scan_number:NX_CHAR = 1 + title:NX_CHAR = 1 ascan mr 10.3467 10.3426 30 0.1 + G:NXlog + @NX_class = NXlog + @description = SPEC geometry arrays, meanings defined by SPEC diffractometer support + G0:NX_FLOAT64 = 0.0 + G1:NX_FLOAT64 = 0.0 + G3:NX_FLOAT64 = 0.0 + G4:NX_FLOAT64 = 0.0 + data:NXdata + @NX_class = NXdata + @signal = I0 + @axes = mr + @description = SPEC scan data + Epoch:NX_FLOAT64[31] = [ ... ] + @original_name = Epoch + I0:NX_FLOAT64[31] = [ ... ] + @original_name = I0 + I00:NX_FLOAT64[31] = [ ... ] + @original_name = I00 + I00_gain:NX_FLOAT64[31] = [ ... ] + @original_name = I00_gain + I0_1:NX_FLOAT64[31] = [ ... ] + @original_name = I0_1 + I0_gain:NX_FLOAT64[31] = [ ... ] + @original_name = I0_gain + TR_diode:NX_FLOAT64[31] = [ ... ] + @original_name = TR_diode + USAXS_PD:NX_FLOAT64[31] = [ ... ] + @original_name = USAXS_PD + Und_E:NX_FLOAT64[31] = [ ... ] + @original_name = Und_E + ar_enc:NX_FLOAT64[31] = [ ... ] + @original_name = ar_enc + ay:NX_FLOAT64[31] = [ ... ] + @original_name = ay + dy:NX_FLOAT64[31] = [ ... ] + @original_name = dy + mr:NX_FLOAT64[31] = [ ... ] + @original_name = mr + pd_counts:NX_FLOAT64[31] = [ ... ] + @original_name = pd_counts + pd_curent:NX_FLOAT64[31] = [ ... ] + @original_name = pd_curent + pd_range:NX_FLOAT64[31] = [ ... ] + @original_name = pd_range + pd_rate:NX_FLOAT64[31] = [ ... ] + @original_name = pd_rate + seconds:NX_FLOAT64[31] = [ ... ] + @original_name = seconds + metadata:NXlog + @NX_class = NXlog + @description = SPEC metadata (UNICAT-style #H & #V lines) + ARenc_0:NX_FLOAT64[] = [ ... ] + @original_name = ARenc_0 + CCD_DX:NX_FLOAT64[] = [ ... ] + @original_name = CCD_DX + CCD_DY:NX_FLOAT64[] = [ ... ] + @original_name = CCD_DY + DCM_energy:NX_FLOAT64[] = [ ... ] + @original_name = DCM_energy + DCM_lambda:NX_FLOAT64[] = [ ... ] + @original_name = DCM_lambda + DIODE_DX:NX_FLOAT64[] = [ ... ] + @original_name = DIODE_DX + DIODE_DY:NX_FLOAT64[] = [ ... ] + @original_name = DIODE_DY + FE_XBPM_HA:NX_FLOAT64[] = [ ... ] + @original_name = FE_XBPM_HA + FE_XBPM_HP:NX_FLOAT64[] = [ ... ] + @original_name = FE_XBPM_HP + FE_XBPM_VA:NX_FLOAT64[] = [ ... ] + @original_name = FE_XBPM_VA + FE_XBPM_VP:NX_FLOAT64[] = [ ... ] + @original_name = FE_XBPM_VP + I00AmpGain:NX_FLOAT64[] = [ ... ] + @original_name = I00AmpGain + I0AmpGain:NX_FLOAT64[] = [ ... ] + @original_name = I0AmpGain + ID_E:NX_FLOAT64[] = [ ... ] + @original_name = ID_E + ID_gap:NX_FLOAT64[] = [ ... ] + @original_name = ID_gap + ID_harmonic:NX_FLOAT64[] = [ ... ] + @original_name = ID_harmonic + ID_taperE:NX_FLOAT64[] = [ ... ] + @original_name = ID_taperE + ID_taperGap:NX_FLOAT64[] = [ ... ] + @original_name = ID_taperGap + SAD:NX_FLOAT64[] = [ ... ] + @original_name = SAD + SDD:NX_FLOAT64[] = [ ... ] + @original_name = SDD + SR_BPM_HA:NX_FLOAT64[] = [ ... ] + @original_name = SR_BPM_HA + SR_BPM_HP:NX_FLOAT64[] = [ ... ] + @original_name = SR_BPM_HP + SR_BPM_VA:NX_FLOAT64[] = [ ... ] + @original_name = SR_BPM_VA + SR_BPM_VP:NX_FLOAT64[] = [ ... ] + @original_name = SR_BPM_VP + SR_current:NX_FLOAT64[] = [ ... ] + @original_name = SR_current + SR_fb:NX_FLOAT64[] = [ ... ] + @original_name = SR_fb + SR_fbH:NX_FLOAT64[] = [ ... ] + @original_name = SR_fbH + SR_fbV:NX_FLOAT64[] = [ ... ] + @original_name = SR_fbV + SR_fill:NX_FLOAT64[] = [ ... ] + @original_name = SR_fill + SR_mode:NX_FLOAT64[] = [ ... ] + @original_name = SR_mode + SR_status:NX_FLOAT64[] = [ ... ] + @original_name = SR_status + SR_topUp:NX_FLOAT64[] = [ ... ] + @original_name = SR_topUp + Scan_Al_Filter:NX_FLOAT64[] = [ ... ] + @original_name = Scan_Al_Filter + Scan_Ti_Filter:NX_FLOAT64[] = [ ... ] + @original_name = Scan_Ti_Filter + UATERM:NX_FLOAT64[] = [ ... ] + @original_name = UATERM + UND_energy:NX_FLOAT64[] = [ ... ] + @original_name = UND_energy + UND_offset:NX_FLOAT64[] = [ ... ] + @original_name = UND_offset + UND_tracking:NX_FLOAT64[] = [ ... ] + @original_name = UND_tracking + UPD2bkg1:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkg1 + UPD2bkg2:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkg2 + UPD2bkg3:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkg3 + UPD2bkg4:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkg4 + UPD2bkg5:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkg5 + UPD2bkgErr1:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkgErr1 + UPD2bkgErr2:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkgErr2 + UPD2bkgErr3:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkgErr3 + UPD2bkgErr4:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkgErr4 + UPD2bkgErr5:NX_FLOAT64[] = [ ... ] + @original_name = UPD2bkgErr5 + UPD2gain:NX_FLOAT64[] = [ ... ] + @original_name = UPD2gain + UPD2gain1:NX_FLOAT64[] = [ ... ] + @original_name = UPD2gain1 + UPD2gain2:NX_FLOAT64[] = [ ... ] + @original_name = UPD2gain2 + UPD2gain3:NX_FLOAT64[] = [ ... ] + @original_name = UPD2gain3 + UPD2gain4:NX_FLOAT64[] = [ ... ] + @original_name = UPD2gain4 + UPD2gain5:NX_FLOAT64[] = [ ... ] + @original_name = UPD2gain5 + UPD2mode:NX_FLOAT64[] = [ ... ] + @original_name = UPD2mode + UPD2range:NX_FLOAT64[] = [ ... ] + @original_name = UPD2range + UPD2selected:NX_FLOAT64[] = [ ... ] + @original_name = UPD2selected + UPD2vfc:NX_FLOAT64[] = [ ... ] + @original_name = UPD2vfc + UPDsize:NX_FLOAT64[] = [ ... ] + @original_name = UPDsize + USAXSPinT_AyPosition:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_AyPosition + USAXSPinT_I0Counts:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_I0Counts + USAXSPinT_I0Gain:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_I0Gain + USAXSPinT_Measure:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_Measure + USAXSPinT_Time:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_Time + USAXSPinT_pinCounts:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_pinCounts + USAXSPinT_pinGain:NX_FLOAT64[] = [ ... ] + @original_name = USAXSPinT_pinGain + arCenter:NX_FLOAT64[] = [ ... ] + @original_name = arCenter + arEnc:NX_FLOAT64[] = [ ... ] + @original_name = arEnc + asrCenter:NX_FLOAT64[] = [ ... ] + @original_name = asrCenter + barometer_mbar:NX_FLOAT64[] = [ ... ] + @original_name = barometer_mbar + mrCenter:NX_FLOAT64[] = [ ... ] + @original_name = mrCenter + mrEnc:NX_FLOAT64[] = [ ... ] + @original_name = mrEnc + msrCenter:NX_FLOAT64[] = [ ... ] + @original_name = msrCenter + thickness:NX_FLOAT64[] = [ ... ] + @original_name = thickness + positioners:NXlog + @NX_class = NXlog + @description = SPEC positioners (#P & #O lines) + ART50_100:NX_FLOAT64[] = [ ... ] + @original_name = ART50-100 + GSlit_bot:NX_FLOAT64[] = [ ... ] + @original_name = GSlit_bot + GSlit_inb:NX_FLOAT64[] = [ ... ] + @original_name = GSlit_inb + GSlit_outb:NX_FLOAT64[] = [ ... ] + @original_name = GSlit_outb + GSlit_top:NX_FLOAT64[] = [ ... ] + @original_name = GSlit_top + USAXS_a2rp:NX_FLOAT64[] = [ ... ] + @original_name = USAXS.a2rp + USAXS_asrp:NX_FLOAT64[] = [ ... ] + @original_name = USAXS.asrp + USAXS_m2rp:NX_FLOAT64[] = [ ... ] + @original_name = USAXS.m2rp + USAXS_msrp:NX_FLOAT64[] = [ ... ] + @original_name = USAXS.msrp + WAXS_X:NX_FLOAT64[] = [ ... ] + @original_name = WAXS_X + ar:NX_FLOAT64[] = [ ... ] + @original_name = ar + asr:NX_FLOAT64[] = [ ... ] + @original_name = asr + ast:NX_FLOAT64[] = [ ... ] + @original_name = ast + asy:NX_FLOAT64[] = [ ... ] + @original_name = asy + ax:NX_FLOAT64[] = [ ... ] + @original_name = ax + ay:NX_FLOAT64[] = [ ... ] + @original_name = ay + az:NX_FLOAT64[] = [ ... ] + @original_name = az + cam_focus:NX_FLOAT64[] = [ ... ] + @original_name = cam_focus + cam_y:NX_FLOAT64[] = [ ... ] + @original_name = cam_y + dx:NX_FLOAT64[] = [ ... ] + @original_name = dx + dy:NX_FLOAT64[] = [ ... ] + @original_name = dy + en:NX_FLOAT64[] = [ ... ] + @original_name = en + ion_ch:NX_FLOAT64[] = [ ... ] + @original_name = ion_ch + mr:NX_FLOAT64[] = [ ... ] + @original_name = mr + msr:NX_FLOAT64[] = [ ... ] + @original_name = msr + mst:NX_FLOAT64[] = [ ... ] + @original_name = mst + msx:NX_FLOAT64[] = [ ... ] + @original_name = msx + msy:NX_FLOAT64[] = [ ... ] + @original_name = msy + mx:NX_FLOAT64[] = [ ... ] + @original_name = mx + my:NX_FLOAT64[] = [ ... ] + @original_name = my + pin_x:NX_FLOAT64[] = [ ... ] + @original_name = pin_x + pin_y:NX_FLOAT64[] = [ ... ] + @original_name = pin_y + pin_z:NX_FLOAT64[] = [ ... ] + @original_name = pin_z + sx:NX_FLOAT64[] = [ ... ] + @original_name = sx + sy:NX_FLOAT64[] = [ ... ] + @original_name = sy + tcam:NX_FLOAT64[] = [ ... ] + @original_name = tcam + un19:NX_FLOAT64[] = [ ... ] + @original_name = un19 + un47:NX_FLOAT64[] = [ ... ] + @original_name = un47 + un48:NX_FLOAT64[] = [ ... ] + @original_name = un48 + un49:NX_FLOAT64[] = [ ... ] + @original_name = un49 + un5:NX_FLOAT64[] = [ ... ] + @original_name = un5 + un50:NX_FLOAT64[] = [ ... ] + @original_name = un50 + un51:NX_FLOAT64[] = [ ... ] + @original_name = un51 + un52:NX_FLOAT64[] = [ ... ] + @original_name = un52 + unused0:NX_FLOAT64[] = [ ... ] + @original_name = unused0 + unused30:NX_FLOAT64[] = [ ... ] + @original_name = unused30 + unused37:NX_FLOAT64[] = [ ... ] + @original_name = unused37 + unused42:NX_FLOAT64[] = [ ... ] + @original_name = unused42 + unused43:NX_FLOAT64[] = [ ... ] + @original_name = unused43 + unused7:NX_FLOAT64[] = [ ... ] + @original_name = unused7 + uslithorap:NX_FLOAT64[] = [ ... ] + @original_name = uslithorap + uslithorcen:NX_FLOAT64[] = [ ... ] + @original_name = uslithorcen + uslitverap:NX_FLOAT64[] = [ ... ] + @original_name = uslitverap + uslitvercen:NX_FLOAT64[] = [ ... ] + @original_name = uslitvercen \ No newline at end of file diff --git a/tests/data/structures/33id_spec_22_2D.txt b/tests/data/structures/33id_spec_22_2D.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd382d7df651fc8b78204298bf8ac1f52a6fd3b8 --- /dev/null +++ b/tests/data/structures/33id_spec_22_2D.txt @@ -0,0 +1,442 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\33id_spec_22_2D.hdf5 : NeXus data file + @SPEC_date = 2003-07-17T02:37:32 + @HDF5_Version = 1.8.15 + @SPEC_file = samplecheck_7_17_03 + @SPEC_epoch = 1058427452 + @SPEC_user = epix + @numpy_version = 1.10.4 + @spec2nexus_version = 2016.0615.1+7.g37731e9.dirty + @h5py_version = 2.5.0 + @SPEC_comments = psic User = epix + @SPEC_num_headers = 1 + @default = S22 + S22:NXentry + @NX_class = NXentry + @default = data + Q:NX_FLOAT64[3] = [ ... ] + @description = hkl at start of scan + T:NX_FLOAT64 = 1.0 + @units = s + @description = SPEC scan with constant counting time + command:NX_CHAR[39] = mesh eta 57 57.1 10 chi 90.9 91 10 1 + comments:NX_CHAR[4] = psic + counting_basis:NX_CHAR[37] = SPEC scan with constant counting time + date:NX_CHAR[19] = 2003-07-17T03:30:31 + definition:NX_CHAR[10] = NXspecdata + @description = NeXus application definition (status pending) + scan_number:NX_CHAR[2] = 22 + title:NX_CHAR[43] = 22 mesh eta 57 57.1 10 chi 90.9 91 10 1 + G:NXnote + @NX_class = NXnote + @description = SPEC geometry arrays, meanings defined by SPEC diffractometer support + G0:NX_FLOAT64[21] = [ ... ] + @spec_name = G0 + G1:NX_FLOAT64[32] = [ ... ] + @spec_name = G1 + G2:NX_FLOAT64 = 0.0 + @spec_name = G2 + MCA:NXnote + @NX_class = NXnote + @description = MCA metadata + first_saved:NX_INT32 = 1110 + last_saved:NX_INT32 = 1200 + number_saved:NX_INT32 = 1201 + reduction_coef:NX_FLOAT64 = 1.0 + data:NXdata + @NX_class = NXdata + @description = SPEC scan data + @signal = I0 + @axes = ['eta', 'chi'] + @eta_indices = 0 + @chi_indices = 0 + Epoch:NX_FLOAT64[11,11] = [ ... ] + @spec_name = Epoch + H:NX_FLOAT64[11,11] = [ ... ] + @spec_name = H + I0:NX_FLOAT64[11,11] = [ ... ] + @spec_name = I0 + I00:NX_FLOAT64[11,11] = [ ... ] + @spec_name = I00 + I0_1:NX_FLOAT64[11,11] = [ ... ] + @spec_name = I0_1 + K:NX_FLOAT64[11,11] = [ ... ] + @spec_name = K + Kalpha:NX_FLOAT64[11,11] = [ ... ] + @spec_name = Kalpha + L:NX_FLOAT64[11,11] = [ ... ] + @spec_name = L + _mca_:NX_FLOAT64[11,11,91] = [ ... ] + @units = counts + @axes = eta:chi:_mca_channel_ + @spec_name = _mca_ + _mca_channel_:NX_INT32[91] = [ ... ] + @units = channel + @spec_name = _mca_channel_ + chi:NX_FLOAT64[11] = [ ... ] + @spec_name = chi + elastic:NX_FLOAT64[11,11] = [ ... ] + @spec_name = elastic + eta:NX_FLOAT64[11] = [ ... ] + @spec_name = eta + harmonic:NX_FLOAT64[11,11] = [ ... ] + @spec_name = harmonic + seconds:NX_FLOAT64[11,11] = [ ... ] + @spec_name = seconds + signal:NX_FLOAT64[11,11] = [ ... ] + @spec_name = signal + signal2:NX_FLOAT64[11,11] = [ ... ] + @spec_name = signal2 + metadata:NXnote + @NX_class = NXnote + @description = SPEC metadata (UNICAT-style #H & #V lines) + COUPLE_ID_to_DCM:NX_FLOAT64 = 1.0 + @spec_name = COUPLE_ID_to_DCM + D3_Amps:NX_FLOAT64 = -1e-09 + @spec_name = D3_Amps + D3_VDC:NX_FLOAT64 = -1.0 + @spec_name = D3_VDC + D3_bias:NX_FLOAT64 = 0.0 + @spec_name = D3_bias + D3_dark:NX_FLOAT64 = 0.0 + @spec_name = D3_dark + D3_gain:NX_FLOAT64 = 1000000000.0 + @spec_name = D3_gain + D3_pos:NX_FLOAT64 = 1.0 + @spec_name = D3_pos + D3_suppr:NX_FLOAT64 = 1e-12 + @spec_name = D3_suppr + D3_time:NX_FLOAT64 = 7.0 + @spec_name = D3_time + DCM_energy:NX_FLOAT64 = 8.98008 + @spec_name = DCM_energy + DCM_lambda:NX_FLOAT64 = 1.38066 + @spec_name = DCM_lambda + DCM_mode:NX_FLOAT64 = 0.0 + @spec_name = DCM_mode + DCM_omega2:NX_FLOAT64 = 0.00581832 + @spec_name = DCM_omega2 + DCM_theta0:NX_FLOAT64 = -0.426683 + @spec_name = DCM_theta0 + DCM_thetaEnc:NX_FLOAT64 = 12.7183 + @spec_name = DCM_thetaEnc + FB_o2_on:NX_FLOAT64 = 0.0 + @spec_name = FB_o2_on + FB_o2_r:NX_FLOAT64 = -0.0172157 + @spec_name = FB_o2_r + FB_o2_sp:NX_FLOAT64 = 0.0 + @spec_name = FB_o2_sp + HSC1b:NX_FLOAT64 = 0.0 + @spec_name = HSC1b + HSC1h:NX_FLOAT64 = 0.0 + @spec_name = HSC1h + HSC1h0:NX_FLOAT64 = 0.0 + @spec_name = HSC1h0 + HSC1l:NX_FLOAT64 = 0.0 + @spec_name = HSC1l + HSC1r:NX_FLOAT64 = 0.0 + @spec_name = HSC1r + HSC1t:NX_FLOAT64 = 0.0 + @spec_name = HSC1t + HSC1v:NX_FLOAT64 = 0.0 + @spec_name = HSC1v + HSC1v0:NX_FLOAT64 = 0.0 + @spec_name = HSC1v0 + HSC2b:NX_FLOAT64 = 0.2 + @spec_name = HSC2b + HSC2h:NX_FLOAT64 = 0.4 + @spec_name = HSC2h + HSC2h0:NX_FLOAT64 = 0.15 + @spec_name = HSC2h0 + HSC2l:NX_FLOAT64 = 0.05 + @spec_name = HSC2l + HSC2r:NX_FLOAT64 = 0.35 + @spec_name = HSC2r + HSC2t:NX_FLOAT64 = 0.2 + @spec_name = HSC2t + HSC2v:NX_FLOAT64 = 0.4 + @spec_name = HSC2v + HSC2v0:NX_FLOAT64 = 0.0 + @spec_name = HSC2v0 + HSC3b:NX_FLOAT64 = 2.5 + @spec_name = HSC3b + HSC3h:NX_FLOAT64 = 5.0 + @spec_name = HSC3h + HSC3h0:NX_FLOAT64 = 0.0 + @spec_name = HSC3h0 + HSC3l:NX_FLOAT64 = 2.5 + @spec_name = HSC3l + HSC3r:NX_FLOAT64 = 2.5 + @spec_name = HSC3r + HSC3t:NX_FLOAT64 = 2.5 + @spec_name = HSC3t + HSC3v:NX_FLOAT64 = 5.0 + @spec_name = HSC3v + HSC3v0:NX_FLOAT64 = 0.0 + @spec_name = HSC3v0 + HSC4b:NX_FLOAT64 = 0.2 + @spec_name = HSC4b + HSC4h:NX_FLOAT64 = 0.4 + @spec_name = HSC4h + HSC4h0:NX_FLOAT64 = 0.0 + @spec_name = HSC4h0 + HSC4l:NX_FLOAT64 = 0.2 + @spec_name = HSC4l + HSC4r:NX_FLOAT64 = 0.2 + @spec_name = HSC4r + HSC4t:NX_FLOAT64 = 0.2 + @spec_name = HSC4t + HSC4v:NX_FLOAT64 = 0.4 + @spec_name = HSC4v + HSC4v0:NX_FLOAT64 = 0.0 + @spec_name = HSC4v0 + I00_Amps:NX_FLOAT64 = 5.13505e-05 + @spec_name = I00_Amps + I00_VDC:NX_FLOAT64 = 0.021978 + @spec_name = I00_VDC + I00_bias:NX_FLOAT64 = 0.0 + @spec_name = I00_bias + I00_dark:NX_FLOAT64 = 858.562 + @spec_name = I00_dark + I00_gain:NX_FLOAT64 = 428.0 + @spec_name = I00_gain + I00_suppr:NX_FLOAT64 = 2.0 + @spec_name = I00_suppr + I00_time:NX_FLOAT64 = 28.0 + @spec_name = I00_time + I0_Amps:NX_FLOAT64 = -1.71168e-05 + @spec_name = I0_Amps + I0_VDC:NX_FLOAT64 = -0.00732601 + @spec_name = I0_VDC + I0_bias:NX_FLOAT64 = 0.0 + @spec_name = I0_bias + I0_dark:NX_FLOAT64 = 1236.86 + @spec_name = I0_dark + I0_gain:NX_FLOAT64 = 428.0 + @spec_name = I0_gain + I0_suppr:NX_FLOAT64 = 2.0 + @spec_name = I0_suppr + I0_time:NX_FLOAT64 = 28.0 + @spec_name = I0_time + ID_E:NX_FLOAT64 = 9.03679 + @spec_name = ID_E + ID_E_Offset:NX_FLOAT64 = 0.06 + @spec_name = ID_E_Offset + ID_gap:NX_FLOAT64 = 20.1478 + @spec_name = ID_gap + ID_harmonic:NX_FLOAT64 = 1.0 + @spec_name = ID_harmonic + ID_taperE:NX_FLOAT64 = 0.000353813 + @spec_name = ID_taperE + ID_taperGap:NX_FLOAT64 = 0.000569699 + @spec_name = ID_taperGap + JFK540_i0:NX_FLOAT64 = 0.251526 + @spec_name = JFK540_i0 + JFK540_i1:NX_FLOAT64 = -0.026862 + @spec_name = JFK540_i1 + JFK540_i10:NX_FLOAT64 = -10.0 + @spec_name = JFK540_i10 + JFK540_i11:NX_FLOAT64 = -1.92186 + @spec_name = JFK540_i11 + JFK540_i12:NX_FLOAT64 = 0.002442 + @spec_name = JFK540_i12 + JFK540_i13:NX_FLOAT64 = -0.026862 + @spec_name = JFK540_i13 + JFK540_i14:NX_FLOAT64 = -0.031746 + @spec_name = JFK540_i14 + JFK540_i15:NX_FLOAT64 = 0.017094 + @spec_name = JFK540_i15 + JFK540_i2:NX_FLOAT64 = -0.026862 + @spec_name = JFK540_i2 + JFK540_i3:NX_FLOAT64 = -0.00732601 + @spec_name = JFK540_i3 + JFK540_i4:NX_FLOAT64 = 0.021978 + @spec_name = JFK540_i4 + JFK540_i5:NX_FLOAT64 = 0.017094 + @spec_name = JFK540_i5 + JFK540_i6:NX_FLOAT64 = -0.01221 + @spec_name = JFK540_i6 + JFK540_i7:NX_FLOAT64 = -0.002442 + @spec_name = JFK540_i7 + JFK540_i8:NX_FLOAT64 = 10.0 + @spec_name = JFK540_i8 + JFK540_i9:NX_FLOAT64 = 0.163614 + @spec_name = JFK540_i9 + JFK540_o0:NX_FLOAT64 = 4.585 + @spec_name = JFK540_o0 + JFK540_o1:NX_FLOAT64 = 5.0 + @spec_name = JFK540_o1 + JFK540_o2:NX_FLOAT64 = 6.0875 + @spec_name = JFK540_o2 + JFK540_o3:NX_FLOAT64 = 3.24 + @spec_name = JFK540_o3 + Mirr1_angle:NX_FLOAT64 = 3.99996 + @spec_name = Mirr1_angle + Mirr1_stripe:NX_FLOAT64 = 3.0 + @spec_name = Mirr1_stripe + Mirr1_y:NX_FLOAT64 = 19.22 + @spec_name = Mirr1_y + Mirr2_angle:NX_FLOAT64 = 3.90751 + @spec_name = Mirr2_angle + Mirr2_stripe:NX_FLOAT64 = 3.0 + @spec_name = Mirr2_stripe + Mirr2_y:NX_FLOAT64 = 30.2481 + @spec_name = Mirr2_y + PF4_bladeA1:NX_FLOAT64 = 1.0 + @spec_name = PF4_bladeA1 + PF4_bladeA2:NX_FLOAT64 = 1.0 + @spec_name = PF4_bladeA2 + PF4_bladeA3:NX_FLOAT64 = 1.0 + @spec_name = PF4_bladeA3 + PF4_bladeA4:NX_FLOAT64 = 0.0 + @spec_name = PF4_bladeA4 + PF4_bladeB1:NX_FLOAT64 = 0.0 + @spec_name = PF4_bladeB1 + PF4_bladeB2:NX_FLOAT64 = 0.0 + @spec_name = PF4_bladeB2 + PF4_bladeB3:NX_FLOAT64 = 0.0 + @spec_name = PF4_bladeB3 + PF4_bladeB4:NX_FLOAT64 = 0.0 + @spec_name = PF4_bladeB4 + PF4_thickAl:NX_FLOAT64 = 1.1177 + @spec_name = PF4_thickAl + PF4_thickTi:NX_FLOAT64 = 0.0 + @spec_name = PF4_thickTi + PF4_trans:NX_FLOAT64 = 2.54832e-05 + @spec_name = PF4_trans + PIN_Amps:NX_FLOAT64 = 3.99393e-05 + @spec_name = PIN_Amps + PIN_VDC:NX_FLOAT64 = 0.017094 + @spec_name = PIN_VDC + PIN_bias:NX_FLOAT64 = 0.0 + @spec_name = PIN_bias + PIN_dark:NX_FLOAT64 = 368.906 + @spec_name = PIN_dark + PIN_gain:NX_FLOAT64 = 428.0 + @spec_name = PIN_gain + PIN_suppr:NX_FLOAT64 = 2.0 + @spec_name = PIN_suppr + PIN_time:NX_FLOAT64 = 28.0 + @spec_name = PIN_time + SR_BPM_HA:NX_FLOAT64 = 0.0 + @spec_name = SR_BPM_HA + SR_BPM_HP:NX_FLOAT64 = 0.0 + @spec_name = SR_BPM_HP + SR_BPM_VA:NX_FLOAT64 = 0.0 + @spec_name = SR_BPM_VA + SR_BPM_VP:NX_FLOAT64 = 0.0 + @spec_name = SR_BPM_VP + SR_current:NX_FLOAT64 = 101.983 + @spec_name = SR_current + SR_fb:NX_FLOAT64 = 1.0 + @spec_name = SR_fb + SR_fbH:NX_FLOAT64 = 1.0 + @spec_name = SR_fbH + SR_fbV:NX_FLOAT64 = 1.0 + @spec_name = SR_fbV + SR_fill:NX_FLOAT64 = 56.0 + @spec_name = SR_fill + SR_mode:NX_FLOAT64 = 4.0 + @spec_name = SR_mode + SR_status:NX_FLOAT64 = 1.0 + @spec_name = SR_status + SR_topUp:NX_FLOAT64 = 1.0 + @spec_name = SR_topUp + barometer_mbar:NX_FLOAT64 = 992.552 + @spec_name = barometer_mbar + dark1:NX_FLOAT64 = 1000000.0 + @spec_name = dark1 + dark10:NX_FLOAT64 = 0.0 + @spec_name = dark10 + dark11:NX_FLOAT64 = 0.0 + @spec_name = dark11 + dark12:NX_FLOAT64 = 0.0 + @spec_name = dark12 + dark13:NX_FLOAT64 = 0.0 + @spec_name = dark13 + dark14:NX_FLOAT64 = 0.0 + @spec_name = dark14 + dark15:NX_FLOAT64 = 0.0 + @spec_name = dark15 + dark16:NX_FLOAT64 = 0.0 + @spec_name = dark16 + dark2:NX_FLOAT64 = 0.0 + @spec_name = dark2 + dark3:NX_FLOAT64 = 0.0208333 + @spec_name = dark3 + dark4:NX_FLOAT64 = 368.906 + @spec_name = dark4 + dark5:NX_FLOAT64 = 1236.86 + @spec_name = dark5 + dark6:NX_FLOAT64 = 858.562 + @spec_name = dark6 + dark7:NX_FLOAT64 = 0.0208333 + @spec_name = dark7 + dark8:NX_FLOAT64 = 1.0 + @spec_name = dark8 + dark9:NX_FLOAT64 = 0.0 + @spec_name = dark9 + darkCoTime:NX_FLOAT64 = 97.0 + @spec_name = darkCoTime + darkRing:NX_FLOAT64 = 100.0 + @spec_name = darkRing + darkToTime:NX_FLOAT64 = 96.0 + @spec_name = darkToTime + jfk_sclr_auto:NX_FLOAT64 = 1.0 + @spec_name = jfk_sclr_auto + positioners:NXnote + @NX_class = NXnote + @description = SPEC positioners (#P & #O lines) + DCM:NX_FLOAT64 = 12.72134 + @spec_name = DCM + a2Theta:NX_FLOAT64 = 0.0 + @spec_name = a2Theta + aTheta:NX_FLOAT64 = 0.0 + @spec_name = aTheta + ana_chi:NX_FLOAT64 = -2.5907501 + @spec_name = ana.chi + ana_theta:NX_FLOAT64 = -0.53981253 + @spec_name = ana.theta + chi:NX_FLOAT64 = 90.9395 + @spec_name = chi + delta:NX_FLOAT64 = 84.626698 + @spec_name = delta + eta:NX_FLOAT64 = 56.974 + @spec_name = eta + ion_ch_vert:NX_FLOAT64 = 33.200975 + @spec_name = ion_ch_vert + kEta:NX_FLOAT64 = 115.5105 + @spec_name = kEta + kappa:NX_FLOAT64 = 137.0569 + @spec_name = kappa + mr:NX_FLOAT64 = 10.24533 + @spec_name = mr + mu:NX_FLOAT64 = 0.0 + @spec_name = mu + nu:NX_FLOAT64 = 0.0020000001 + @spec_name = nu + phi:NX_FLOAT64 = 26.6505 + @spec_name = phi + sampleX:NX_FLOAT64 = 2.09105 + @spec_name = sampleX + sampleY:NX_FLOAT64 = 1.380002 + @spec_name = sampleY + sampleZ:NX_FLOAT64 = 25.205902 + @spec_name = sampleZ + slitmb:NX_FLOAT64 = 2.4003 + @spec_name = slitmb + slitml:NX_FLOAT64 = -2.9502166 + @spec_name = slitml + slitmr:NX_FLOAT64 = 85.187004 + @spec_name = slitmr + slitmt:NX_FLOAT64 = 1.4247812 + @spec_name = slitmt + slitwb:NX_FLOAT64 = 1.059723 + @spec_name = slitwb + slitwl:NX_FLOAT64 = 0.80000004 + @spec_name = slitwl + slitwr:NX_FLOAT64 = 0.72000003 + @spec_name = slitwr + slitwt:NX_FLOAT64 = 0.2802114 + @spec_name = slitwt + theta:NX_FLOAT64 = 7.0500874 + @spec_name = theta \ No newline at end of file diff --git a/tests/data/structures/compression.txt b/tests/data/structures/compression.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea965c5a73b1d3118bb7d2535aeda179ad10f333 --- /dev/null +++ b/tests/data/structures/compression.txt @@ -0,0 +1,20 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\compression.h5 + SASentry:NXentry + @NX_class = NXentry + SASdata:NXdata + @NX_class = NXdata + @Q_indices = 0,1 + @I_axes = Q,Q + I:float32[400,400] = [ ... ] + @IGORWaveType = 2 + @IGORWaveNote = DataFileName=eq-sans_corr-1.dat;DataFileType=EQSANS400x400;;DataFilePath=Prg:Users:ilavsky:Desktop:ORNL images:;;Processed on=Sun, May 25, 2014,11:40:04 AM;Units=Arbitrary;SampleThickness=1;SampleTransmission=1;CorrectionFactor=1;SampleMeasurementTime=1;EmptyMeasurementTime=1;BackgroundMeasTime=1;SampleI0=1;EmptyI0=1;CalibrationFormula=1; + @signal = I + @uncertainity = Idev + @axes = Q + Idev:float32[400,400] = [ ... ] + @IGORWaveType = 2 + @IGORWaveNote = DataFileName=eq-sans_corr-1.dat;DataFileType=EQSANS400x400;;DataFilePath=Prg:Users:ilavsky:Desktop:ORNL images:;;Processed on=Sun, May 25, 2014,11:40:04 AM;Units=Arbitrary;SampleThickness=1;SampleTransmission=1;CorrectionFactor=1;SampleMeasurementTime=1;EmptyMeasurementTime=1;BackgroundMeasTime=1;SampleI0=1;EmptyI0=1;CalibrationFormula=1; + @axes = Q + Q:float64[400,400] = [ ... ] + @IGORWaveType = 4 + @IGORWaveNote = Q calibration based on imported 2D data values. Geometry values are fake to make Nika work. Do not trust them.;BeamCenterX=199;BeamCenterY=199;PixelSizeX=1;PixelSizeY=1;HorizontalTilt=0;VerticalTilt=0;SampleToCCDDistance=1850.8;Wavelength=2; \ No newline at end of file diff --git a/tests/data/structures/example_mapping.txt b/tests/data/structures/example_mapping.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa99339a9d36972b766945508db9f8df779c3735 --- /dev/null +++ b/tests/data/structures/example_mapping.txt @@ -0,0 +1,120 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\example_mapping.nxs : NeXus data file + entry1:NXentry + @NX_class = NXentry + entry_identifier:NX_CHAR = [u'24737'] + experiment_identifier:NX_CHAR = [u'mt9396-1'] + @target = /entry1/experiment_identifier + program_name:NX_CHAR = [u'GDA 9.0.0'] + scan_command:NX_CHAR = [u'Mapping Scan'] + scan_identifier:NX_CHAR = [u'aa-bb-cc-dd-ee'] + title:NX_CHAR = [u'Example Mapping Scan'] + data:NXdata + @NX_class = NXdata + @signal = data + @axes = ['x_stage_set', 'y_stage_set', 't_stage_set', 'energy'] + @t_stage_indices = [0 1 2] + @x_stage_indices = [0 1 2] + @y_stage_indices = [0 1 2] + @energy_indices = [3] + @t_stage_set_indices = [2] + @x_stage_set_indices = [1] + @y_stage_set_indices = [0] + data --> ['/entry1/instrument/fluo/data'] + energy --> ['/entry1/instrument/fluo/energy'] + t_stage --> ['/entry1/sample/transformations/t_stage'] + t_stage_set --> ['/entry1/sample/t_stage_set'] + x_stage --> ['/entry1/sample/transformations/x_stage'] + x_stage_set --> ['/entry1/sample/x_stage_set'] + y_stage --> ['/entry1/sample/transformations/y_stage'] + y_stage_set --> ['/entry1/sample/y_stage_set'] + instrument:NXinstrument + @NX_class = NXinstrument + I0:NXmonitor + @NX_class = NXmonitor + data:NX_INT16[10,12,5] = [ ... ] + transformations --> ['/entry1/instrument/trans/transformations'] + It:NXmonitor + @NX_class = NXmonitor + data:NX_INT16[10,12,5] = [ ... ] + transformations --> ['/entry1/instrument/trans/transformations'] + diff:NXdetector + @NX_class = NXdetector + @signal = data + data:NX_INT16[10,12,5,6,8] = [ ... ] + @interpretation = image + transformations --> ['/entry1/instrument/fluo/transformations'] + x_pixel_size:NX_FLOAT64 = 1.0 + @units = um + y_pixel_size:NX_FLOAT64 = 1.0 + @units = um + fluo:NXdetector + @NX_class = NXdetector + @signal = data + @axes = ['.', '.', '.', 'energy'] + @energy_indices = 3 + data:NX_INT16[10,12,5,24] = [ ... ] + @interpretation = spectrum + @target = /entry1/instrument/fluo/data + energy:NX_INT16[24] = [ ... ] + @units = keV + @target = /entry1/instrument/fluo/energy + transformations:NXtransformations + @NX_class = NXtransformations + @target = /entry1/instrument/fluo/transformations + detector_arm:NX_INT16[10,12,5] = [ ... ] + @depends_on = . + @transformation_type = translation + trans:NXmonitor + @NX_class = NXmonitor + data:NX_INT16[10,12,5] = [ ... ] + transformations:NXtransformations + @NX_class = NXtransformations + @target = /entry1/instrument/trans/transformations + monitor_arm:NX_INT16[10,12,5] = [ ... ] + @depends_on = . + @transformation_type = translation + sample:NXsample + @NX_class = NXsample + @depends_on = t_stage + t_stage_set:NX_INT16[5] = [ ... ] + @target = /entry1/sample/t_stage_set + x_stage_set:NX_INT16[10] = [ ... ] + @target = /entry1/sample/x_stage_set + y_stage_set:NX_INT16[12] = [ ... ] + @target = /entry1/sample/y_stage_set + transformations:NXtransformations + @NX_class = NXtransformations + t_stage:NX_INT16[10,12,5] = [ ... ] + @depends_on = x_stage + @target = /entry1/sample/transformations/t_stage + @transformation_type = rotation + x_stage:NX_INT16[10,12,5] = [ ... ] + @depends_on = y_stage + @transformation_type = translation + @target = /entry1/sample/transformations/x_stage + y_stage:NX_INT16[10,12,5] = [ ... ] + @depends_on = . + @transformation_type = translation + @target = /entry1/sample/transformations/y_stage + user:NXuser + @NX_class = NXuser + @target = /entry1/user + username:NX_CHAR = [u'ssg37927'] + entry_micro:NXentry + @NX_class = NXentry + experiment_identifier --> ['/entry1/experiment_identifier'] + program_name:NX_CHAR = [u'Microscope Software 1.0.0'] + title:NX_CHAR = [u'White image of scan'] + user --> ['/entry1/user'] + data:NXdata + @NX_class = NXdata + @signal = data + @axes = ['.', 'image_x', 'image_y'] + @image_x_indices = 1 + @image_y_indices = 2 + data:NX_INT16[4,64,48] = [ ... ] + @interpretation = rgba-image + image_x:NX_INT16[64] = [ ... ] + @units = mm + image_y:NX_INT16[48] = [ ... ] + @units = mm diff --git a/tests/data/structures/writer_1_3.txt b/tests/data/structures/writer_1_3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d4178169a613b17dfc4ad81fdd77d1a08624daa --- /dev/null +++ b/tests/data/structures/writer_1_3.txt @@ -0,0 +1,12 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5 : NeXus data file + Scan:NXentry + @NX_class = NXentry + data:NXdata + @NX_class = NXdata + @signal = counts + @axes = two_theta + @two_theta_indices = 0 + counts:NX_INT32[31] = [ ... ] + @units = counts + two_theta:NX_FLOAT64[31] = [ ... ] + @units = degrees \ No newline at end of file diff --git a/tests/data/structures/writer_2_1.txt b/tests/data/structures/writer_2_1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a5a14ebf801cff57e92412371ad82a3bc2c2a0 --- /dev/null +++ b/tests/data/structures/writer_2_1.txt @@ -0,0 +1,20 @@ +C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_2_1.hdf5 : NeXus data file + entry:NXentry + @NX_class = NXentry + data:NXdata + @NX_class = NXdata + @signal = counts + @axes = two_theta + @two_theta_indices = 0 + counts --> /entry/instrument/detector/counts + two_theta --> /entry/instrument/detector/two_theta + instrument:NXinstrument + @NX_class = NXinstrument + detector:NXdetector + @NX_class = NXdetector + counts:NX_INT32[31] = [ ... ] + @units = counts + @target = /entry/instrument/detector/counts + two_theta:NX_FLOAT64[31] = [ ... ] + @units = degrees + @target = /entry/instrument/detector/two_theta \ No newline at end of file diff --git a/tests/data/validations/33id_spec_22_2D.txt b/tests/data/validations/33id_spec_22_2D.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ff01a66fc965c7de416f5af20ade43fc57ead04 --- /dev/null +++ b/tests/data/validations/33id_spec_22_2D.txt @@ -0,0 +1,820 @@ +======================================== ================================== ====== ================================================ +address validation status comment(s) +======================================== ================================== ====== ================================================ +/ * valid NeXus data file OK This file is valid by the NeXus standard. +/ @NX_class OK file root (assumed): NXroot +/ NXDL review TODO validate with NXroot specification (incomplete) +/@HDF5_Version validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@SPEC_comments validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@SPEC_date validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@SPEC_epoch validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@SPEC_file validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@SPEC_num_headers validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@SPEC_user validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/@default default plot group OK exists: S22 +/@default validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/@h5py_version validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/@numpy_version validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/@spec2nexus_version validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22 NXDL review TODO validate with NXentry specification (incomplete) +/S22@NX_class @NX_class OK known: NXentry +/S22@default default plot group OK exists: data +/S22@default validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/G validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/G NXDL review TODO validate with NXnote specification (incomplete) +/S22/G@NX_class @NX_class OK known: NXnote +/S22/G@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/G/G0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/G/G0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/G/G0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/G/G0@units field@units NOTE does not exist +/S22/G/G1 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/G/G1@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/G/G1@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/G/G1@units field@units NOTE does not exist +/S22/G/G2 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/G/G2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/G/G2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/G/G2@units field@units NOTE does not exist +/S22/MCA validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/MCA NXDL review TODO validate with NXnote specification (incomplete) +/S22/MCA@NX_class @NX_class OK known: NXnote +/S22/MCA@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/MCA/first_saved validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/MCA/first_saved@units field@units NOTE does not exist +/S22/MCA/last_saved validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/MCA/last_saved@units field@units NOTE does not exist +/S22/MCA/number_saved validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/MCA/number_saved@units field@units NOTE does not exist +/S22/MCA/reduction_coef validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/MCA/reduction_coef@units field@units NOTE does not exist +/S22/Q validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/Q@description NXentry@description NOTE attribute not defined in NXDL +/S22/Q@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/Q@units field@units NOTE does not exist +/S22/T validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/T@description NXentry@description NOTE attribute not defined in NXDL +/S22/T@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/T@units field@units OK value: s +/S22/T@units validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/command validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/comments validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/counting_basis validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/data /NXentry/NXdata@signal=I0 OK NeXus default plot v3 +/S22/data NXdata dimension scale(s) OK dimension scale(s) verified +/S22/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/data NXDL review TODO validate with NXdata specification (incomplete) +/S22/data@NX_class @NX_class OK known: NXdata +/S22/data@axes attribute data type NOTE variable length string array: ['eta', 'chi'] +/S22/data@axes NXdata@axes=chi OK axes dataset found: chi +/S22/data@axes NXdata@axes=eta OK axes dataset found: eta +/S22/data@chi_indices NXdata@chi_indices OK value = 0: ok +/S22/data@eta_indices NXdata@eta_indices OK value = 0: ok +/S22/data@signal NXdata group default plot v3 OK NXdata@signal = I0 +/S22/data/Epoch NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/H NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/I0 NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/I00 NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/I0_1 NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/K NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/Kalpha NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/L NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/_mca_ NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/_mca_channel_ NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/chi NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/elastic NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/eta NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/harmonic NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/seconds NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/signal NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/data/signal2 NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/S22/date validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/definition @nameType OK name is specified +/S22/definition NXDL data type: NXentry/definition OK str : NX_CHAR +/S22/definition validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/definition@description NXentry@description NOTE attribute not defined in NXDL +/S22/definition@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata NXDL review TODO validate with NXnote specification (incomplete) +/S22/metadata@NX_class @NX_class OK known: NXnote +/S22/metadata@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/COUPLE_ID_to_DCM validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/COUPLE_ID_to_DCM@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/COUPLE_ID_to_DCM@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/COUPLE_ID_to_DCM@units field@units NOTE does not exist +/S22/metadata/D3_Amps validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_Amps@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_Amps@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_Amps@units field@units NOTE does not exist +/S22/metadata/D3_VDC validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_VDC@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_VDC@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_VDC@units field@units NOTE does not exist +/S22/metadata/D3_bias validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_bias@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_bias@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_bias@units field@units NOTE does not exist +/S22/metadata/D3_dark validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_dark@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_dark@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_dark@units field@units NOTE does not exist +/S22/metadata/D3_gain validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_gain@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_gain@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_gain@units field@units NOTE does not exist +/S22/metadata/D3_pos validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_pos@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_pos@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_pos@units field@units NOTE does not exist +/S22/metadata/D3_suppr validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_suppr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_suppr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_suppr@units field@units NOTE does not exist +/S22/metadata/D3_time validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/D3_time@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/D3_time@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/D3_time@units field@units NOTE does not exist +/S22/metadata/DCM_energy validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/DCM_energy@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/DCM_energy@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/DCM_energy@units field@units NOTE does not exist +/S22/metadata/DCM_lambda validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/DCM_lambda@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/DCM_lambda@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/DCM_lambda@units field@units NOTE does not exist +/S22/metadata/DCM_mode validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/DCM_mode@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/DCM_mode@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/DCM_mode@units field@units NOTE does not exist +/S22/metadata/DCM_omega2 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/DCM_omega2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/DCM_omega2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/DCM_omega2@units field@units NOTE does not exist +/S22/metadata/DCM_theta0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/DCM_theta0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/DCM_theta0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/DCM_theta0@units field@units NOTE does not exist +/S22/metadata/DCM_thetaEnc validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/DCM_thetaEnc@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/DCM_thetaEnc@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/DCM_thetaEnc@units field@units NOTE does not exist +/S22/metadata/FB_o2_on validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/FB_o2_on@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/FB_o2_on@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/FB_o2_on@units field@units NOTE does not exist +/S22/metadata/FB_o2_r validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/FB_o2_r@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/FB_o2_r@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/FB_o2_r@units field@units NOTE does not exist +/S22/metadata/FB_o2_sp validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/FB_o2_sp@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/FB_o2_sp@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/FB_o2_sp@units field@units NOTE does not exist +/S22/metadata/HSC1b validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1b@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1b@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1b@units field@units NOTE does not exist +/S22/metadata/HSC1h validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1h@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1h@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1h@units field@units NOTE does not exist +/S22/metadata/HSC1h0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1h0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1h0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1h0@units field@units NOTE does not exist +/S22/metadata/HSC1l validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1l@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1l@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1l@units field@units NOTE does not exist +/S22/metadata/HSC1r validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1r@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1r@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1r@units field@units NOTE does not exist +/S22/metadata/HSC1t validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1t@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1t@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1t@units field@units NOTE does not exist +/S22/metadata/HSC1v validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1v@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1v@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1v@units field@units NOTE does not exist +/S22/metadata/HSC1v0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC1v0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC1v0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC1v0@units field@units NOTE does not exist +/S22/metadata/HSC2b validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2b@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2b@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2b@units field@units NOTE does not exist +/S22/metadata/HSC2h validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2h@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2h@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2h@units field@units NOTE does not exist +/S22/metadata/HSC2h0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2h0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2h0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2h0@units field@units NOTE does not exist +/S22/metadata/HSC2l validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2l@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2l@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2l@units field@units NOTE does not exist +/S22/metadata/HSC2r validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2r@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2r@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2r@units field@units NOTE does not exist +/S22/metadata/HSC2t validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2t@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2t@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2t@units field@units NOTE does not exist +/S22/metadata/HSC2v validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2v@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2v@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2v@units field@units NOTE does not exist +/S22/metadata/HSC2v0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC2v0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC2v0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC2v0@units field@units NOTE does not exist +/S22/metadata/HSC3b validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3b@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3b@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3b@units field@units NOTE does not exist +/S22/metadata/HSC3h validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3h@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3h@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3h@units field@units NOTE does not exist +/S22/metadata/HSC3h0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3h0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3h0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3h0@units field@units NOTE does not exist +/S22/metadata/HSC3l validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3l@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3l@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3l@units field@units NOTE does not exist +/S22/metadata/HSC3r validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3r@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3r@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3r@units field@units NOTE does not exist +/S22/metadata/HSC3t validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3t@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3t@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3t@units field@units NOTE does not exist +/S22/metadata/HSC3v validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3v@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3v@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3v@units field@units NOTE does not exist +/S22/metadata/HSC3v0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC3v0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC3v0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC3v0@units field@units NOTE does not exist +/S22/metadata/HSC4b validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4b@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4b@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4b@units field@units NOTE does not exist +/S22/metadata/HSC4h validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4h@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4h@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4h@units field@units NOTE does not exist +/S22/metadata/HSC4h0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4h0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4h0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4h0@units field@units NOTE does not exist +/S22/metadata/HSC4l validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4l@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4l@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4l@units field@units NOTE does not exist +/S22/metadata/HSC4r validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4r@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4r@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4r@units field@units NOTE does not exist +/S22/metadata/HSC4t validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4t@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4t@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4t@units field@units NOTE does not exist +/S22/metadata/HSC4v validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4v@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4v@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4v@units field@units NOTE does not exist +/S22/metadata/HSC4v0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/HSC4v0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/HSC4v0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/HSC4v0@units field@units NOTE does not exist +/S22/metadata/I00_Amps validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_Amps@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_Amps@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_Amps@units field@units NOTE does not exist +/S22/metadata/I00_VDC validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_VDC@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_VDC@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_VDC@units field@units NOTE does not exist +/S22/metadata/I00_bias validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_bias@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_bias@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_bias@units field@units NOTE does not exist +/S22/metadata/I00_dark validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_dark@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_dark@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_dark@units field@units NOTE does not exist +/S22/metadata/I00_gain validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_gain@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_gain@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_gain@units field@units NOTE does not exist +/S22/metadata/I00_suppr validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_suppr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_suppr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_suppr@units field@units NOTE does not exist +/S22/metadata/I00_time validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I00_time@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I00_time@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I00_time@units field@units NOTE does not exist +/S22/metadata/I0_Amps validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_Amps@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_Amps@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_Amps@units field@units NOTE does not exist +/S22/metadata/I0_VDC validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_VDC@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_VDC@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_VDC@units field@units NOTE does not exist +/S22/metadata/I0_bias validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_bias@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_bias@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_bias@units field@units NOTE does not exist +/S22/metadata/I0_dark validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_dark@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_dark@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_dark@units field@units NOTE does not exist +/S22/metadata/I0_gain validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_gain@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_gain@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_gain@units field@units NOTE does not exist +/S22/metadata/I0_suppr validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_suppr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_suppr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_suppr@units field@units NOTE does not exist +/S22/metadata/I0_time validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/I0_time@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/I0_time@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/I0_time@units field@units NOTE does not exist +/S22/metadata/ID_E validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/ID_E@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/ID_E@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/ID_E@units field@units NOTE does not exist +/S22/metadata/ID_E_Offset validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/ID_E_Offset@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/ID_E_Offset@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/ID_E_Offset@units field@units NOTE does not exist +/S22/metadata/ID_gap validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/ID_gap@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/ID_gap@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/ID_gap@units field@units NOTE does not exist +/S22/metadata/ID_harmonic validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/ID_harmonic@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/ID_harmonic@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/ID_harmonic@units field@units NOTE does not exist +/S22/metadata/ID_taperE validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/ID_taperE@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/ID_taperE@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/ID_taperE@units field@units NOTE does not exist +/S22/metadata/ID_taperGap validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/ID_taperGap@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/ID_taperGap@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/ID_taperGap@units field@units NOTE does not exist +/S22/metadata/JFK540_i0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i0@units field@units NOTE does not exist +/S22/metadata/JFK540_i1 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i1@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i1@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i1@units field@units NOTE does not exist +/S22/metadata/JFK540_i10 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i10@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i10@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i10@units field@units NOTE does not exist +/S22/metadata/JFK540_i11 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i11@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i11@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i11@units field@units NOTE does not exist +/S22/metadata/JFK540_i12 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i12@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i12@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i12@units field@units NOTE does not exist +/S22/metadata/JFK540_i13 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i13@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i13@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i13@units field@units NOTE does not exist +/S22/metadata/JFK540_i14 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i14@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i14@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i14@units field@units NOTE does not exist +/S22/metadata/JFK540_i15 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i15@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i15@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i15@units field@units NOTE does not exist +/S22/metadata/JFK540_i2 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i2@units field@units NOTE does not exist +/S22/metadata/JFK540_i3 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i3@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i3@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i3@units field@units NOTE does not exist +/S22/metadata/JFK540_i4 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i4@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i4@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i4@units field@units NOTE does not exist +/S22/metadata/JFK540_i5 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i5@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i5@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i5@units field@units NOTE does not exist +/S22/metadata/JFK540_i6 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i6@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i6@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i6@units field@units NOTE does not exist +/S22/metadata/JFK540_i7 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i7@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i7@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i7@units field@units NOTE does not exist +/S22/metadata/JFK540_i8 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i8@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i8@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i8@units field@units NOTE does not exist +/S22/metadata/JFK540_i9 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_i9@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_i9@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_i9@units field@units NOTE does not exist +/S22/metadata/JFK540_o0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_o0@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_o0@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_o0@units field@units NOTE does not exist +/S22/metadata/JFK540_o1 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_o1@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_o1@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_o1@units field@units NOTE does not exist +/S22/metadata/JFK540_o2 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_o2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_o2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_o2@units field@units NOTE does not exist +/S22/metadata/JFK540_o3 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/JFK540_o3@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/JFK540_o3@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/JFK540_o3@units field@units NOTE does not exist +/S22/metadata/Mirr1_angle validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/Mirr1_angle@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/Mirr1_angle@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/Mirr1_angle@units field@units NOTE does not exist +/S22/metadata/Mirr1_stripe validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/Mirr1_stripe@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/Mirr1_stripe@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/Mirr1_stripe@units field@units NOTE does not exist +/S22/metadata/Mirr1_y validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/Mirr1_y@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/Mirr1_y@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/Mirr1_y@units field@units NOTE does not exist +/S22/metadata/Mirr2_angle validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/Mirr2_angle@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/Mirr2_angle@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/Mirr2_angle@units field@units NOTE does not exist +/S22/metadata/Mirr2_stripe validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/Mirr2_stripe@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/Mirr2_stripe@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/Mirr2_stripe@units field@units NOTE does not exist +/S22/metadata/Mirr2_y validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/Mirr2_y@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/Mirr2_y@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/Mirr2_y@units field@units NOTE does not exist +/S22/metadata/PF4_bladeA1 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeA1@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeA1@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeA1@units field@units NOTE does not exist +/S22/metadata/PF4_bladeA2 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeA2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeA2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeA2@units field@units NOTE does not exist +/S22/metadata/PF4_bladeA3 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeA3@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeA3@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeA3@units field@units NOTE does not exist +/S22/metadata/PF4_bladeA4 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeA4@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeA4@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeA4@units field@units NOTE does not exist +/S22/metadata/PF4_bladeB1 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeB1@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeB1@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeB1@units field@units NOTE does not exist +/S22/metadata/PF4_bladeB2 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeB2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeB2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeB2@units field@units NOTE does not exist +/S22/metadata/PF4_bladeB3 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeB3@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeB3@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeB3@units field@units NOTE does not exist +/S22/metadata/PF4_bladeB4 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_bladeB4@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_bladeB4@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_bladeB4@units field@units NOTE does not exist +/S22/metadata/PF4_thickAl validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_thickAl@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_thickAl@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_thickAl@units field@units NOTE does not exist +/S22/metadata/PF4_thickTi validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_thickTi@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_thickTi@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_thickTi@units field@units NOTE does not exist +/S22/metadata/PF4_trans validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PF4_trans@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PF4_trans@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PF4_trans@units field@units NOTE does not exist +/S22/metadata/PIN_Amps validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_Amps@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_Amps@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_Amps@units field@units NOTE does not exist +/S22/metadata/PIN_VDC validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_VDC@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_VDC@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_VDC@units field@units NOTE does not exist +/S22/metadata/PIN_bias validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_bias@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_bias@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_bias@units field@units NOTE does not exist +/S22/metadata/PIN_dark validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_dark@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_dark@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_dark@units field@units NOTE does not exist +/S22/metadata/PIN_gain validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_gain@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_gain@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_gain@units field@units NOTE does not exist +/S22/metadata/PIN_suppr validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_suppr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_suppr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_suppr@units field@units NOTE does not exist +/S22/metadata/PIN_time validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/PIN_time@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/PIN_time@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/PIN_time@units field@units NOTE does not exist +/S22/metadata/SR_BPM_HA validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_BPM_HA@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_BPM_HA@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_BPM_HA@units field@units NOTE does not exist +/S22/metadata/SR_BPM_HP validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_BPM_HP@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_BPM_HP@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_BPM_HP@units field@units NOTE does not exist +/S22/metadata/SR_BPM_VA validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_BPM_VA@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_BPM_VA@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_BPM_VA@units field@units NOTE does not exist +/S22/metadata/SR_BPM_VP validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_BPM_VP@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_BPM_VP@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_BPM_VP@units field@units NOTE does not exist +/S22/metadata/SR_current validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_current@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_current@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_current@units field@units NOTE does not exist +/S22/metadata/SR_fb validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_fb@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_fb@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_fb@units field@units NOTE does not exist +/S22/metadata/SR_fbH validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_fbH@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_fbH@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_fbH@units field@units NOTE does not exist +/S22/metadata/SR_fbV validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_fbV@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_fbV@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_fbV@units field@units NOTE does not exist +/S22/metadata/SR_fill validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_fill@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_fill@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_fill@units field@units NOTE does not exist +/S22/metadata/SR_mode validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_mode@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_mode@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_mode@units field@units NOTE does not exist +/S22/metadata/SR_status validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_status@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_status@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_status@units field@units NOTE does not exist +/S22/metadata/SR_topUp validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/SR_topUp@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/SR_topUp@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/SR_topUp@units field@units NOTE does not exist +/S22/metadata/barometer_mbar validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/barometer_mbar@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/barometer_mbar@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/barometer_mbar@units field@units NOTE does not exist +/S22/metadata/dark1 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark1@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark1@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark1@units field@units NOTE does not exist +/S22/metadata/dark10 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark10@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark10@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark10@units field@units NOTE does not exist +/S22/metadata/dark11 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark11@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark11@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark11@units field@units NOTE does not exist +/S22/metadata/dark12 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark12@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark12@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark12@units field@units NOTE does not exist +/S22/metadata/dark13 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark13@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark13@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark13@units field@units NOTE does not exist +/S22/metadata/dark14 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark14@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark14@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark14@units field@units NOTE does not exist +/S22/metadata/dark15 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark15@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark15@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark15@units field@units NOTE does not exist +/S22/metadata/dark16 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark16@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark16@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark16@units field@units NOTE does not exist +/S22/metadata/dark2 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark2@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark2@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark2@units field@units NOTE does not exist +/S22/metadata/dark3 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark3@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark3@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark3@units field@units NOTE does not exist +/S22/metadata/dark4 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark4@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark4@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark4@units field@units NOTE does not exist +/S22/metadata/dark5 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark5@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark5@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark5@units field@units NOTE does not exist +/S22/metadata/dark6 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark6@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark6@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark6@units field@units NOTE does not exist +/S22/metadata/dark7 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark7@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark7@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark7@units field@units NOTE does not exist +/S22/metadata/dark8 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark8@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark8@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark8@units field@units NOTE does not exist +/S22/metadata/dark9 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark9@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/dark9@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/dark9@units field@units NOTE does not exist +/S22/metadata/darkCoTime validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/darkCoTime@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/darkCoTime@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/darkCoTime@units field@units NOTE does not exist +/S22/metadata/darkRing validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/darkRing@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/darkRing@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/darkRing@units field@units NOTE does not exist +/S22/metadata/darkToTime validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/metadata/darkToTime@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/darkToTime@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/darkToTime@units field@units NOTE does not exist +/S22/metadata/jfk_sclr_auto validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/jfk_sclr_auto@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/metadata/jfk_sclr_auto@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/metadata/jfk_sclr_auto@units field@units NOTE does not exist +/S22/positioners validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners NXDL review TODO validate with NXnote specification (incomplete) +/S22/positioners@NX_class @NX_class OK known: NXnote +/S22/positioners@description validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/DCM validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/DCM@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/DCM@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/DCM@units field@units NOTE does not exist +/S22/positioners/a2Theta validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/a2Theta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/a2Theta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/a2Theta@units field@units NOTE does not exist +/S22/positioners/aTheta validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/aTheta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/aTheta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/aTheta@units field@units NOTE does not exist +/S22/positioners/ana_chi validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/ana_chi@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/ana_chi@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/ana_chi@units field@units NOTE does not exist +/S22/positioners/ana_theta validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/ana_theta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/ana_theta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/ana_theta@units field@units NOTE does not exist +/S22/positioners/chi validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/chi@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/chi@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/chi@units field@units NOTE does not exist +/S22/positioners/delta validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/delta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/delta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/delta@units field@units NOTE does not exist +/S22/positioners/eta validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/eta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/eta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/eta@units field@units NOTE does not exist +/S22/positioners/ion_ch_vert validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/ion_ch_vert@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/ion_ch_vert@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/ion_ch_vert@units field@units NOTE does not exist +/S22/positioners/kEta validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/kEta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/kEta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/kEta@units field@units NOTE does not exist +/S22/positioners/kappa validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/kappa@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/kappa@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/kappa@units field@units NOTE does not exist +/S22/positioners/mr validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/mr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/mr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/mr@units field@units NOTE does not exist +/S22/positioners/mu validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/mu@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/mu@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/mu@units field@units NOTE does not exist +/S22/positioners/nu validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/nu@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/nu@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/nu@units field@units NOTE does not exist +/S22/positioners/phi validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/phi@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/phi@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/phi@units field@units NOTE does not exist +/S22/positioners/sampleX validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/sampleX@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/sampleX@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/sampleX@units field@units NOTE does not exist +/S22/positioners/sampleY validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/sampleY@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/sampleY@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/sampleY@units field@units NOTE does not exist +/S22/positioners/sampleZ validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/S22/positioners/sampleZ@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/sampleZ@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/sampleZ@units field@units NOTE does not exist +/S22/positioners/slitmb validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitmb@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitmb@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitmb@units field@units NOTE does not exist +/S22/positioners/slitml validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitml@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitml@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitml@units field@units NOTE does not exist +/S22/positioners/slitmr validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitmr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitmr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitmr@units field@units NOTE does not exist +/S22/positioners/slitmt validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitmt@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitmt@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitmt@units field@units NOTE does not exist +/S22/positioners/slitwb validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwb@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitwb@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwb@units field@units NOTE does not exist +/S22/positioners/slitwl validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwl@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitwl@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwl@units field@units NOTE does not exist +/S22/positioners/slitwr validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwr@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitwr@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwr@units field@units NOTE does not exist +/S22/positioners/slitwt validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwt@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/slitwt@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/slitwt@units field@units NOTE does not exist +/S22/positioners/theta validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/theta@spec_name NXnote@spec_name NOTE attribute not defined in NXDL +/S22/positioners/theta@spec_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/positioners/theta@units field@units NOTE does not exist +/S22/scan_number validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/S22/title @nameType OK name is specified +/S22/title NXDL data type: NXentry/title OK str : NX_CHAR +/S22/title validItemName-strict OK strict re: [a-z_][a-z0-9_]* +======================================== ================================== ====== ================================================ + +======= ===== =========================================================== +status count description +======= ===== =========================================================== +OK 264 meets NeXus specification +NOTE 514 does not meet NeXus specification, but acceptable +WARN 0 does not meet NeXus specification, not generally acceptable +ERROR 0 violates NeXus specification +TODO 7 validation not implemented yet +UNUSED 17 optional NeXus item not used in data file +COMMENT 0 comment from the punx source code +-- -- -- +TOTAL 802 -- +======= ===== =========================================================== diff --git a/tests/data/validations/compression.txt b/tests/data/validations/compression.txt new file mode 100644 index 0000000000000000000000000000000000000000..3130e679d8ee0c34a0e78c9f6a729c6ee1906ebe --- /dev/null +++ b/tests/data/validations/compression.txt @@ -0,0 +1,37 @@ +========================== ============================ ====== ==================================================== +address validation status comment(s) +========================== ============================ ====== ==================================================== +/ * valid NeXus data file OK This file is valid by the NeXus standard. +/ @NX_class OK file root (assumed): NXroot +/ NXDL review TODO validate with NXroot specification (incomplete) +/NXentry/NXdata/field NeXus default plot WARN /NXentry/NXdata/field exists but no signal indicated +/SASentry validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/SASentry NXDL review TODO validate with NXentry specification (incomplete) +/SASentry@NX_class attribute data type NOTE variable length string: ['NXentry'] +/SASentry@NX_class @NX_class OK known: NXentry +/SASentry/SASdata validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/SASentry/SASdata NXDL review TODO validate with NXdata specification (incomplete) +/SASentry/SASdata NXdata group default plot v1 WARN NXdata group does not define a default plot using v1 +/SASentry/SASdata@NX_class attribute data type NOTE variable length string: ['NXdata'] +/SASentry/SASdata@NX_class @NX_class OK known: NXdata +/SASentry/SASdata/I NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/SASentry/SASdata/I@signal NXdata group default plot v1 ERROR expected @signal=1, found: I +/SASentry/SASdata/I@signal NeXus default plot v2 ERROR expected @signal=1, found: I +/SASentry/SASdata/I@signal attribute data type NOTE variable length string: ['I'] +/SASentry/SASdata/Idev NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/SASentry/SASdata/Q NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +========================== ============================ ====== ==================================================== + +======= ===== =========================================================== +status count description +======= ===== =========================================================== +OK 4 meets NeXus specification +NOTE 5 does not meet NeXus specification, but acceptable +WARN 2 does not meet NeXus specification, not generally acceptable +ERROR 2 violates NeXus specification +TODO 3 validation not implemented yet +UNUSED 3 optional NeXus item not used in data file +COMMENT 0 comment from the punx source code +-- -- -- +TOTAL 19 -- +======= ===== =========================================================== diff --git a/tests/data/validations/example_mapping.txt b/tests/data/validations/example_mapping.txt new file mode 100644 index 0000000000000000000000000000000000000000..750c126dd1de2eeef5691c8aad0631eac2418dbd --- /dev/null +++ b/tests/data/validations/example_mapping.txt @@ -0,0 +1,250 @@ +==================================================== =================================================== ====== ===================================================================================== +address validation status comment(s) +==================================================== =================================================== ====== ===================================================================================== +/ * valid NeXus data file OK This file is valid by the NeXus standard. +/ @NX_class OK file root (assumed): NXroot +/ NXDL review TODO validate with NXroot specification (incomplete) +/entry1 validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1 NXDL review TODO validate with NXentry specification (incomplete) +/entry1@NX_class attribute data type NOTE variable length string: ['NXentry'] +/entry1@NX_class @NX_class OK known: NXentry +/entry1/data /NXentry/NXdata@signal=data NOTE NeXus default plot v3 +/entry1/data NXdata dimension scale(s) OK dimension scale(s) verified +/entry1/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/data NXDL review TODO validate with NXdata specification (incomplete) +/entry1/data@NX_class attribute data type NOTE variable length string: ['NXdata'] +/entry1/data@NX_class @NX_class OK known: NXdata +/entry1/data@axes attribute data type NOTE variable length string array: ['x_stage_set', 'y_stage_set', 't_stage_set', 'energy'] +/entry1/data@axes NXdata@axes=energy OK axes dataset found: energy +/entry1/data@axes NXdata@axes=t_stage_set OK axes dataset found: t_stage_set +/entry1/data@axes NXdata@axes=x_stage_set OK axes dataset found: x_stage_set +/entry1/data@axes NXdata@axes=y_stage_set OK axes dataset found: y_stage_set +/entry1/data@energy_indices NXdata@energy_indices OK value = 3: ok +/entry1/data@signal attribute data type NOTE variable length string: ['data'] +/entry1/data@signal NXdata group default plot v3 OK NXdata@signal = data +/entry1/data@t_stage_set_indices NXdata@t_stage_set_indices OK value = 2: ok +/entry1/data@x_stage_set_indices NXdata@x_stage_set_indices OK value = 1: ok +/entry1/data@y_stage_set_indices NXdata@y_stage_set_indices OK value = 0: ok +/entry1/data/data NXDL data type: NXdata/data OK int16 : NX_NUMBER +/entry1/data/data validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/data@interpretation NXDL attribute enum: NXdata/data@interpretation OK spectrum: expected +/entry1/data/data@interpretation NXDL attribute type: NXdata/data@interpretation OK str : NX_CHAR +/entry1/data/data@target attribute data type NOTE variable length string: ['/entry1/instrument/fluo/data'] +/entry1/data/data@target link target exists OK /entry1/instrument/fluo/data +/entry1/data/energy validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/energy@target attribute data type NOTE variable length string: ['/entry1/instrument/fluo/energy'] +/entry1/data/energy@target link target exists OK /entry1/instrument/fluo/energy +/entry1/data/t_stage validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/t_stage@target attribute data type NOTE variable length string: ['/entry1/sample/transformations/t_stage'] +/entry1/data/t_stage@target link target exists OK /entry1/sample/transformations/t_stage +/entry1/data/t_stage_set validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/t_stage_set@target attribute data type NOTE variable length string: ['/entry1/sample/t_stage_set'] +/entry1/data/t_stage_set@target link target exists OK /entry1/sample/t_stage_set +/entry1/data/x_stage validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/x_stage@target attribute data type NOTE variable length string: ['/entry1/sample/transformations/x_stage'] +/entry1/data/x_stage@target link target exists OK /entry1/sample/transformations/x_stage +/entry1/data/x_stage_set validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/x_stage_set@target attribute data type NOTE variable length string: ['/entry1/sample/x_stage_set'] +/entry1/data/x_stage_set@target link target exists OK /entry1/sample/x_stage_set +/entry1/data/y_stage validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/y_stage@target attribute data type NOTE variable length string: ['/entry1/sample/transformations/y_stage'] +/entry1/data/y_stage@target link target exists OK /entry1/sample/transformations/y_stage +/entry1/data/y_stage_set validTargetName TODO TODO: validate full_name against validTargetName +/entry1/data/y_stage_set@target attribute data type NOTE variable length string: ['/entry1/sample/y_stage_set'] +/entry1/data/y_stage_set@target link target exists OK /entry1/sample/y_stage_set +/entry1/entry_identifier @nameType OK name is specified +/entry1/entry_identifier NXDL data type: NXentry/entry_identifier OK str : NX_CHAR +/entry1/entry_identifier validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/experiment_identifier @nameType OK name is specified +/entry1/experiment_identifier NXDL data type: NXentry/experiment_identifier OK str : NX_CHAR +/entry1/experiment_identifier validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/experiment_identifier@target attribute data type NOTE variable length string: ['/entry1/experiment_identifier'] +/entry1/experiment_identifier@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument NXDL review TODO validate with NXinstrument specification (incomplete) +/entry1/instrument@NX_class attribute data type NOTE variable length string: ['NXinstrument'] +/entry1/instrument@NX_class @NX_class OK known: NXinstrument +/entry1/instrument/I0 validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/entry1/instrument/I0 NXDL review TODO validate with NXmonitor specification (incomplete) +/entry1/instrument/I0@NX_class attribute data type NOTE variable length string: ['NXmonitor'] +/entry1/instrument/I0@NX_class @NX_class OK known: NXmonitor +/entry1/instrument/I0/data @nameType OK name is specified +/entry1/instrument/I0/data NXDL data type: NXmonitor/data OK int16 : NX_NUMBER +/entry1/instrument/I0/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/I0/data@units field@units NOTE does not exist +/entry1/instrument/I0/transformations validTargetName TODO TODO: validate full_name against validTargetName +/entry1/instrument/I0/transformations@target attribute data type NOTE variable length string: ['/entry1/instrument/trans/transformations'] +/entry1/instrument/I0/transformations@target link target exists OK /entry1/instrument/trans/transformations +/entry1/instrument/It validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/entry1/instrument/It NXDL review TODO validate with NXmonitor specification (incomplete) +/entry1/instrument/It@NX_class attribute data type NOTE variable length string: ['NXmonitor'] +/entry1/instrument/It@NX_class @NX_class OK known: NXmonitor +/entry1/instrument/It/data @nameType OK name is specified +/entry1/instrument/It/data NXDL data type: NXmonitor/data OK int16 : NX_NUMBER +/entry1/instrument/It/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/It/data@units field@units NOTE does not exist +/entry1/instrument/It/transformations validTargetName TODO TODO: validate full_name against validTargetName +/entry1/instrument/It/transformations@target attribute data type NOTE variable length string: ['/entry1/instrument/trans/transformations'] +/entry1/instrument/It/transformations@target link target exists OK /entry1/instrument/trans/transformations +/entry1/instrument/diff validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff NXDL review TODO validate with NXdetector specification (incomplete) +/entry1/instrument/diff@NX_class attribute data type NOTE variable length string: ['NXdetector'] +/entry1/instrument/diff@NX_class @NX_class OK known: NXdetector +/entry1/instrument/diff@signal validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff/data @nameType OK name is specified +/entry1/instrument/diff/data NXDL data type: NXdetector/data OK int16 : NX_NUMBER +/entry1/instrument/diff/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff/data@interpretation attribute data type NOTE variable length string: ['image'] +/entry1/instrument/diff/data@interpretation NXDL attribute enum: NXdetector/data@interpretation OK image: expected +/entry1/instrument/diff/data@interpretation NXDL attribute type: NXdetector/data@interpretation OK str : NX_CHAR +/entry1/instrument/diff/data@interpretation enumeration: @interpretation OK value=image :recognized +/entry1/instrument/diff/data@interpretation validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff/data@units field@units NOTE does not exist +/entry1/instrument/diff/transformations validTargetName TODO TODO: validate full_name against validTargetName +/entry1/instrument/diff/transformations@target attribute data type NOTE variable length string: ['/entry1/instrument/fluo/transformations'] +/entry1/instrument/diff/transformations@target link target exists OK /entry1/instrument/fluo/transformations +/entry1/instrument/diff/x_pixel_size @nameType OK name is specified +/entry1/instrument/diff/x_pixel_size NXDL data type: NXdetector/x_pixel_size OK float64 : NX_FLOAT +/entry1/instrument/diff/x_pixel_size validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff/x_pixel_size@units attribute data type NOTE variable length string: ['um'] +/entry1/instrument/diff/x_pixel_size@units field@units OK value: um +/entry1/instrument/diff/x_pixel_size@units validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff/y_pixel_size @nameType OK name is specified +/entry1/instrument/diff/y_pixel_size NXDL data type: NXdetector/y_pixel_size OK float64 : NX_FLOAT +/entry1/instrument/diff/y_pixel_size validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/diff/y_pixel_size@units attribute data type NOTE variable length string: ['um'] +/entry1/instrument/diff/y_pixel_size@units field@units OK value: um +/entry1/instrument/diff/y_pixel_size@units validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo NXDL review TODO validate with NXdetector specification (incomplete) +/entry1/instrument/fluo@NX_class attribute data type NOTE variable length string: ['NXdetector'] +/entry1/instrument/fluo@NX_class @NX_class OK known: NXdetector +/entry1/instrument/fluo@axes validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo@energy_indices validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo@signal validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/data @nameType OK name is specified +/entry1/instrument/fluo/data NXDL data type: NXdetector/data OK int16 : NX_NUMBER +/entry1/instrument/fluo/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/data@interpretation attribute data type NOTE variable length string: ['spectrum'] +/entry1/instrument/fluo/data@interpretation NXDL attribute enum: NXdetector/data@interpretation OK spectrum: expected +/entry1/instrument/fluo/data@interpretation NXDL attribute type: NXdetector/data@interpretation OK str : NX_CHAR +/entry1/instrument/fluo/data@interpretation enumeration: @interpretation OK value=spectrum :recognized +/entry1/instrument/fluo/data@interpretation validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/data@target attribute data type NOTE variable length string: ['/entry1/instrument/fluo/data'] +/entry1/instrument/fluo/data@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/data@units field@units NOTE does not exist +/entry1/instrument/fluo/energy validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/energy@target attribute data type NOTE variable length string: ['/entry1/instrument/fluo/energy'] +/entry1/instrument/fluo/energy@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/energy@units attribute data type NOTE variable length string: ['keV'] +/entry1/instrument/fluo/energy@units field@units OK value: keV +/entry1/instrument/fluo/energy@units validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/transformations validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/fluo/transformations NXDL review TODO validate with NXtransformations specification (incomplete) +/entry1/instrument/fluo/transformations@NX_class attribute data type NOTE variable length string: ['NXtransformations'] +/entry1/instrument/fluo/transformations@NX_class @NX_class OK known: NXtransformations +/entry1/instrument/fluo/transformations/detector_arm NXtransformations@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry1/instrument/trans validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/trans NXDL review TODO validate with NXmonitor specification (incomplete) +/entry1/instrument/trans@NX_class attribute data type NOTE variable length string: ['NXmonitor'] +/entry1/instrument/trans@NX_class @NX_class OK known: NXmonitor +/entry1/instrument/trans/data @nameType OK name is specified +/entry1/instrument/trans/data NXDL data type: NXmonitor/data OK int16 : NX_NUMBER +/entry1/instrument/trans/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/trans/data@units field@units NOTE does not exist +/entry1/instrument/trans/transformations validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/instrument/trans/transformations NXDL review TODO validate with NXtransformations specification (incomplete) +/entry1/instrument/trans/transformations@NX_class attribute data type NOTE variable length string: ['NXtransformations'] +/entry1/instrument/trans/transformations@NX_class @NX_class OK known: NXtransformations +/entry1/instrument/trans/transformations/monitor_arm NXtransformations@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry1/program_name @nameType OK name is specified +/entry1/program_name NXDL data type: NXentry/program_name OK str : NX_CHAR +/entry1/program_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample NXDL review TODO validate with NXsample specification (incomplete) +/entry1/sample@NX_class attribute data type NOTE variable length string: ['NXsample'] +/entry1/sample@NX_class @NX_class OK known: NXsample +/entry1/sample@depends_on validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/t_stage_set validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/t_stage_set@target attribute data type NOTE variable length string: ['/entry1/sample/t_stage_set'] +/entry1/sample/t_stage_set@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/t_stage_set@units field@units NOTE does not exist +/entry1/sample/transformations validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/transformations NXDL review TODO validate with NXtransformations specification (incomplete) +/entry1/sample/transformations@NX_class attribute data type NOTE variable length string: ['NXtransformations'] +/entry1/sample/transformations@NX_class @NX_class OK known: NXtransformations +/entry1/sample/transformations/t_stage NXtransformations@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry1/sample/transformations/x_stage NXtransformations@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry1/sample/transformations/y_stage NXtransformations@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry1/sample/x_stage_set validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/x_stage_set@target attribute data type NOTE variable length string: ['/entry1/sample/x_stage_set'] +/entry1/sample/x_stage_set@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/x_stage_set@units field@units NOTE does not exist +/entry1/sample/y_stage_set validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/y_stage_set@target attribute data type NOTE variable length string: ['/entry1/sample/y_stage_set'] +/entry1/sample/y_stage_set@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/sample/y_stage_set@units field@units NOTE does not exist +/entry1/scan_command validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/scan_identifier validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/title @nameType OK name is specified +/entry1/title NXDL data type: NXentry/title OK str : NX_CHAR +/entry1/title validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/user validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/user NXDL review TODO validate with NXuser specification (incomplete) +/entry1/user@NX_class attribute data type NOTE variable length string: ['NXuser'] +/entry1/user@NX_class @NX_class OK known: NXuser +/entry1/user@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry1/user/username validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry_micro validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry_micro NXDL review TODO validate with NXentry specification (incomplete) +/entry_micro@NX_class attribute data type NOTE variable length string: ['NXentry'] +/entry_micro@NX_class @NX_class OK known: NXentry +/entry_micro/data /NXentry/NXdata@signal=data NOTE NeXus default plot v3 +/entry_micro/data NXdata dimension scale(s) OK dimension scale(s) verified +/entry_micro/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry_micro/data NXDL review TODO validate with NXdata specification (incomplete) +/entry_micro/data@NX_class attribute data type NOTE variable length string: ['NXdata'] +/entry_micro/data@NX_class @NX_class OK known: NXdata +/entry_micro/data@axes attribute data type NOTE variable length string array: ['.', 'image_x', 'image_y'] +/entry_micro/data@axes NXdata@axes=image_x OK axes dataset found: image_x +/entry_micro/data@axes NXdata@axes=image_y OK axes dataset found: image_y +/entry_micro/data@image_x_indices NXdata@image_x_indices OK value = 1: ok +/entry_micro/data@image_y_indices NXdata@image_y_indices OK value = 2: ok +/entry_micro/data@signal attribute data type NOTE variable length string: ['data'] +/entry_micro/data@signal NXdata group default plot v3 OK NXdata@signal = data +/entry_micro/data/data NXDL data type: NXdata/data OK int16 : NX_NUMBER +/entry_micro/data/data NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry_micro/data/data NXdata@signal rank WARN rank(data) != number of dimension scales +/entry_micro/data/data@interpretation NXDL attribute type: NXdata/data@interpretation OK str : NX_CHAR +/entry_micro/data/data@interpretation NXDL attribute enum: NXdata/data@interpretation WARN rgba-image: not in list: scalar,spectrum,image,vertex +/entry_micro/data/image_x NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry_micro/data/image_y NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/entry_micro/experiment_identifier NXDL data type: NXentry/experiment_identifier OK str : NX_CHAR +/entry_micro/experiment_identifier validTargetName TODO TODO: validate full_name against validTargetName +/entry_micro/experiment_identifier@target attribute data type NOTE variable length string: ['/entry1/experiment_identifier'] +/entry_micro/experiment_identifier@target link target exists OK /entry1/experiment_identifier +/entry_micro/program_name @nameType OK name is specified +/entry_micro/program_name NXDL data type: NXentry/program_name OK str : NX_CHAR +/entry_micro/program_name validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry_micro/title @nameType OK name is specified +/entry_micro/title NXDL data type: NXentry/title OK str : NX_CHAR +/entry_micro/title validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry_micro/user validTargetName TODO TODO: validate full_name against validTargetName +/entry_micro/user@target attribute data type NOTE variable length string: ['/entry1/user'] +/entry_micro/user@target link target exists OK /entry1/user +==================================================== =================================================== ====== ===================================================================================== + +======= ===== =========================================================== +status count description +======= ===== =========================================================== +OK 137 meets NeXus specification +NOTE 55 does not meet NeXus specification, but acceptable +WARN 2 does not meet NeXus specification, not generally acceptable +ERROR 0 violates NeXus specification +TODO 29 validation not implemented yet +UNUSED 8 optional NeXus item not used in data file +COMMENT 0 comment from the punx source code +-- -- -- +TOTAL 231 -- +======= ===== =========================================================== + diff --git a/tests/data/validations/writer_1_3.txt b/tests/data/validations/writer_1_3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2624d555b4c4fd94477ca1d3e338c7d70f72187 --- /dev/null +++ b/tests/data/validations/writer_1_3.txt @@ -0,0 +1,34 @@ +============================ ============================= ====== ================================================ +address validation status comment(s) +============================ ============================= ====== ================================================ +/ * valid NeXus data file OK This file is valid by the NeXus standard. +/ @NX_class OK file root (assumed): NXroot +/ NXDL review TODO validate with NXroot specification (incomplete) +/Scan validItemName NOTE relaxed re: [A-Za-z_][\w_]* +/Scan NXDL review TODO validate with NXentry specification (incomplete) +/Scan@NX_class @NX_class OK known: NXentry +/Scan/data /NXentry/NXdata@signal=counts OK NeXus default plot v3 +/Scan/data NXdata dimension scale(s) OK dimension scale(s) verified +/Scan/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/Scan/data NXDL review TODO validate with NXdata specification (incomplete) +/Scan/data@NX_class @NX_class OK known: NXdata +/Scan/data@axes NXdata@axes=two_theta OK axes dataset found: two_theta +/Scan/data@signal NXdata group default plot v3 OK NXdata@signal = counts +/Scan/data@two_theta_indices NXdata@two_theta_indices OK value = 0: ok +/Scan/data/counts NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +/Scan/data/two_theta NXdata@ignoreExtraFields UNUSED field ignored per NXDL specification +============================ ============================= ====== ================================================ + +======= ===== =========================================================== +status count description +======= ===== =========================================================== +OK 10 meets NeXus specification +NOTE 1 does not meet NeXus specification, but acceptable +WARN 0 does not meet NeXus specification, not generally acceptable +ERROR 0 violates NeXus specification +TODO 3 validation not implemented yet +UNUSED 2 optional NeXus item not used in data file +COMMENT 0 comment from the punx source code +-- -- -- +TOTAL 16 -- +======= ===== =========================================================== diff --git a/tests/data/validations/writer_2_1.txt b/tests/data/validations/writer_2_1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca44039f891a5ec94556d6895153b94a944efbe4 --- /dev/null +++ b/tests/data/validations/writer_2_1.txt @@ -0,0 +1,50 @@ +=========================================== ============================= ====== ===================================================== +address validation status comment(s) +=========================================== ============================= ====== ===================================================== +/ * valid NeXus data file OK This file is valid by the NeXus standard. +/ @NX_class OK file root (assumed): NXroot +/ NXDL review TODO validate with NXroot specification (incomplete) +/entry validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry NXDL review TODO validate with NXentry specification (incomplete) +/entry@NX_class @NX_class OK known: NXentry +/entry/data /NXentry/NXdata@signal=counts OK NeXus default plot v3 +/entry/data NXdata dimension scale(s) OK dimension scale(s) verified +/entry/data validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/data NXDL review TODO validate with NXdata specification (incomplete) +/entry/data@NX_class @NX_class OK known: NXdata +/entry/data@axes NXdata@axes=two_theta OK axes dataset found: two_theta +/entry/data@signal NXdata group default plot v3 OK NXdata@signal = counts +/entry/data@two_theta_indices NXdata@two_theta_indices OK value = 0: ok +/entry/data/counts validTargetName TODO TODO: validate full_name against validTargetName +/entry/data/counts@target link target exists OK /entry/instrument/detector/counts +/entry/data/two_theta validTargetName TODO TODO: validate full_name against validTargetName +/entry/data/two_theta@target link target exists OK /entry/instrument/detector/two_theta +/entry/instrument validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument NXDL review TODO validate with NXinstrument specification (incomplete) +/entry/instrument@NX_class @NX_class OK known: NXinstrument +/entry/instrument/detector validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument/detector NXDL review TODO validate with NXdetector specification (incomplete) +/entry/instrument/detector@NX_class @NX_class OK known: NXdetector +/entry/instrument/detector/counts validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument/detector/counts@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument/detector/counts@units field@units OK value: counts +/entry/instrument/detector/counts@units validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument/detector/two_theta validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument/detector/two_theta@target validItemName-strict OK strict re: [a-z_][a-z0-9_]* +/entry/instrument/detector/two_theta@units field@units OK value: degrees +/entry/instrument/detector/two_theta@units validItemName-strict OK strict re: [a-z_][a-z0-9_]* +=========================================== ============================= ====== ===================================================== + +======= ===== =========================================================== +status count description +======= ===== =========================================================== +OK 25 meets NeXus specification +NOTE 0 does not meet NeXus specification, but acceptable +WARN 0 does not meet NeXus specification, not generally acceptable +ERROR 0 violates NeXus specification +TODO 7 validation not implemented yet +UNUSED 0 optional NeXus item not used in data file +COMMENT 0 comment from the punx source code +-- -- -- +TOTAL 32 -- +======= ===== =========================================================== diff --git a/tests/data_q.py b/tests/data_q.py new file mode 100644 index 0000000000000000000000000000000000000000..3ca6f778e0d69a39ba95f77bde8c1370d6f48ba0 --- /dev/null +++ b/tests/data_q.py @@ -0,0 +1,44 @@ + +''' +validate a single NeXus HDF5 data file + +use this to develop features of punx +''' + +import os +import sys +import h5py +import tempfile +import unittest +import pyRestTable + +TESTFILE = "writer_1_3.hdf5" # simple, with links +# TESTFILE = "writer_2_1.hdf5" # simple, with links +# TESTFILE = "draft_1D_NXcanSAS.h5" # incorrect @NX_class attributes +# TESTFILE = "1998spheres.h5" # NXcanSAS +# TESTFILE = "example_01_1D_I_Q.h5" # NXcanSAS +# TESTFILE = "USAXS_flyScan_GC_M4_NewD_15.h5" # multiple NXdata +TESTFILE = "Data_Q.h5" + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) +import punx.validate +import punx.finding + + +def main(): + test_file = os.path.join(_path, 'punx', 'data', TESTFILE) + validator = punx.validate.Data_File_Validator() + validator.validate(test_file) + validator.print_report() + # reporter(validator) + +# tf = "chopper.nxs" +# test_file = os.path.join(_path, 'punx', 'data', tf) +# validator.validate(test_file) +# reporter(validator) + + +if __name__ == "__main__": + main() diff --git a/tests/developer.py b/tests/developer.py new file mode 100644 index 0000000000000000000000000000000000000000..5f6f2550b7308405fd657c28294fdeb673edb747 --- /dev/null +++ b/tests/developer.py @@ -0,0 +1,62 @@ + +''' +validate a single NeXus HDF5 data file + +use this to develop features of punx +''' + +import os +import sys +import h5py +import tempfile +import unittest +import pyRestTable + +TESTFILE = "writer_1_3.hdf5" # simple, with links +# TESTFILE = "writer_2_1.hdf5" # simple, with links +# TESTFILE = "draft_1D_NXcanSAS.h5" # incorrect @NX_class attributes +# TESTFILE = "1998spheres.h5" # NXcanSAS +# TESTFILE = "example_01_1D_I_Q.h5" # NXcanSAS +# TESTFILE = "USAXS_flyScan_GC_M4_NewD_15.h5" # multiple NXdata + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) +import punx.validate +import punx.finding + + +def reporter(validator): + t = pyRestTable.Table() + t.addLabel("address") + t.addLabel("status") + t.addLabel("test") + t.addLabel("comments") + for finding in validator.validations: + if finding.status == punx.finding.OPTIONAL: + # put this on if you like verbose reports + continue + row = [] + row.append(finding.h5_address) + row.append(finding.status) + row.append(finding.test_name) + row.append(finding.comment) + t.addRow(row) + print(t) + print("sum=%f count=%d score=%f" % validator.finding_score()) + + +def main(): + test_file = os.path.join(_path, 'punx', 'data', TESTFILE) + validator = punx.validate.Data_File_Validator() + validator.validate(test_file) + reporter(validator) + +# tf = "chopper.nxs" +# test_file = os.path.join(_path, 'punx', 'data', tf) +# validator.validate(test_file) +# reporter(validator) + + +if __name__ == "__main__": + main() diff --git a/tests/finding_test.py b/tests/finding_test.py new file mode 100644 index 0000000000000000000000000000000000000000..da0feb72b721e443c1395caeb8e30f75b3ddec1e --- /dev/null +++ b/tests/finding_test.py @@ -0,0 +1,111 @@ + +''' +test punx tests/finding module +''' + +import lxml.etree +import os +import sys +import tempfile +import unittest + +import github + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))) +import punx, punx.finding + + +class No_Exception(Exception): pass + + +class Test_ValidationResultStatus(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + def test_standard(self): + self.assertTrue( + isinstance( + punx.finding.OK, + punx.finding.ValidationResultStatus), + "finding instance of correct object type") + + +class Test_Finding(unittest.TestCase): + + def avert_exception(self): + try: + f = punx.finding.Finding(None, None, punx.finding.OK, None) + except: + pass + else: + raise No_Exception + + def test_exception(self): + self.assertRaises( + ValueError, + punx.finding.Finding, + None, + None, + 'exception', + None) + self.assertRaises( + ValueError, + punx.finding.Finding, + None, + None, + 'OK', + None) + self.assertRaises(No_Exception, self.avert_exception) + + def test_standard(self): + f = punx.finding.Finding("A", "this", punx.finding.OK, "looks good") + + def test_str(self): + f = punx.finding.Finding(None, None, punx.finding.OK, None) + self.assertGreaterEqual( + str(f).find("punx.finding.Finding object at"), + 0, + "fallback str representation") + + f = punx.finding.Finding("h5_address", "test_name", punx.finding.OK, "comment") + self.assertEqual(f.h5_address, "h5_address", "assigned h5_address") + self.assertEqual(f.test_name, "test_name", "assigned test_name") + self.assertEqual(f.comment, "comment", "assigned comment") + self.assertEqual(f.status, punx.finding.OK, "assigned OK finding") + + +class Test_Global(unittest.TestCase): + + def test_standard(self): + self.assertEqual( + len(punx.finding.VALID_STATUS_LIST), + 8, + "number of possible finding types") + self.assertEqual( + len(punx.finding.VALID_STATUS_LIST), + len(punx.finding.VALID_STATUS_DICT), + "list & dictionary have same length") + key_list = list(sorted(map(str, punx.finding.TF_RESULT.keys()))) + k2 = list(sorted(map(str, (False, True)))) + self.assertEqual(key_list, k2, "true/false list has consistent keys") + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_ValidationResultStatus, + Test_Finding, + Test_Global, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/github_handler_test.py b/tests/github_handler_test.py new file mode 100644 index 0000000000000000000000000000000000000000..65a2d4c5f6723570af44294e10024fd40be4e0b8 --- /dev/null +++ b/tests/github_handler_test.py @@ -0,0 +1,180 @@ + +''' +test punx tests/github_handler module +''' + +import io +import os +import shutil +import sys +import tempfile +import unittest +import zipfile + +import github + +SRC_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src')) +sys.path.insert(0, SRC_PATH) +import punx, punx.github_handler + +CANONICAL_RELEASE = u'v3.3' + + +class Test_Github_Handler_Module(unittest.TestCase): + + def test_basic_setup(self): + self.assertEqual(punx.github_handler.CREDS_FILE_NAME, + u'__github_creds__.txt', + u'creds file: ' + punx.github_handler.CREDS_FILE_NAME) + self.assertEqual(punx.github_handler.DEFAULT_BRANCH_NAME, + u'master', + u'default branch: ' + punx.github_handler.DEFAULT_BRANCH_NAME) + self.assertEqual(u'v3.3', + u'v3.3', + u'release: v3.3') + self.assertEqual(punx.github_handler.DEFAULT_RELEASE_NAME, + u'v3.3', + u'default release: v3.3') + self.assertEqual(punx.github_handler.DEFAULT_TAG_NAME, + # u'NXroot-1.0', + u'Schema-3.3', + u'default tag: ' + punx.github_handler.DEFAULT_TAG_NAME) + self.assertEqual(punx.github_handler.DEFAULT_COMMIT_NAME, + u'a4fd52d', + u'default hash: ' + punx.github_handler.DEFAULT_COMMIT_NAME) + self.assertEqual(punx.github_handler.DEFAULT_NXDL_SET, + punx.github_handler.DEFAULT_RELEASE_NAME, + u'default NXDL file set: ' + punx.github_handler.DEFAULT_NXDL_SET) + self.assertEqual(punx.github_handler.GITHUB_RETRY_COUNT, + 3, + u'GitHub retry count: 3') + + + def test_class_GitHub_Repository_Reference(self): + grr = punx.github_handler.GitHub_Repository_Reference() + self.assertTrue(isinstance(grr, punx.github_handler.GitHub_Repository_Reference), + u'correct object') + self.assertEqual(grr.orgName, + punx.github_handler.GITHUB_NXDL_ORGANIZATION, + u'organization name') + self.assertEqual(grr.appName, + punx.github_handler.GITHUB_NXDL_REPOSITORY, + u'package name') + self.assertEqual(grr._make_zip_url(), + u'https://github.com/nexusformat/definitions/archive/master.zip', + u'default download URL') + self.assertEqual(grr._make_zip_url('testing'), + u'https://github.com/nexusformat/definitions/archive/testing.zip', + u'"testing" download URL') + self.assertRaises(ValueError, grr.request_info) + + def test_connected_GitHub_Repository_Reference(self): + grr = punx.github_handler.GitHub_Repository_Reference() + using_creds = grr.connect_repo() + self.assertNotEqual(grr.repo, None, u'grr.repo is not None') + if not using_creds: + return # skip if on travis-ci + + self.assertTrue(isinstance(grr.repo, github.Repository.Repository), + u'grr.repo is a Repository()') + self.assertEqual(grr.repo.name, punx.github_handler.GITHUB_NXDL_REPOSITORY, + u'grr.repo.name = ' + punx.github_handler.GITHUB_NXDL_REPOSITORY) + + node = grr.get_branch() + self.assertTrue(isinstance(node, (type(None), github.Branch.Branch)), + u'grr.get_branch() returns ' + str(type(node))) + node = grr.request_info(u'master') + self.assertTrue(isinstance(node, (type(None), github.Branch.Branch)), + u'grr.request_info("master") returns ' + str(type(node))) + if node is not None: + self.assertEqual(grr.ref, u'master', u'ref: ' + grr.ref) + self.assertEqual(grr.ref_type, u'branch', u'ref_type: ' + grr.ref_type) + self.assertNotEqual(grr.sha, None, u'sha: ' + grr.sha) + self.assertNotEqual(grr.zip_url, None, u'zip_url: ' + grr.zip_url) + + node = grr.get_release() + self.assertTrue(isinstance(node, (type(None), github.GitRelease.GitRelease)), + u'grr.get_release() returns ' + str(type(node))) + node = grr.request_info(CANONICAL_RELEASE) + self.assertTrue(isinstance(node, (type(None), github.GitRelease.GitRelease)), + u'grr.request_info("{}") returns a Release()'.format(CANONICAL_RELEASE)) + if node is not None: + self.assertEqual(grr.ref, CANONICAL_RELEASE, u'ref: ' + grr.ref) + self.assertEqual(grr.ref_type, u'release', u'ref_type: ' + grr.ref_type) + self.assertNotEqual(grr.sha, None, u'sha: ' + grr.sha) + self.assertNotEqual(grr.zip_url, None, u'zip_url: ' + grr.zip_url) + + node = grr.get_tag() + self.assertTrue(isinstance(node, (type(None), github.Tag.Tag)), + u'grr.get_tag() returns ' + str(type(node))) + node = grr.request_info(u'NXentry-1.0') + self.assertTrue(isinstance(node, (type(None), github.Tag.Tag)), + u'grr.request_info("NXentry-1.0") returns ' + str(type(node))) + if node is not None: + self.assertEqual(grr.ref, u'NXentry-1.0', u'ref: ' + grr.ref) + self.assertEqual(grr.ref_type, u'tag', u'ref_type: ' + grr.ref_type) + self.assertNotEqual(grr.sha, None, u'sha: ' + grr.sha) + self.assertNotEqual(grr.zip_url, None, u'zip_url: ' + grr.zip_url) + node = grr.get_tag(u'not_a_tag') + self.assertEqual(node, None, u'search for tag that does not exist') + + node = grr.get_commit() + self.assertTrue(isinstance(node, (type(None), github.Commit.Commit)), + u'grr.get_commit() returns ' + str(type(node))) + node = grr.request_info(u'227bdce') + self.assertTrue(isinstance(node, (type(None), github.Commit.Commit)), + u'grr.request_info("227bdce") returns ' + str(type(node))) + if node is not None: + self.assertEqual(grr.ref, u'227bdce', u'ref: ' + grr.ref) + self.assertEqual(grr.ref_type, u'commit', u'ref_type: ' + grr.ref_type) + # next test is specific to 1 time zone + #self.assertEqual(grr.last_modified, u'2016-11-19 01:04:28', u'datetime: ' + grr.last_modified) + self.assertNotEqual(grr.sha, None, u'sha: ' + grr.sha) + self.assertNotEqual(grr.zip_url, None, u'zip_url: ' + grr.zip_url) + node = grr.get_commit(u'abcd123') + self.assertEqual(node, None, u'search for hash that does not exist') + + def test_GitHub_BasicAuth_credentials(self): + creds = punx.github_handler.get_BasicAuth_credentials() + self.assertTrue(isinstance(creds, (type(None), dict)), + u'type of response: ' + str(type(creds))) + if isinstance(creds, dict): + self.assertEqual(len(creds), 2, u'credentials dict has two items') + self.assertEqual(' '.join(sorted(creds.keys())), + u'password user', + u'credentials dict has these keys: ') + + def test_Github_download_default(self): + import punx.cache_manager + grr = punx.github_handler.GitHub_Repository_Reference() + using_creds = grr.connect_repo() + if not using_creds: + return # skip this on travis-ci + + node = grr.request_info() + if node is not None: + path = tempfile.mkdtemp() + self.assertTrue(os.path.exists(path)) + _msgs = punx.cache_manager.extract_from_download(grr, path) + self.assertTrue(os.path.exists(os.path.join(path, grr.ref)), + 'installed in: ' + os.path.join(path, grr.ref)) + shutil.rmtree(path, True) + + +def suite(*args, **kw): + cred_file = os.path.join( + SRC_PATH, + 'punx', + punx.github_handler.CREDS_FILE_NAME) + test_suite = unittest.TestSuite() + test_list = [ + Test_Github_Handler_Module, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/ignore_now/cache_test.py b/tests/ignore_now/cache_test.py new file mode 100644 index 0000000000000000000000000000000000000000..7b6280766629d18af04fb240ebad10f437ae9aa1 --- /dev/null +++ b/tests/ignore_now/cache_test.py @@ -0,0 +1,63 @@ + +''' +test punx tests/common module (supports unit testing) +''' + +import lxml +import os +import sys +import tempfile +import unittest + +_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src')) +if _path not in sys.path: + sys.path.insert(0, _path) + +import punx.cache +import punx.logs + + +class TestCache(unittest.TestCase): + + logger = None + + def setUp(self): + punx.logs.ignore_logging() + + def tearDown(self): + if self.logger is not None and os.path.exists(self.logger.log_file): + os.remove(self.logger.log_file) + self.logger = None + +# def test_use_source_cache(self): +# self.assertTrue(punx.cache.USE_SOURCE_CACHE) + + def test_get_nxdl_dir(self): + base = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + base += os.path.sep + received = punx.cache.get_nxdl_dir() + self.assertTrue(base.startswith(base)) + self.assertTrue(received.startswith(base)) + self.assertTrue(os.path.exists(received)) + + def test_get_nxdl_xsd(self): + nxdl_xsd = punx.cache.get_nxdl_xsd() + self.assertIsInstance(nxdl_xsd, lxml.etree._ElementTree) + self.assertIsInstance(nxdl_xsd.docinfo, lxml.etree.DocInfo) + self.assertIsInstance(nxdl_xsd.parser, lxml.etree.XMLParser) + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + TestCache, + # TestCacheExceptions, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/ignore_now/default_plot_test.py b/tests/ignore_now/default_plot_test.py new file mode 100644 index 0000000000000000000000000000000000000000..151ed24b0524f6e5d3c4bbe7a6cef4ab3224a18d --- /dev/null +++ b/tests/ignore_now/default_plot_test.py @@ -0,0 +1,177 @@ + +''' +issue 14: implement warnings as advised in NeXus manual + +:see: http://download.nexusformat.org/doc/html/search.html?q=warning&check_keywords=yes&area=default + +Actually, flag them as NOTE unless WARN is compelling +''' + +import h5py +import numpy +import os +import sys +import tempfile +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) + + +class Default_Plot_Detection(unittest.TestCase): + ''' + whatever + ''' + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + if self.validator is not None: + self.validator.close() + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + def test_recommended_method(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + hdf5root.attrs['default'] = 'entry' + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + entry.attrs['default'] = 'data' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = 'x' + ds = data.create_dataset('x', data=range(5)) + ds.attrs['units'] = 'mm' + hdf5root.close() + + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + # print('\n' + '\n'.join([str(f) for f in self.validator.findings]) + '\n') + + findings_list = [str(f) for f in self.validator.findings] + + expected = '/entry/data@signal OK: NXdata group default plot v3: NXdata@signal = x' + self.assertTrue(expected in findings_list, expected) + + expected = '/entry/data OK: /NXentry/NXdata@signal=x: NeXus default plot v3' + self.assertTrue(expected in findings_list, expected) + + expected = '/ OK: * valid NeXus data file: This file is valid by the NeXus standard.' + self.assertTrue(expected in findings_list, expected) + + def test_no_default_or_signal_attributes__issue_62(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + #hdf5root.attrs['default'] = 'entry' + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + #entry.attrs['default'] = 'data' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + #data.attrs['signal'] = 'x' + ds = data.create_dataset('x', data=range(5)) + #ds.attrs['units'] = 'mm' + hdf5root.close() + + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + #print('\n' + '\n'.join([str(f) for f in self.validator.findings]) + '\n') + + findings_list = [str(f) for f in self.validator.findings] + + expected = '/entry/data@signal OK: NXdata group default plot v3: NXdata@signal = x' + expected = '/entry/data@signal' + self.assertFalse(expected in self.validator.addresses, expected + ' found') + + expected = '/NXentry/NXdata/field WARN: NeXus default plot: only one /NXentry/NXdata/field exists but no signal indicated' + self.assertTrue(expected in findings_list, expected) + + expected = '/ OK: * valid NeXus data file: This file is valid by the NeXus standard.' + self.assertTrue(expected in findings_list, expected) + + def test_bad_signal_attribute__issue_62(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + #hdf5root.attrs['default'] = 'entry' + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + #entry.attrs['default'] = 'data' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = '1' + ds = data.create_dataset('x', data=range(5)) + #ds.attrs['units'] = 'mm' + hdf5root.close() + + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + # print('\n' + '\n'.join([str(f) for f in self.validator.findings]) + '\n') + + findings_list = [str(f) for f in self.validator.findings] + + expected = '/entry/data@signal ERROR: NXdata group default plot v3: /NXentry/NXdata@signal field not found: 1' + self.assertTrue(expected in findings_list, expected) + + expected = '/ OK: * valid NeXus data file: This file is valid by the NeXus standard.' + self.assertTrue(expected in findings_list, expected) + + def test_integer_signal_attribute__issue_62(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + #hdf5root.attrs['default'] = 'entry' + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + #entry.attrs['default'] = 'data' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = 1 + ds = data.create_dataset('x', data=range(5)) + #ds.attrs['units'] = 'mm' + hdf5root.close() + + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + findings_list = [str(f) for f in self.validator.findings] + # print('\n' + '\n'.join(findings_list) + '\n') + + + expected = '/entry/data@signal ERROR: NXdata group default plot v3: /NXentry/NXdata@signal field not found: 1' + self.assertTrue(expected in findings_list, expected) + + expected = '/ OK: * valid NeXus data file: This file is valid by the NeXus standard.' + self.assertTrue(expected in findings_list, expected) + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Default_Plot_Detection, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/ignore_now/external_links.py b/tests/ignore_now/external_links.py new file mode 100644 index 0000000000000000000000000000000000000000..b7882a325b364cd4fc97a08cb9ac2e6cff5ba2ec --- /dev/null +++ b/tests/ignore_now/external_links.py @@ -0,0 +1,365 @@ + +''' +test the punx validation process +''' + +import h5py +import numpy +import os +import sys +import tempfile +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) + + +def makeTemporaryFile(ext='.hdf5'): + hfile = tempfile.NamedTemporaryFile(suffix=ext, delete=False) + hfile.close() + return hfile.name + + +def makeDataFile(fname): + ''' + make the data file, no hierarchy, definitely not NeXus + + structure: + + /motor : float = [1.1, 2.0, 3.0] + @units = mm + + ''' + hdf5root = h5py.File(fname, "w") + ds = hdf5root.create_dataset('motor', data=[1.1, 2, 3]) + ds.attrs['units'] = 'mm' + hdf5root.close() + + +def makeMasterFile(fname, data_fname, data_path): + ''' + make the master file, basic NeXus structure + + structure: + + /motor : float = [1.1, 2.0, 3.0] + @units = mm + + ''' + hdf5root = h5py.File(fname, "w") + hdf5root.attrs['default'] = 'entry' + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + entry.attrs['default'] = 'data' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = 'positions' + data['positions'] = h5py.ExternalLink(data_fname, data_path) + hdf5root.close() + + +class Construct_master_and_external_data(unittest.TestCase): + ''' + Test the construction of a master NeXus file with ExternalLink to data + ''' + + @classmethod + def setUpClass(cls): + # cls._connection = createExpensiveConnectionObject() + pass + + @classmethod + def tearDownClass(cls): + # cls._connection.destroy() + pass + + def setUp(self): + self.hdffiles ={item: makeTemporaryFile() for item in 'master data'.split()} + makeDataFile(self.hdffiles['data']) + makeMasterFile(self.hdffiles['master'], self.hdffiles['data'], '/motor') + + def tearDown(self): + for k in list(self.hdffiles.keys()): + v = self.hdffiles[k] + if os.path.exists(v): + os.remove(v) + del self.hdffiles[k] + + def test_basic_data_file(self): + self.assertTrue(os.path.exists(self.hdffiles['data']), 'data file exists') + + root = h5py.File(self.hdffiles['data'], 'r') + self.assertNotEqual(root, None, 'data: h5py File object is not None') + self.assertTrue(isinstance(root, h5py.File), 'data: root is h5py.File instance') + + self.assertTrue('entry' not in root, '/entry does not exist') + self.assertTrue('motor' in root, '/data exist') + ds = root['/motor'] + self.assertTrue(isinstance(ds, h5py.Dataset), '/motor is an HDF5 Dataset') + self.assertTrue(isinstance(ds.value, numpy.ndarray), '/motor is a numpy array') + self.assertEqual(ds.dtype, numpy.float, '/motor values are floating point') + self.assertEqual(len(ds), 3, '/motor has three values') + self.assertEqual(ds[0], 1.1, '/motor[0] = 1.1') + self.assertEqual(ds[1], 2, '/motor[1] = 2') + self.assertEqual(ds[2], 3, '/motor[2] = 3') + self.assertTrue('units' in ds.attrs, '/motor@units exist') + units = ds.attrs['units'] + self.assertEqual(units, 'mm', '/motor@units = mm') + root.close() + + def test_basic_master_file(self): + self.assertTrue(os.path.exists(self.hdffiles['master']), 'master file exists') + + root = h5py.File(self.hdffiles['master'], 'r') + self.assertNotEqual(root, None, 'data: h5py File object is not None') + self.assertTrue(isinstance(root, h5py.File), 'data: root is h5py.File instance') + + self.assertTrue('default' in root.attrs, '/ has @default attribute') + default = root.attrs['default'] + self.assertEqual(default, 'entry', '/@default is "entry", as planned') + self.assertTrue(default in root, '/@default points to existing group in /') + entry = root[default] + + self.assertTrue('default' in entry.attrs, '/entry has @default attribute') + default = entry.attrs['default'] + self.assertEqual(default, + 'data', + '/entry@default is "data", as planned') + self.assertTrue(default in entry, + '/entry@default points to existing group in /entry') + data = entry[default] + + self.assertTrue('signal' in data.attrs, + '/entry/data has @signal attribute') + signal = data.attrs['signal'] + self.assertEqual(signal, + 'positions', + '/entry/data/@signal is "data", as planned') + self.assertTrue(signal in data, + '/entry/data/@signal points to existing dataset in /entry/data') + ds = data[signal] + root.close() + + def test_basic_master_data_combination(self): + root = h5py.File(self.hdffiles['master'], 'r') + entry = root[root.attrs['default']] + data = entry[entry.attrs['default']] + + ds = data.get(data.attrs['signal'], getlink=True) + self.assertTrue(isinstance(ds, h5py.ExternalLink), + '/entry/data/positions is an external link') + + ds = data[data.attrs['signal']] + self.assertEqual(ds.dtype, + numpy.float, + '/entry/data/positions values are floating point') + self.assertEqual(len(ds), 3, '/entry/data/positions has three values') + self.assertEqual(ds[0], 1.1, '/entry/data/positions[0] = 1.1') + self.assertEqual(ds[1], 2, '/entry/data/positions[1] = 2') + self.assertEqual(ds[2], 3, '/entry/data/positions[2] = 3') + self.assertTrue('units' in ds.attrs, '/entry/data/positions@units exist') + units = ds.attrs['units'] + self.assertEqual(units, 'mm', '/entry/data/positions@units = mm') + root.close() + + def test_basic_master__missing_external_file(self): + os.remove(self.hdffiles['data']) + root = h5py.File(self.hdffiles['master'], 'r') + entry = root[root.attrs['default']] + data = entry[entry.attrs['default']] + + signal = data.attrs['signal'] + self.assertTrue(signal in data) + def fails(): + return data[signal] + self.assertRaises(KeyError, fails) + + ds = data.get(signal, getlink=True) + self.assertTrue(isinstance(ds, h5py.ExternalLink), + '/entry/data/positions is an external link') + self.assertEqual(ds.filename, + self.hdffiles['data'], + '/entry/data/positions/@file is correct') + self.assertEqual(ds.path, + '/motor', + '/entry/data/positions/@path is correct') + root.close() + + def test_basic_master__missing_external_path(self): + + root = h5py.File(self.hdffiles['data'], 'r+') + root['x'] = root['motor'] + del root['motor'] + root.close() + + root = h5py.File(self.hdffiles['master'], 'r') + entry = root[root.attrs['default']] + data = entry[entry.attrs['default']] + signal = data.attrs['signal'] + + self.assertTrue(signal in data) + def fails(): + return data[signal] + self.assertRaises(KeyError, fails) + + ds = data.get(signal, getlink=True) + self.assertTrue(isinstance(ds, h5py.ExternalLink), + '/entry/data/positions is an external link') + self.assertEqual(ds.filename, self.hdffiles['data'], + '/entry/data/positions/@file is correct') + self.assertEqual(ds.path, '/motor', + '/entry/data/positions/@path is correct') + root.close() + + +class Structure_external_master_and_data__issue_18(unittest.TestCase): + ''' + #18: h5structure: report external group links in the right place + + in h5structure.h5structure._renderGroup(), + The problem is the link file and path need to be fed into the next + call to _renderGroup(). + ''' + + # :param int limit: maximum number of array items to be shown (default = 5) + limit = 1 + # :param bool show_attributes: display attributes in output + show_attributes = True + + def setUp(self): + self.hdffiles ={item: makeTemporaryFile() for item in 'master data'.split()} + makeDataFile(self.hdffiles['data']) + makeMasterFile(self.hdffiles['master'], self.hdffiles['data'], '/motor') + + def tearDown(self): + for k in list(self.hdffiles.keys()): + v = self.hdffiles[k] + if os.path.exists(v): + os.remove(v) + del self.hdffiles[k] + + def test_data_structure(self): + import punx.h5structure + + xture = punx.h5structure.h5structure(self.hdffiles['data']) + xture.array_items_shown = self.limit + report = xture.report(self.show_attributes) + self.assertEqual(len(report), 3, '3 lines of structure in data file') + self.assertEqual(report[1].split(':')[0], ' '*2 + 'motor', 'dataset name') + self.assertEqual(report[2], ' '*4 + '@units = mm', 'units') + + def test_master_structure(self): + import punx.h5structure + + expected = '''\ + temporary_master.hdf5 : NeXus data file + @default = entry + entry:NXentry + @NX_class = NXentry + @default = data + data:NXdata + @NX_class = NXdata + @signal = positions + positions:NX_FLOAT64[3] = [ ... ] + @units = mm + @file = temporary_data.hdf5 + @path = /motor + '''.splitlines() + + xture = punx.h5structure.h5structure(self.hdffiles['master']) + xture.array_items_shown = self.limit + report = xture.report(self.show_attributes) + + self.assertEqual(len(report), len(expected)-1, 'length of structure report') + self.assertEqual(report[2], ' '*2 + 'entry:NXentry', 'NXentry name') + self.assertEqual(report[5], ' '*4 + 'data:NXdata', 'NXdata name') + self.assertEqual(report[8].split(':')[0], + ' '*6 + 'positions', + 'dataset name in master') + self.assertEqual(report[9], ' '*8 + '@units = mm', 'dataset units') + self.assertEqual(report[11], ' '*8 + '@path = /motor', 'dataset path') + + +class Validate_external_master_and_data__issue_59(unittest.TestCase): + ''' + #59: validate: recognize and validate external file links + + These links do not have a target attribute. + Instead. there is a way in h5py to access the + file and path configuration. These are provided + in a data structure, NOT as HDF5 attributes. + If the external file is available, the link + will provide the linked content, as well. + ''' + + def setUp(self): + self.hdffiles ={item: makeTemporaryFile() for item in 'master data'.split()} + makeDataFile(self.hdffiles['data']) + makeMasterFile(self.hdffiles['master'], self.hdffiles['data'], '/motor') + + def tearDown(self): + for k in list(self.hdffiles.keys()): + v = self.hdffiles[k] + if os.path.exists(v): + os.remove(v) + del self.hdffiles[k] + + def test_data_valid(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + validator = punx.validate.Data_File_Validator(self.hdffiles['data']) + validator.validate() + + self.assertEqual(validator.findings[-1].status, punx.finding.ERROR, + 'validation ERROR found') + self.assertEqual(validator.findings[-1].test_name, + '! valid NeXus data file', + 'not a valid NeXus data file') + + validator.close() + + def test_master_valid(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + validator = punx.validate.Data_File_Validator(self.hdffiles['master']) + validator.validate() + + self.assertEqual(validator.findings[-1].status, punx.finding.OK, + 'validation ERROR found') + self.assertEqual(validator.findings[-1].test_name, + '* valid NeXus data file', + 'valid NeXus data file') + + a = '/entry/data@signal' + self.assertTrue(a in validator.addresses.keys(), 'found hdf5 address: ' + a) + # test the validation findings on the default plot description + f = validator.addresses[a].findings + self.assertEqual(len(f), 1, 'one finding for HDF address: ' + a) + self.assertEqual(f[0].test_name, + 'NXdata group default plot v3', + 'tested for default plot scheme: v3') + self.assertEqual(f[0].status, + punx.finding.OK, + 'NXdata group default plot v3') + + validator.close() + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Construct_master_and_external_data, + Validate_external_master_and_data__issue_59, + Structure_external_master_and_data__issue_18, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/ignore_now/h5structure_test.py b/tests/ignore_now/h5structure_test.py new file mode 100644 index 0000000000000000000000000000000000000000..ac1fdaedcd5fe122d0416c3848f272db9ed4d35d --- /dev/null +++ b/tests/ignore_now/h5structure_test.py @@ -0,0 +1,104 @@ + +''' +test structure analysis process of punx package +''' + +import os +import sys +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..', ) +if _path not in sys.path: + sys.path.insert(0, _path) +from tests import common + +_path = os.path.join(_path, 'src') +if _path not in sys.path: + sys.path.insert(0, _path) +import punx.h5structure + + +class Structure_SimpleHdf5File(common.StructureHdf5File): + + expected_output = [] + expected_output.append("test file name will be placed here automatically") + expected_output.append(" entry") + expected_output.append(" @purpose = punx unittest: test_hdf5_simple") + expected_output.append(" item:CHAR = a string of characters") + NeXus = False + + def set_hdf5_contents(self, root): + entry = root.create_group("entry") + entry.attrs["purpose"] = "punx unittest: test_hdf5_simple" + entry.create_dataset("item", data="a string of characters") + + def setUp(self): + ''' + prepare for temporary file creation + ''' + fname = common.getTestFileName(self.set_hdf5_contents) + self.expected_output[0] = fname + + # :param int limit: maximum number of array items to be shown (default = 5) + limit = 5 + # :param bool show_attributes: display attributes in output + show_attributes = True + + xture = punx.h5structure.h5structure(fname) + xture.array_items_shown = limit + self.report = xture.report(show_attributes) + + +def reference_file(fname): + path = os.path.dirname(__file__) + return os.path.abspath(os.path.join(path, 'data', 'structures', fname)) + + +class Structure_writer_1_3(common.StructureHdf5File): + + testfile = 'writer_1_3.hdf5' + expected_output = common.read_filelines(reference_file('writer_1_3.txt')) + + +class Structure_writer_2_1(common.StructureHdf5File): + + testfile = 'writer_2_1.hdf5' + expected_output = common.read_filelines(reference_file('writer_2_1.txt')) + + +class Structure_33id_spec_22_2D(common.StructureHdf5File): + + testfile = '33id_spec_22_2D.hdf5' + expected_output = common.read_filelines(reference_file('33id_spec_22_2D.txt')) + + +class Structure_compression(common.StructureHdf5File): + + testfile = 'compression.h5' + expected_output = common.read_filelines(reference_file('compression.txt')) + NeXus = False + + +class Structure_example_mapping(common.StructureHdf5File): + + testfile = 'example_mapping.nxs' + expected_output = common.read_filelines(reference_file('example_mapping.txt')) + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Structure_SimpleHdf5File, + Structure_writer_1_3, + Structure_writer_2_1, + Structure_33id_spec_22_2D, + Structure_compression, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/ignore_now/nxdlstructure_test.py b/tests/ignore_now/nxdlstructure_test.py new file mode 100644 index 0000000000000000000000000000000000000000..12e3392886853a613df00b77851ff0d616e1f599 --- /dev/null +++ b/tests/ignore_now/nxdlstructure_test.py @@ -0,0 +1,84 @@ + +''' +test structure analysis process of punx package +''' + +import lxml.etree +import os +import sys +import unittest +import tempfile + + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) +import punx.nxdlstructure +import punx.logs + + +class Structure__Issue_55(unittest.TestCase): + + def setUp(self): + punx.logs.ignore_logging() + + ns = dict( + xmlns='http://definition.nexusformat.org/nxdl/3.1', + xsi='http://www.w3.org/2001/XMLSchema-instance', + ) + + root = lxml.etree.Element('definition', category="base") + root.set('name', "NXunittest") + root.set('version', "1.0") + root.set('type', "group") + root.set('extends', "NXobject") + root.set('xmlns', "http://definition.nexusformat.org/nxdl/3.1") + #root.set('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance") + #root.set('xsi:schemaLocation', "http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd") + + lxml.etree.SubElement(root, 'doc') + node = lxml.etree.SubElement(root, 'field', name='data') + node.set('units', 'NX_ANY') + lxml.etree.SubElement(node, 'doc') + self.tree = lxml.etree.ElementTree(root) + + hfile = tempfile.NamedTemporaryFile(suffix='.xml', delete=False) + hfile.close() + self.test_file = hfile.name + + def tearDown(self): + if os.path.exists(self.test_file): + os.remove(self.test_file) + self.test_file = None + + def test_field_attribute_appears_in_structure(self): + self.assertIsInstance(self.tree, lxml.etree._ElementTree) + + # so far, self.test_file is empty + self.assertRaises(lxml.etree.XMLSyntaxError, + punx.nxdlstructure.NX_definition, + self.test_file) + + #self.tree.getroot() + with open(self.test_file, 'w') as fp: + buf = lxml.etree.tostring(self.tree).decode("utf-8") + fp.write(buf) + nxdl = punx.nxdlstructure.NX_definition(self.test_file) + self.assertIsInstance(nxdl, punx.nxdlstructure.NX_definition) + + structure_text = nxdl.render().splitlines() + self.assertEqual(len(structure_text), 3) + target = structure_text[2].strip() + self.assertGreaterEqual(target.find('@units'), 0) + self.assertEqual(target, '@units = NX_ANY') + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_suite.addTest(unittest.makeSuite(Structure__Issue_55)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/ignore_now/validate_test.py b/tests/ignore_now/validate_test.py new file mode 100644 index 0000000000000000000000000000000000000000..692da92d2f2bf426902eab38c73bd39c44d72176 --- /dev/null +++ b/tests/ignore_now/validate_test.py @@ -0,0 +1,622 @@ + +''' +test the punx validation process +''' + +import h5py +import os +import sys +import tempfile +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..', ) +if _path not in sys.path: + sys.path.insert(0, _path) +from tests import common + +_path = os.path.join(_path, 'src') +if _path not in sys.path: + sys.path.insert(0, _path) + + +def reference_file(fname): + path = os.path.dirname(__file__) + return os.path.abspath(os.path.join(path, 'data', 'validations', fname)) + + +class Validate_writer_1_3(common.ValidHdf5File): + + testfile = 'writer_1_3.hdf5' + expected_output = common.read_filelines(reference_file('writer_1_3.txt')) + + +class Validate_writer_2_1(common.ValidHdf5File): + + testfile = 'writer_2_1.hdf5' + expected_output = common.read_filelines(reference_file('writer_2_1.txt')) + + +class Validate_33id_spec_22_2D(common.ValidHdf5File): + + testfile = '33id_spec_22_2D.hdf5' + expected_output = common.read_filelines(reference_file('33id_spec_22_2D.txt')) + + +class Validate_compression(common.ValidHdf5File): + + testfile = 'compression.h5' + expected_output = common.read_filelines(reference_file('compression.txt')) + NeXus = False + + +class Validate_example_mapping(common.ValidHdf5File): + + testfile = 'example_mapping.nxs' + expected_output = common.read_filelines(reference_file('example_mapping.txt')) + NeXus = False + + +class CustomValidatorBase(unittest.TestCase): + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + # remove the testfile + if self.validator is not None: + self.validator.close() + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + +class Validate_NXdata_is_now_optional_51(CustomValidatorBase): + + def test_simple_NXdata(self): + import punx.validate, punx.finding, punx.logs + + hdf5root = h5py.File(self.hdffile, "w") + + entry = hdf5root.create_group("entry") + entry.attrs['NX_class'] = 'NXentry' + data = entry.create_group("data") + data.attrs['NX_class'] = 'NXdata' + data.attrs["signal"] = "data" + data.create_dataset("data", data="a string of characters") + + hdf5root.close() + + punx.logs.ignore_logging() + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + self.report = [] + + report = self.validator.report_findings(punx.finding.VALID_STATUS_LIST) + #print('\n' + report + '\n') + msg = 'NeXus default plot: /entry/data/data' + self.assertFalse(report.find('no default plot: not a NeXus file') >= 0, msg) + + report = self.validator.report_findings_summary().splitlines()[6] + #print('\n' + report + '\n') + msg = 'no ERRORs should be found' + self.assertEqual(int(report.split()[1]), 0, msg) + + + def test_simple_no_NXdata(self): + import punx.validate, punx.finding, punx.logs + + hdf5root = h5py.File(self.hdffile, "w") + + entry = hdf5root.create_group("entry") + entry.attrs['NX_class'] = 'NXentry' + + hdf5root.close() + + punx.logs.ignore_logging() + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + self.report = [] + + report = self.validator.report_findings(punx.finding.VALID_STATUS_LIST) + #print('\n' + report + '\n') + msg = 'no NeXus default plot, no NXdata group, valid NeXus as of NIAC2016' + self.assertFalse(report.find('no default plot: not a NeXus file') >= 0, msg) + + report = self.validator.report_findings_summary().splitlines()[6] + #print('\n' + report + '\n') + msg = 'no ERRORs should be found' + self.assertEqual(int(report.split()[1]), 0, msg) + + +class Validate_example_mapping_issue_53(CustomValidatorBase): + + def createContent(self, hdf5root): + ''' + abbreviated representation of example_mapping.nxs file + ''' + import numpy + entry = hdf5root.create_group("entry") + entry.attrs['NX_class'] = 'NXentry' + data = entry.create_group("data") + data.attrs['NX_class'] = 'NXdata' + data.attrs["signal"] = "data" + data.attrs["axes"] = [b"x", b"y"] + data.attrs["x_indices"] = [0,] + data.attrs["y_indices"] = [1,] + ds = data.create_dataset("data", data=numpy.array([[1,2,3], [3,1,2]], dtype=int)) + ds.attrs["interpretation"] = "image" + data.create_dataset("x", data=[1, 1.1, 1.3]) + data.create_dataset("y", data=[2.2, 2.5]) + + def test_indices_attribute_value_as_string_in_HDF5_file(self): + import punx.validate, punx.finding, punx.logs + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + self.createContent(hdf5root) + hdf5root.close() + + punx.logs.ignore_logging() + validator = punx.validate.Data_File_Validator(self.hdffile) + validator.validate() + findings_list = [str(f) for f in validator.findings] + # print('\n' + '\n'.join(findings_list) + '\n') + + self.assertGreaterEqual(len(validator.findings), 0) + self.assertEqual(validator.findings[0].status, punx.finding.OK) + # print(validator.report_findings(punx.finding.VALID_STATUS_LIST)) + self.assertEqual(validator.report_findings(punx.finding.ERROR), "None") + + expected = '/ OK: * valid NeXus data file: This file is valid by the NeXus standard.' + self.assertTrue(expected in findings_list, expected) + + validator.close() + + # re-write the *_indices attributes as str in that HDF5 and re-validate + hdf5root = h5py.File(self.hdffile, "r+") + hdf5root["/entry/data"].attrs["x_indices"] = [b"0",] + hdf5root["/entry/data"].attrs["y_indices"] = [b"1",] + hdf5root.close() + validator = punx.validate.Data_File_Validator(self.hdffile) + validator.validate() + self.assertGreaterEqual(len(validator.findings), 0) + self.assertEqual(validator.findings[0].status, punx.finding.OK) + # print(validator.report_findings(punx.finding.VALID_STATUS_LIST)) + self.assertEqual(validator.report_findings(punx.finding.ERROR), "None") + validator.close() + + +class Validate_issue_57(unittest.TestCase): + + def test_order_of_appearance__observation_1(self): + import punx.validate, punx.finding, punx.logs + import numpy + + # construct a test file and check it + fname = common.getTestFileName() + hdf5root = h5py.File(fname, 'w') + entry = hdf5root.create_group("entry") + entry.attrs['NX_class'] = 'NXentry' + data = entry.create_group("data") + data.attrs['NX_class'] = 'NXdata' + data.attrs["signal"] = "data" + ds = data.create_dataset("data", data=[[1,2,3], [3,1,2]]) + ds.attrs['target'] = ds.name + entry['ds_link'] = ds + + instrument = entry.create_group("instrument") + instrument.attrs['NX_class'] = 'NXinstrument' + detector = instrument.create_group("detector") + detector.attrs['NX_class'] = 'NXdetector' + detector['ccd'] = ds + + hdf5root.close() + + addresses_to_check_in_this_order = ''' + / + /entry + /entry@NX_class + /entry/data + /entry/data@NX_class + /entry/data@signal + /entry/data/data + /entry/ds_link + /entry/ds_link@target + /entry/instrument + /entry/instrument@NX_class + /entry/instrument/detector + /entry/instrument/detector@NX_class + /entry/instrument/detector/ccd + /entry/instrument/detector/ccd@target + '''.split() + + punx.logs.ignore_logging() + self.validator = punx.validate.Data_File_Validator(fname) + self.validator.validate() + # print('\n'.join(sorted(self.validator.addresses))) + self.assertEqual(len(self.validator.addresses), len(addresses_to_check_in_this_order)) + + addresses = sorted(list(self.validator.addresses.keys()), key=self.key_comparator) + #print('\n'.join(addresses)) + for order, addr in enumerate(addresses_to_check_in_this_order): + msg = 'HDF5 address not found: ' + addr + self.assertTrue(addr in self.validator.addresses, msg) + msg = 'expect ' + addr + msg += ' on row ' + str(order) + msg += ', found on row ' + str(addresses.index(addr)) + self.assertEqual(addr, addresses[order], msg) + + def key_comparator(self, a): + ''' + custom sorting key for all HDF5 addresses + ''' + addr = a.split('@') + if len(addr) == 2: # attribute + # k = self.key_comparator(addr[0]) + '!_4_' + k = '!_4_' + elif isinstance(self.validator.h5[addr[0]], h5py.Dataset): + k = '!_3_' + elif isinstance(self.validator.h5[addr[0]], h5py.Group): + k = '!_1_' + elif isinstance(self.validator.h5[addr[0]], h5py.File): + k = '!_0_' + else: + k = '!_5_' + r = addr[0] + k + if len(addr) == 2: + r += '@' + addr[1] + #print(r, '\t'*5, a) + return r + + def test_inconsistent_findings__observation_2(self): + import punx.validate, punx.finding, punx.logs + fname = common.punx_data_file_name('example_mapping.nxs') + punx.logs.ignore_logging() + validator = punx.validate.Data_File_Validator(fname) + validator.validate() + # print('\n'.join(sorted(validator.addresses))) + # self.assertEqual(len(validator.addresses), 114) + addresses_to_check = ''' + /entry1/instrument/fluo/transformations@NX_class + /entry1/instrument/fluo/transformations + /entry1/instrument/fluo/data@units + /entry1/instrument/fluo/energy@units + /entry1/instrument/fluo/transformations/detector_arm + /entry1/instrument/fluo/transformations@NX_class + /entry1/instrument/trans/transformations/monitor_arm + /entry1/sample/t_stage_set@units + /entry1/sample/x_stage_set@units + /entry1/sample/y_stage_set@units + /entry1/user/username + /entry1/user@NX_class + '''.split() + for addr in sorted(addresses_to_check): + msg = 'HDF5 address not found: ' + addr + self.assertTrue(addr in validator.addresses, msg) + + addresses_to_fail_check = ''' + /entry1/instrument/fluo/transformations@target + '''.split() + for addr in sorted(addresses_to_fail_check): + msg = 'HDF5 address not expected: ' + addr + self.assertFalse(addr in validator.addresses, msg) + + +class Validate_non_NeXus_files(CustomValidatorBase): + ''' + validate: various non-NeXus pathologies as noted + ''' + + def test__entry_and_data_groups_have_no_NX_class__attribute(self): + import punx.validate, punx.finding, punx.logs + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + entry = hdf5root.create_group('entry') + data = entry.create_group('data') + data.create_dataset("positions", data=range(5), dtype=int) + group = hdf5root.create_group('NX_class') + group.attrs['NX_class'] = 'NXcollection' + group = hdf5root.create_group('unknown') + group.attrs['NX_class'] = 'NXunknown' + group = hdf5root.create_group('NX_class_with_bad_capitalization') + group.attrs['NX_class'] = 'nXcapitalization' + group = hdf5root.create_group('NX_class_with_wrong_underline') + group.attrs['NX_class'] = 'NX_data' + hdf5root.close() + + # run the validation + punx.logs.ignore_logging() + validator = punx.validate.Data_File_Validator(self.hdffile) + validator.validate() + + # print('\n' + '\n'.join([str(f) for f in validator.findings]) + '\n') + + # apply tests + self.assertEqual(len(validator.addresses), + 11, + 'number of classpath entries discovered') + + root = validator.addresses['/'] + self.assertEqual(str(root.findings[0]), + '/ OK: @NX_class: file root (assumed): NXroot', + 'assume File root is NXroot') + + entry = validator.addresses['/entry'] + self.assertEqual(str(entry.findings[1]), + '/entry NOTE: @NX_class: no @NX_class attribute, not a NeXus group', + '/entry is not NeXus') + self.assertFalse('/entry/data' in validator.addresses, + '/entry/data not inspected since /entry is non-NeXus group') + + k = '/NX_class' + self.assertTrue(k in validator.addresses, 'found: '+k) + group = validator.addresses[k] + self.assertEqual(str(group.findings[0]), # FIXME: should be False + '/NX_class OK: NeXus internal attribute: marks this HDF5 group as NeXus group', + 'BUT this is a group name, not an attribute') + self.assertEqual(str(validator.addresses[k+'@NX_class'].findings[0]), + '/NX_class@NX_class OK: @NX_class: known: NXcollection', + 'known base class') + + ignoring = ' UNUSED: not NeXus group: ignoring content in group not defined by NeXus' + k = '/unknown' + self.assertTrue(k in validator.addresses, 'found: '+k) + group = validator.addresses[k] + self.assertEqual(str(group.findings[1]), + k + ignoring, + 'unknown NeXus class') + self.assertEqual(str(validator.addresses[k+'@NX_class'].findings[0]), + '/unknown@NX_class ERROR: @NX_class: unknown: NXunknown', + 'unknown NeXus class') + + k = '/NX_class_with_bad_capitalization' + self.assertTrue(k in validator.addresses, 'found: '+k) + group = validator.addresses[k] + self.assertEqual(str(group.findings[1]), + k + ignoring, + 'unknown NeXus class') + self.assertEqual(str(validator.addresses[k+'@NX_class'].findings[0]), + '/NX_class_with_bad_capitalization@NX_class ERROR: @NX_class: unknown: nXcapitalization', + 'should be flagged as bad capitalization') + + k = '/NX_class_with_wrong_underline' + self.assertTrue(k in validator.addresses, 'found: '+k) + group = validator.addresses[k] + self.assertEqual(str(group.findings[1]), + k + ignoring, + 'unknown NeXus class') + self.assertEqual(str(validator.addresses[k+'@NX_class'].findings[0]), + '/NX_class_with_wrong_underline@NX_class ERROR: @NX_class: unknown: NX_data', + 'should be flagged as wrong underline') + + self.assertEqual(str(validator.findings[-1]), + '/ ERROR: ! valid NeXus data file: This file is not valid by the NeXus standard.', + 'Not a NeXus HDF5 data file') + + def test__no_groups__only_data(self): + import punx.validate, punx.finding, punx.logs + import numpy + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + hdf5root.create_dataset("x", data=numpy.array([[1,2,3], [3,1,2]], dtype=int)) + hdf5root.close() + + # run the validation + punx.logs.ignore_logging() + validator = punx.validate.Data_File_Validator(self.hdffile) + validator.validate() + + #print('\n' + '\n'.join([str(f) for f in validator.findings]) + '\n') + + self.assertEqual(str(validator.findings[-1]), + '/ ERROR: ! valid NeXus data file: This file is not valid by the NeXus standard.', + 'Not a NeXus HDF5 data file') + + +class Validate_borderline_cases(CustomValidatorBase): + ''' + validate: various non-NeXus pathologies as noted + ''' + + def test_raises___punx_HDF5_Open_Error_exception___if_not_an_HDF5_file(self): + import punx.validate, punx.finding, punx.logs + + with open(self.hdffile, 'w') as fp: + fp.write('text') + + punx.logs.ignore_logging() + self.assertRaises(punx.HDF5_Open_Error, + punx.validate.Data_File_Validator, self.hdffile) + + def test_hdf5_data_file_not_found(self): + import punx.validate, punx.finding, punx.logs + + # run the validation + punx.logs.ignore_logging() + self.assertRaises(punx.FileNotFound, + punx.validate.Data_File_Validator, 'NO_File_By_This.Name') + + def test_no_signal_attribute(self): + import punx.validate, punx.finding, punx.logs + import numpy + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.create_dataset("x", data=numpy.array([[1,2,3], [3,1,2]], dtype=int)) + hdf5root.close() + + # run the validation + punx.logs.ignore_logging() + validator = punx.validate.Data_File_Validator(self.hdffile) + validator.validate() + + # print('\n' + '\n'.join([str(f) for f in validator.findings]) + '\n') + + # apply tests + self.assertEqual(len(validator.addresses), + 7, + 'number of classpath entries discovered') + + k = '/NXentry/NXdata/field' + self.assertTrue(k in validator.addresses, + 'data found') + + m = k + ' WARN: NeXus default plot: only one /NXentry/NXdata/field exists but no signal indicated' + self.assertTrue(m in [str(f) for f in validator.addresses[k].findings], + 'data found') + + +class Validate_error_with_default_attribute(CustomValidatorBase): + ''' + validate: when default attribute is incorrect + ''' + + def test_default_attribute_value_is_wrong(self): + import punx.validate, punx.finding, punx.logs + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + hdf5root.attrs['default'] = 'entry' + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + entry.attrs['default'] = 'entry' # this is the error, should be 'data' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = 'positions' + data.create_dataset("positions", data=range(5), dtype=int) + data = entry.create_group('other') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = 'x' + data.create_dataset("positions", data=range(5), dtype=int) + data.create_dataset("other", data=range(5), dtype=int) + hdf5root.close() + + # run the validation + punx.logs.ignore_logging() + validator = punx.validate.Data_File_Validator(self.hdffile) + validator.validate() + + # print('\n' + '\n'.join([str(f) for f in validator.findings]) + '\n') + + reported_findings = [str(f).strip() for f in validator.findings] + expected_findings = '''\ + / OK: @NX_class: file root (assumed): NXroot + /@default OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /@default OK: default plot group: exists: entry + /entry OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /entry@NX_class OK: @NX_class: known: NXentry + /entry@default OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /entry@default ERROR: default plot group: does not exist: entry + /entry/data OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /entry/data@NX_class OK: @NX_class: known: NXdata + /entry/data/positions UNUSED: NXdata@ignoreExtraFields: field ignored per NXDL specification + /entry/data TODO: NXDL review: validate with NXdata specification (incomplete) + /entry/other OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /entry/other@NX_class OK: @NX_class: known: NXdata + /entry/other/other UNUSED: NXdata@ignoreExtraFields: field ignored per NXDL specification + /entry/other/positions UNUSED: NXdata@ignoreExtraFields: field ignored per NXDL specification + /entry/other TODO: NXDL review: validate with NXdata specification (incomplete) + /entry TODO: NXDL review: validate with NXentry specification (incomplete) + / TODO: NXDL review: validate with NXroot specification (incomplete) + /entry/data@signal OK: NXdata group default plot v3: NXdata@signal = positions + /entry/data OK: NXdata dimension scale(s): dimension scale(s) verified + /entry/other@signal ERROR: NXdata group default plot v3: /NXentry/NXdata@signal field not found: x + /entry/data OK: /NXentry/NXdata@signal=positions: NeXus default plot v3 + / OK: * valid NeXus data file: This file is valid by the NeXus standard. + ''' + + expect = '/entry@default ERROR: default plot group: does not exist: entry' + self.assertTrue(expect in reported_findings, + 'identified incorrect default attribute') + + expect = '/@default OK: default plot group: exists: entry' + self.assertTrue(expect in reported_findings, + 'identified correct default attribute') + + expect = '/entry/data@signal OK: NXdata group default plot v3: NXdata@signal = positions' + self.assertTrue(expect in reported_findings, + 'identified correct signal attribute') + + expect = '/entry/other@signal ERROR: NXdata group default plot v3: /NXentry/NXdata@signal field not found: x' + self.assertTrue(expect in reported_findings, + 'identified incorrect signal attribute') + + +class Validate_NXDL__issue_63(unittest.TestCase): + ''' + issue #63: validate: build test for ``lxml.etree.DocumentInvalid`` + ''' + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.xml', delete=False) + tfile.close() + self.test_file = tfile.name + + def tearDown(self): + # remove the testfile + os.remove(self.test_file) + self.test_file = None + + def test_validate_xml___with_invalid_xml_file(self): + import lxml.etree + import punx.validate, punx.finding, punx.logs + + with open(self.test_file, 'w') as fp: + fp.write('not XML file') + + punx.logs.ignore_logging() + self.assertRaises(lxml.etree.XMLSyntaxError, + punx.validate.validate_xml, self.test_file) + + def test_validate_xml___with_invalid_NXDL_file(self): + import lxml.etree + import punx.validate, punx.finding, punx.logs + + with open(self.test_file, 'w') as fp: + fp.write('<?xml version="1.0" encoding="UTF-8"?>\n') + fp.write('<empty_root_node />\n') + + punx.logs.ignore_logging() + self.assertRaises( + punx.InvalidNxdlFile, + punx.validate.validate_xml, + self.test_file) + + + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Validate_writer_1_3, + Validate_writer_2_1, + Validate_33id_spec_22_2D, + Validate_compression, + Validate_NXdata_is_now_optional_51, + Validate_example_mapping, + Validate_example_mapping_issue_53, + Validate_issue_57, + Validate_non_NeXus_files, + Validate_borderline_cases, + Validate_error_with_default_attribute, + Validate_NXDL__issue_63, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/ignore_now/warnings_test.py b/tests/ignore_now/warnings_test.py new file mode 100644 index 0000000000000000000000000000000000000000..89943c24b941256db779a385c4899a8e3585a5f3 --- /dev/null +++ b/tests/ignore_now/warnings_test.py @@ -0,0 +1,166 @@ + +''' +issue 14: implement warnings as advised in NeXus manual + +:see: http://download.nexusformat.org/doc/html/search.html?q=warning&check_keywords=yes&area=default + +Actually, flag them as NOTE unless WARN is compelling +''' + +import h5py +import numpy +import os +import sys +import tempfile +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) + + +class Warning__1(unittest.TestCase): + ''' + whatever + ''' + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + if self.validator is not None: + self.validator.close() + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + def test_NXcollection_always_generates_a_warning(self): + ''' + For NeXus validation, NXcollection will always generate a + warning since it is always an optional group. + Anything (groups, fields, or attributes) placed in an + NXcollection group will not be validated. + ''' + self.assertTrue(True, 'tba') + + def test_note_items_added_to_base_class_and_not_in_NXDL(self): + ''' + Validation procedures should treat such additional + items (not covered by a base class specification) + as notes or warnings rather than errors. + ''' + self.assertTrue(True, 'tba') + + def test_NXDL_attribute__ignoreExtraAttributes(self): + ''' + Only validate known attributes; do not not warn about unknowns. + + The ignoreExtraAttributes attribute is a flag to the process of + validating NeXus data files. By setting ignoreExtraAttributes="true", + presence of any undefined attributes in this class will not generate + warnings during validation. Normally, validation will check all the + attributes against their definition in the NeXus base classes and + application definitions. Any items found that do not match the + definition in the NXDL will generate a warning message. + ''' + self.assertTrue(True, 'tba') + + def test_NXDL_attribute__ignoreExtraFields(self): + ''' + Only validate known fields; do not not warn about unknowns. + + The ignoreExtraFields attribute is a flag to the process of + validating NeXus data files. By setting ignoreExtraFields="true", + presence of any undefined fields in this class will not generate + warnings during validation. Normally, validation will check all + the fields against their definition in the NeXus base classes + and application definitions. Any items found that do not match + the definition in the NXDL will generate a warning message. + ''' + self.assertTrue(True, 'tba') + + def test_NXDL_attribute__ignoreExtraGroups(self): + ''' + Only validate known groups; do not not warn about unknowns. + + The ignoreExtraGroups attribute is a flag to the process of + validating NeXus data files. By setting ignoreExtraGroups="true", + presence of any undefined groups in this class will not generate + warnings during validation. Normally, validation will check all + the groups against their definition in the NeXus base classes and + application definitions. Any items found that do not match the + definition in the NXDL will generate a warning message. + ''' + self.assertTrue(True, 'tba') + + def test_naming_conventions__issue_65(self): + import punx.validate, punx.finding, punx.logs + punx.logs.ignore_logging() + + # create the HDF5 content + hdf5root = h5py.File(self.hdffile, "w") + entry = hdf5root.create_group('entry') + entry.attrs['NX_class'] = 'NXentry' + data = entry.create_group('data') + data.attrs['NX_class'] = 'NXdata' + data.attrs['signal'] = 'valid_item_name_strict' + data.create_dataset('data', data=range(5)) + entry.create_dataset('strict', data=range(5)) + entry.create_dataset('Relaxed', data=range(5)) + entry.create_dataset('not.allowed', data=range(5)) + entry.create_dataset('also not allowed', data=range(5)) + entry.create_dataset('_starts_with_underscore', data=range(5)) + entry.create_dataset('0_starts_with_number', data=range(5)) + entry.create_dataset('dataset_name_has@symbol', data=range(5)) + entry.attrs['@@@'] = 'invalid' + entry.attrs['@attribute'] = 'invalid' + entry.attrs['attribute@'] = 'invalid' + hdf5root.close() + + self.validator = punx.validate.Data_File_Validator(self.hdffile) + self.validator.validate() + all_findings = [str(f) for f in self.validator.findings] + # print('\n' + '\n'.join(all_findings) + '\n') + + expected_findings = '''\ + /entry/0_starts_with_number WARN: validItemName: valid HDF5 item name, not valid with NeXus + /entry/0_starts_with_number@units NOTE: field@units: does not exist + /entry/_starts_with_underscore OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /entry/_starts_with_underscore@units NOTE: field@units: does not exist + /entry/Relaxed NOTE: validItemName: relaxed re: [A-Za-z_][\w_]* + /entry/Relaxed@units NOTE: field@units: does not exist + /entry/also not allowed WARN: validItemName: valid HDF5 item name, not valid with NeXus + /entry/also not allowed@units NOTE: field@units: does not exist + /entry/dataset_name_has@symbol WARN: validItemName: valid HDF5 item name, not valid with NeXus + /entry/not.allowed WARN: validItemName: valid HDF5 item name, not valid with NeXus + /entry/not.allowed@units NOTE: field@units: does not exist + /entry/strict OK: validItemName-strict: strict re: [a-z_][a-z0-9_]* + /entry/strict@units NOTE: field@units: does not exist + /entry@@@@ WARN: validItemName: valid HDF5 attribute name, not valid with NeXus + /entry@@attribute WARN: validItemName: valid HDF5 attribute name, not valid with NeXus + /entry@attribute@ WARN: validItemName: valid HDF5 attribute name, not valid with NeXus + '''.splitlines() + + for f in expected_findings: + if len(f.strip()) > 0: + # print('expecting: '+f) + self.assertTrue(f.strip() in all_findings, f) + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Warning__1, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner() + runner.run(suite()) diff --git a/tests/nxdl_manager_test.py b/tests/nxdl_manager_test.py new file mode 100644 index 0000000000000000000000000000000000000000..95518be71e927b02843bdfb87b222561342442f1 --- /dev/null +++ b/tests/nxdl_manager_test.py @@ -0,0 +1,157 @@ + +''' +test punx tests/nxdl_manager module +''' + +# TODO: lots more tests could be constructed! + +import lxml.etree +import os +import sys +import tempfile +import unittest + +import github + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))) +import punx, punx.nxdl_manager + + +class No_Exception(Exception): pass + + +class Test_XML_functions(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + def raises_exception(self, text): + try: + lxml.etree.fromstring(text) + except lxml.etree.XMLSyntaxError as exc: + raise exc + except Exception as exc: + raise exc + else: + raise No_Exception + + def test_xml_validation__valid(self): + self.assertRaises( + No_Exception, + self.raises_exception, '<good_root />') + + def test_xml_validation__invalid(self): + self.assertRaises( + lxml.etree.XMLSyntaxError, + self.raises_exception, '<#bad_root />') + + def test_nxdl_definition__invalid(self): + def_text = ''' + <definition/> + ''' + self.assertRaises( + No_Exception, + self.raises_exception, def_text) + tree = lxml.etree.fromstring(def_text) + self.assertRaises( + ValueError, # TODO: should be: punx.InvalidNxdlFile, + punx.nxdl_manager.validate_xml_tree, tree) + pass + + +class Test_get_NXDL_file_list(unittest.TestCase): + + def test__FileNotFound(self): + self.assertRaises( + IOError, # TODO: should be: punx.FileNotFound, + punx.nxdl_manager.get_NXDL_file_list, + '!this directory does not exist') + + def test__IOError(self): + self.assertRaises( + IOError, + punx.nxdl_manager.get_NXDL_file_list, + os.path.dirname(__file__)) + + def test__function(self): + import punx.cache_manager + + cm = punx.cache_manager.CacheManager() + self.assertNotEqual(cm, None, 'a cache is available') + self.assertTrue( + cm.default_file_set is not None, + 'a default cache is defined') + fs = cm.default_file_set + self.assertTrue( + os.path.exists(fs.path), + 'cache path defined as: ' + str(fs.path) + ) + + nxdl_files = punx.nxdl_manager.get_NXDL_file_list(fs.path) + self.assertGreater( + len(nxdl_files), + 0, + 'NXDL files found: ' + str(len(nxdl_files))) + + +class Test_NXDL_Manager(unittest.TestCase): + + def test__FileNotFound(self): + import punx.cache_manager + fs = punx.cache_manager.NXDL_File_Set() + self.assertRaises( + IOError, # TODO: should be: punx.FileNotFound, + punx.nxdl_manager.NXDL_Manager, fs) + + def test__function(self): + import punx.cache_manager + + cm = punx.cache_manager.CacheManager() + fs = cm.default_file_set + self.assertTrue( + os.path.exists(fs.path), + 'cache path defined as: ' + str(fs.path) + ) + + nxdl_defs = punx.nxdl_manager.NXDL_Manager(fs).classes + self.assertTrue( + isinstance(nxdl_defs, dict), + 'NXDL definitions dict type: ' + str(type(nxdl_defs))) + self.assertGreater( + len(nxdl_defs), + 0, + 'NXDL files found: ' + str(len(nxdl_defs))) + for k, v in nxdl_defs.items(): + self.assertTrue( + isinstance(v, punx.nxdl_manager.NXDL__definition), + 'NXDL definitions type: '+ k +'=' + str(type(v))) + + def test_expected_attributes(self): + import punx.cache_manager + + cm = punx.cache_manager.CacheManager() + nxdl_defs = punx.nxdl_manager.NXDL_Manager().classes + self.assertTrue("NXroot" in nxdl_defs) + self.assertTrue("NX_class" in nxdl_defs["NXroot"].attributes) + self.assertTrue("NXentry" in nxdl_defs) + self.assertFalse("NX_class" in nxdl_defs["NXentry"].attributes) + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_XML_functions, + Test_get_NXDL_file_list, + Test_NXDL_Manager, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/nxdl_schema_test.py b/tests/nxdl_schema_test.py new file mode 100644 index 0000000000000000000000000000000000000000..6b229e203c79779b38f53db51a8b9fa5dd1b20cc --- /dev/null +++ b/tests/nxdl_schema_test.py @@ -0,0 +1,142 @@ + +''' +test punx tests/nxdl_schema module +''' + +import lxml.etree +import os +import sys +import tempfile +import unittest + +SRCPATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src')) +sys.path.insert(0, SRCPATH) +from punx import cache_manager, nxdl_schema + + +class MyClass(object): + ''' + used when testing nxdl_schema.render_class_str() + ''' + + def __init__(self): + self.this = None + self.that = 'that has a value' + + def __str__(self, *args, **kws): + return nxdl_schema.render_class_str(self) + + +class Test_Functions(unittest.TestCase): + + def test_namespace_dictionary(self): + ns = nxdl_schema.get_xml_namespace_dictionary() + self.assertTrue(isinstance(ns, dict)) + self.assertTrue('xs' in ns) + self.assertTrue('nx' in ns) + + def test_render_class_str(self): + obj = MyClass() + self.assertTrue(isinstance(obj, MyClass)) + s = str(obj) + self.assertGreaterEqual(s.find('MyClass'), 0, s) + self.assertLess(s.find('this'), 0, str(obj.this)) + self.assertGreaterEqual(s.find('that'), 0, str(obj.that)) + + def test_get_reference_keys(self): + cm = cache_manager.CacheManager() + fname = os.path.join(cm.default_file_set.path, 'nxdl.xsd') + self.assertTrue(os.path.exists(fname)) + + tree = lxml.etree.parse(fname) + ns = nxdl_schema.get_xml_namespace_dictionary() + query = '//xs:element/xs:complexType' + nodes = tree.getroot().xpath(query, namespaces=ns) + self.assertEqual(len(nodes), 3) + + section, line = nxdl_schema.get_reference_keys(nodes[0]) + self.assertTrue(isinstance(section, str)) + self.assertTrue(isinstance(line, str)) + self.assertEqual(section, query.split(':')[-1]) + self.assertEqual(line.split()[0], 'Line') + + def test_get_named_parent_node(self): + cm = cache_manager.CacheManager() + fname = os.path.join(cm.default_file_set.path, 'nxdl.xsd') + self.assertTrue(os.path.exists(fname)) + + tree = lxml.etree.parse(fname) + ns = nxdl_schema.get_xml_namespace_dictionary() + query = '//xs:complexType//xs:element' + nodes = tree.getroot().xpath(query, namespaces=ns) + self.assertGreater(len(nodes), 0) + + xml_node = nodes[0] + self.assertTrue(isinstance(xml_node, lxml.etree._Element)) + parent_node = nxdl_schema.get_named_parent_node(xml_node) + self.assertTrue(isinstance(parent_node, lxml.etree._Element)) + self.assertTrue('name' in parent_node.attrib) + + query = '/xs:schema/xs:element' + nodes = tree.getroot().xpath(query, namespaces=ns) + self.assertEqual(len(nodes), 1) + parent_node = nxdl_schema.get_named_parent_node(nodes[0]) + self.assertTrue(parent_node.tag.endswith('}schema')) + + +class Test_Catalog(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + def test_NXDL_item_catalog_creation(self): + cm = cache_manager.CacheManager() + fname = os.path.join(cm.default_file_set.path, 'nxdl.xsd') + self.assertTrue(os.path.exists(fname)) + + catalog = nxdl_schema.NXDL_item_catalog(fname) + self.assertTrue(isinstance(catalog, nxdl_schema.NXDL_item_catalog)) + + def issue_67_main(self): + summary = nxdl_schema.NXDL_Summary(nxdl_schema.NXDL_TEST_FILE) + count, db = nxdl_schema.print_tree(summary.definition) + print(count, db) + + def test_NXDL_item_catalog_issue_67_main(self): + fpath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + sys.path.insert(0, fpath) + import tests.common + with tests.common.Capture_stdout() as printed_lines: + self.issue_67_main() + # 81 lines when this module run standalone + # 180 lines when this module run as part of suite + # 19 while refactoring issue 72 + self.assertIn(len(printed_lines), (19, 81, 180)) + # TODO: could do more extensive testing here + + def test_NXDL_summary(self): + summary = nxdl_schema.NXDL_Summary(nxdl_schema.NXDL_TEST_FILE) + self.assertTrue(isinstance(summary, nxdl_schema.NXDL_Summary)) + s2 = nxdl_schema.NXDL_Summary(nxdl_schema.NXDL_TEST_FILE) + self.assertTrue(isinstance(s2, nxdl_schema.NXDL_Summary)) + self.assertNotEqual(summary, s2, 'no longer using singleton') + # TODO: could do more extensive testing here + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_Functions, + Test_Catalog, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/schema_manager_test.py b/tests/schema_manager_test.py new file mode 100644 index 0000000000000000000000000000000000000000..69c5b6ddf888b021492db3e7cdb8cac7570d28bc --- /dev/null +++ b/tests/schema_manager_test.py @@ -0,0 +1,74 @@ + +''' +test punx tests/schema_manager module +''' + +import os +import sys +import unittest + +import github + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))) +import punx, punx.schema_manager + + +class Test_SchemaManager_Module(unittest.TestCase): + + def test_strip_ns_function(self): + self.assertEqual(punx.schema_manager.strip_ns('first:second'), u'second') + + def test_raise_error_function(self): + import lxml.etree + def_text = ''' + <definition/> + ''' + node = lxml.etree.fromstring(def_text) + + self.assertRaises( + ValueError, + punx.schema_manager.raise_error, node, 'root = ', 'definition') + + def test_SchemaManager_class(self): + sm = punx.schema_manager.get_default_schema_manager() + self.assertTrue(isinstance(sm, punx.schema_manager.SchemaManager)) + self.assertTrue(os.path.exists(sm.schema_file)) + self.assertTrue(isinstance(sm.ns, dict)) + self.assertGreater(len(sm.ns), 0) + self.assertTrue(isinstance(sm.nxdl, punx.schema_manager.Schema_Root)) + + +class Test_get_default_schema_manager(unittest.TestCase): + + def test__function(self): + import punx.cache_manager + + default_sm = punx.schema_manager.get_default_schema_manager() + self.assertTrue(isinstance(default_sm, punx.schema_manager.SchemaManager)) + + cm = punx.cache_manager.CacheManager() + assert(cm is not None and cm.default_file_set is not None) + # pick any other known NXDL file set (not the default) + ref_list = list(cm.NXDL_file_sets.keys()) + ref_list.remove(cm.default_file_set.ref) + if len(ref_list) > 0: + fs = cm.NXDL_file_sets[ref_list[0]] + other_sm = fs.schema_manager + self.assertNotEqual(default_sm.schema_file, other_sm.schema_file, 'schema files are different') + self.assertNotEqual(default_sm.types_file, other_sm.types_file, 'nxdlTypes files are different') + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_SchemaManager_Module, + Test_get_default_schema_manager, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/utils_test.py b/tests/utils_test.py new file mode 100644 index 0000000000000000000000000000000000000000..a2d126ab83a4436b3717e7dd1f44dd9d77ffe8b6 --- /dev/null +++ b/tests/utils_test.py @@ -0,0 +1,150 @@ + +''' +test punx tests/utils module +''' + +import os +import sys +import h5py +import h5py.h5g +import numpy +import tempfile +import unittest + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))) +import punx, punx.utils + + +class No_Exception(Exception): pass + + +class Test_decode_byte_string(unittest.TestCase): + + def test_numpy_ndarray(self): + s = "this is a test" + arr = numpy.array([s, ]) + self.assertEqual(s, punx.utils.decode_byte_string(arr), 'numpy.ndarray string') + + def test_numpy_bytes_(self): + s = "this is a test" + arr = numpy.bytes_(s) + self.assertEqual(s, punx.utils.decode_byte_string(arr), 'numpy.bytes_ string') + + def test_byte_string(self): + s = "this is a test" + try: + arr = bytes(s) + self.assertEqual(s, punx.utils.decode_byte_string(arr), 'byte string') + except Exception as _exc: + self.assertTrue(True, "no bytes() method, byte string test skipped") + + +class Test_HDF5_Tests(unittest.TestCase): + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hfile = tfile.name + + def tearDown(self): + os.remove(self.hfile) + self.hfile = None + + def test_isHdf5FileObject(self): + f = h5py.File(self.hfile) + self.assertFalse(punx.utils.isHdf5FileObject(self.hfile)) + self.assertTrue(punx.utils.isHdf5FileObject(f)) + f.close() + + def test_isHdf5FileObject(self): + f = h5py.File(self.hfile) + self.assertFalse(punx.utils.isHdf5Group(self.hfile)) + self.assertFalse(punx.utils.isHdf5Group(f)) + g = f.create_group("name") + self.assertTrue(punx.utils.isHdf5Group(g)) + self.assertTrue(punx.utils.isHdf5Group(f["name"])) + self.assertTrue(punx.utils.isHdf5Group(f["/name"])) + f.close() + + def test_isHdf5Dataset(self): + f = h5py.File(self.hfile) + self.assertFalse(punx.utils.isHdf5Dataset(self.hfile)) + self.assertFalse(punx.utils.isHdf5Dataset(f)) # file is a group, too + ds = f.create_dataset("name", data=1.0) + self.assertTrue(punx.utils.isHdf5Dataset(ds)) + self.assertTrue(punx.utils.isHdf5Dataset(f["name"])) + self.assertTrue(punx.utils.isHdf5Dataset(f["/name"])) + f.close() + + def test_isHdf5Group(self): + f = h5py.File(self.hfile) + self.assertFalse(punx.utils.isHdf5Group(self.hfile)) + self.assertFalse(punx.utils.isHdf5Group(f)) + g = f.create_group("group") + self.assertTrue(punx.utils.isHdf5Group(g)) + self.assertEqual(g, f["/group"]) + f.close() + + def test_isHdf5Link(self): + f = h5py.File(self.hfile) + ds = f.create_dataset("name", data=1.0) + f["/link"] = f["/name"] + self.assertTrue(punx.utils.isHdf5Link(f["/link"])) + f.close() + + def test_isHdf5ExternalLink(self): + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + f1_name = tfile.name + + f1 = h5py.File(f1_name) + ds = f1.create_dataset("name", data=1.0) + f1.close() + + f2 = h5py.File(self.hfile) + f2["/link"] = h5py.ExternalLink(f1_name, "/name") + f2.close() + + f2 = h5py.File(self.hfile) + + # h5py.ExternalLink is transparent in standard API + self.assertFalse(punx.utils.isHdf5ExternalLink(f2, f2["/link"])) + + # use file.get(addr, getlink=True) to examine ExternalLink + _link_true = f2.get("/link", getlink=True) + self.assertTrue(punx.utils.isHdf5ExternalLink(f2, _link_true)) + _link_false = f2.get("/link", getlink=False) + self.assertFalse(punx.utils.isHdf5ExternalLink(f2, _link_false)) + # discard the references so h5py will release its hold + del _link_true, _link_false + f2.close() + + os.remove(f1_name) + + f2 = h5py.File(self.hfile) + _link_true = f2.get("/link", getlink=True) + self.assertTrue(punx.utils.isHdf5ExternalLink(f2, _link_true)) + _link_false = f2.get("/link", getlink=False) + self.assertFalse(punx.utils.isHdf5ExternalLink(f2, _link_false)) + with self.assertRaises(KeyError): + # can't access the node because external link file is missing + punx.utils.isHdf5ExternalLink(f2, f2["/link"]) + del _link_true, _link_false + f2.close() + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_decode_byte_string, + Test_HDF5_Tests, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite()) diff --git a/tests/validate_test.py b/tests/validate_test.py new file mode 100644 index 0000000000000000000000000000000000000000..297ee5723bfe8761a8813b16dfe32d15d3a07fd7 --- /dev/null +++ b/tests/validate_test.py @@ -0,0 +1,739 @@ + +''' +test punx tests/validate module + +ISSUES + +.. note:: + Add new issues here with empty brackets, add "*" when issue is fixed. + Issues will only be marked "fixed" on GitHub once this branch is merged. + Then, this table may be removed. + +* [ ] #110 all validation tests passing +* [*] #95 validate item names in the classpath dict +* [ ] #94 lazy load NXDL details only when needed +* [*] #93 special classpath for non-NeXus groups +* [*] #92 add attributes to classpath +* [ ] #91 test changes in NXDL rules +* [*] #89 while refactoring 72, fix logging +* [ ] #72 refactor to validate application definitions + +''' + +import os +import sys +import h5py +import numpy +import tempfile +import unittest + +_path = os.path.join(os.path.dirname(__file__), '..', 'src') +if _path not in sys.path: + sys.path.insert(0, _path) +import punx.utils +import punx.validate + +DEFAULT_NXDL_FILE_SET = None +# DEFAULT_NXDL_FILE_SET = "master" + + +class No_Exception(Exception): pass + + +class Test_Constructor_Exceptions(unittest.TestCase): + + def test_bad_file_set_reference(self): + self.assertRaises( + KeyError, + punx.validate.Data_File_Validator, + 'bad file set reference') + + def test_bad_file_name_detected(self): + v = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.assertRaises(punx.FileNotFound, v.validate, 'bad file name') + + def test_not_HDF5_file_detected(self): + v = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.assertRaises(punx.HDF5_Open_Error, v.validate, __file__) + + +class Test_Constructor(unittest.TestCase): + + def avert_exception(self, fname): + try: + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(fname) + except Exception as _exc: + pass + else: + self.validator.close() + self.validator = None + raise No_Exception + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + if self.validator is not None: + self.validator.close() + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + def test_valid_hdf5_file_constructed(self): + with h5py.File(self.hdffile) as f: + f['item'] = 5 + + self.assertRaises(No_Exception, self.avert_exception, self.hdffile) + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + self.assertTrue( + punx.utils.isHdf5FileObject(self.validator.h5), + "is valid HDF5 file") + self.validator.close() + self.validator = None + + def test_valid_nexus_file_constructed(self): + with h5py.File(self.hdffile) as f: + g = f.create_group("entry") + g.attrs["NX_class"] = "NXentry" + + self.assertRaises(No_Exception, self.avert_exception, self.hdffile) + self.assertTrue(punx.utils.isNeXusFile(self.hdffile), "is valid NeXus file") + + +class Test_Changing_NXDL_Rules(unittest.TestCase): + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + if self.validator is not None: + self.validator.close() + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + def test_NXdata_requirement_or_optional(self): + """ + check for changes in NXDL rules + + (#91) test something that is defined in + one NXDL file set but not another, + such as: NXdata group not required after NIAC2016 + + Before v3.2, part of the NXentry definition read:: + + <group type="NXdata" minOccurs="1"> + <doc>The required data group</doc> + </group> + + With v3.2 and after, the same part was changed to:: + + <group type="NXdata"> + <doc> + The data group + </doc> + </group> + + note: v3.1.0 had a much simpler version:: + + <group type="NXdata" /> + + It was stated only in the manual that NXdata + was required. Not suitable for automated validation. + """ + # minimal test file + with h5py.File(self.hdffile) as f: + eg = f.create_group(u"entry") + eg.attrs[u"NX_class"] = u"NXentry" + #eg.create_dataset(u"title", data=u"NXdata group not provided") + + refs = dict( + nxdata_required=u"a4fd52d", + nxdata_not_required=u"v3.3") + self.validator = {} + + ref = refs["nxdata_required"] + try: + self.validator = punx.validate.Data_File_Validator(ref=refs["nxdata_required"]) + except KeyError: + msg = u"NXDL rule set %s not installed, cannot test" % ref + self.assertTrue(False, msg) + self.validator.validate(self.hdffile) + self.assertTrue(u"NXentry/NXdata" not in self.validator.classpaths) + group = self.validator.addresses[u"/"].validations + + # look in "/" for Finding with ERROR because NXdata is required + found = [v for v in group.values() if v.status == punx.finding.ERROR] + self.assertEqual(len(found), 1, "ERROR located") + self.validator.close() + + ref = refs["nxdata_not_required"] + try: + self.validator = punx.validate.Data_File_Validator(ref=refs["nxdata_not_required"]) + except KeyError: + msg = u"NXDL rule set %s not installed, cannot test" % ref + self.assertTrue(False, msg) + self.validator.validate(self.hdffile) + self.assertTrue(u"NXentry/NXdata" not in self.validator.classpaths) + group = self.validator.addresses[u"/"].validations + + # look in "/" for absence of Finding with ERROR because NXdata is not required + found = [v for v in group.values() if v.status == punx.finding.ERROR] + self.assertEqual(len(found), 0, "ERROR located") + + # look in "/" for presence of Finding with NOTE because NXdata is not required but recommended + found = [v for v in group.values() if v.status == punx.finding.NOTE] + self.assertEqual(len(found), 1, "NOTE located") + + +class Test_Validate(unittest.TestCase): + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + if self.validator is not None: + self.validator.close() + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + def setup_simple_test_file(self, create_validator=True): + with h5py.File(self.hdffile) as f: + f.attrs["default"] = "entry" + eg = f.create_group("entry") + eg.attrs["NX_class"] = "NXentry" + eg.attrs["default"] = "data" + dg = eg.create_group("data") + dg.attrs["NX_class"] = "NXdata" + dg.attrs["signal"] = "data" + ds = dg.create_dataset("data", data=[1, 2, 3.14]) + ds.attrs["units"] = "arbitrary" + eg["link_to_data"] = ds + + self.expected_item_count = 12 + if create_validator: + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + def use_example_file(self, fname): + path = os.path.join(os.path.dirname(punx.__file__), 'data', ) + example_file = os.path.abspath(os.path.join(path, fname)) + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(example_file) + + def test_specific_hdf5_addresses_can_be_found(self): + self.setup_simple_test_file() + self.assertEqual(len(self.validator.addresses), self.expected_item_count) + + def test_non_nexus_group(self): + self.setup_simple_test_file(create_validator=False) + with h5py.File(self.hdffile) as f: + other = f["/entry"].create_group("other") + other.attrs["intentions"] = "good" + ds = other.create_dataset("comment", data="this does not need validation") + ds.attrs["purpose"] = "testing, only" + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + self.assertTrue( + punx.validate.CLASSPATH_OF_NON_NEXUS_CONTENT + in self.validator.classpaths) + self.assertTrue("/entry/other" in self.validator.addresses) + self.assertTrue("/entry/other/comment" in self.validator.addresses) + self.assertEqual( + punx.validate.CLASSPATH_OF_NON_NEXUS_CONTENT, + self.validator.addresses["/entry/other"].classpath) + self.assertFalse( + "/entry/other@intentions" in self.validator.addresses) + self.assertEqual( + punx.validate.CLASSPATH_OF_NON_NEXUS_CONTENT, + self.validator.addresses["/entry/other/comment"].classpath) + self.assertFalse( + "/entry/other/comment@purpose" in self.validator.addresses) + + def test_proper_classpath_determined(self): + self.setup_simple_test_file() + self.assertEqual(len(self.validator.classpaths), self.expected_item_count) + + obj = self.validator.addresses["/"] + self.assertTrue(obj.classpath in self.validator.classpaths) + self.assertEqual(obj.classpath, "") + + obj = self.validator.addresses["/entry/data/data"] + self.assertTrue(obj.classpath in self.validator.classpaths) + self.assertEqual(obj.classpath, "/NXentry/NXdata/data") + + self.assertTrue("@default" in self.validator.classpaths) + self.assertTrue("/NXentry@default" in self.validator.classpaths) + self.assertTrue("/NXentry/NXdata@signal" in self.validator.classpaths) + + def test_writer_1_3(self): + self.use_example_file("writer_1_3.hdf5") + items = """ + /NXentry/NXdata@two_theta_indices + /NXentry/NXdata@signal + /NXentry/NXdata/counts + /NXentry/NXdata/counts@units + /NXentry/NXdata/two_theta@units + """.strip().split() + for k in items: + if k not in self.validator.classpaths: + import pprint + pprint.pprint(self.validator.classpaths) + self.assertTrue(k in self.validator.classpaths, k) + + def test_writer_2_1(self): + self.use_example_file("writer_2_1.hdf5") + items = """ + /NXentry/NXdata@two_theta_indices + /NXentry/NXdata@signal + /NXentry/NXdata/counts + /NXentry/NXdata/counts@units + /NXentry/NXdata/two_theta@units + """.strip().split() + for k in items: + if k not in self.validator.classpaths: + import pprint + pprint.pprint(self.validator.classpaths) + self.assertTrue(k in self.validator.classpaths, k) + + acceptable_status = [punx.finding.OK, + punx.finding.NOTE, + punx.finding.TODO, + punx.finding.OPTIONAL,] + for f in self.validator.validations: + self.assertTrue(f.status in acceptable_status, str(f)) + + def test_bad_link_target_value(self): + # target attribute value points to non-existing item + self.setup_simple_test_file(create_validator=False) + with h5py.File(self.hdffile) as f: + data = f["/entry/data/data"] + f["/entry/bad_target_in_link"] = data + data.attrs["target"] = data.name + "_make_it_incorrect" + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + h5_obj = self.validator.addresses["/entry/bad_target_in_link"].h5_object + h5root = self.validator.addresses["/"].h5_object + self.assertFalse("no such item" in h5root) + + # check the link target attribute exists + self.assertTrue("target" in h5_obj.attrs) + target = h5_obj.attrs["target"] + # check the value of the target attribute does not exist + self.assertFalse(target in h5root) + # TODO: check that validation found this problem + + def test_wrong_link_target_value(self): + # test target attribute value that points to wrong but existing item + self.setup_simple_test_file(create_validator=False) + with h5py.File(self.hdffile) as f: + data = f["/entry/data/data"] + f["/entry/linked_item"] = data + data.attrs["target"] = f["/entry/data"].name # points to wrong item + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + h5root = self.validator.addresses["/"].h5_object + link = h5root["/entry/linked_item"] + target = link.attrs["target"] + self.assertTrue(target in h5root) # target value exists + h5_obj = h5root[target] + self.assertEqual(target, h5_obj.name) # target value matches target's name + self.assertFalse("target" in h5_obj.attrs) + pass + # TODO: check that validation found this problem + # TODO: another case, target could have a target attribute but does not match link@target + + # TODO: need to test non-compliant item names + + def test_application_definition(self): + self.setup_simple_test_file(create_validator=False) + with h5py.File(self.hdffile) as f: + other = f["/entry"].create_dataset( + "definition", + data="NXcanSAS") + # TODO: add compliant contents + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + # TODO: assert what now? + + def test_contributed_base_class(self): + self.setup_simple_test_file(create_validator=False) + with h5py.File(self.hdffile) as f: + # TODO: should be under an NXinstrument group + group = f["/entry"].create_group("quadrupole_magnet") + group.attrs["NX_class"] = "NXquadrupole_magnet" + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + # TODO: such as NXquadrupole_magnet + + def test_contributed_application_definition(self): + self.setup_simple_test_file(create_validator=False) + with h5py.File(self.hdffile) as f: + other = f["/entry"].create_dataset( + "definition", + data="NXspecdata") + # TODO: add compliant contents + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + # TODO: assert what now? + + def test_axes_attribute_1D__pass(self): + with h5py.File(self.hdffile) as f: + f.attrs["default"] = "entry" + + eg = f.create_group("entry") + eg.attrs["NX_class"] = "NXentry" + eg.attrs["default"] = "data" + + dg = eg.create_group("data") + dg.attrs["NX_class"] = "NXdata" + dg.attrs["signal"] = "data" + + vec = [1, 2, 3.14] + ds = dg.create_dataset("data", data=vec) + ds.attrs["units"] = "arbitrary" + + ds = dg.create_dataset("x", data=vec) + ds.attrs["units"] = "m" + + dg.attrs["axes"] = "x" + dg.attrs["x_indices"] = [0] + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + # TODO: assert that @axes has been defined properly + # TODO: assert that @x_indices has been defined properly + + def test_axes_attribute_2D__pass(self): + with h5py.File(self.hdffile) as f: + f.attrs["default"] = "entry" + + eg = f.create_group("entry") + eg.attrs["NX_class"] = "NXentry" + eg.attrs["default"] = "data" + + dg = eg.create_group("data") + dg.attrs["NX_class"] = "NXdata" + dg.attrs["signal"] = "data" + + vec = [1, 2, 3.14] + ds = dg.create_dataset("data", data=[vec, vec, vec]) + ds.attrs["units"] = "arbitrary" + + ds = dg.create_dataset("x", data=vec) + ds.attrs["units"] = "m" + + ds = dg.create_dataset("y", data=vec) + ds.attrs["units"] = "mm" + + dg.attrs["axes"] = punx.utils.string_list_to_hdf5(["x", "y"]) + dg.attrs["x_indices"] = [0] + dg.attrs["y_indices"] = [1] + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + # TODO: assert that @axes has been defined properly + # TODO: assert that @x_indices has been defined properly + # TODO: assert that @y_indices has been defined properly + + def test_axes_attribute_2D__fail(self): + with h5py.File(self.hdffile) as f: + f.attrs["default"] = "entry" + + eg = f.create_group("entry") + eg.attrs["NX_class"] = "NXentry" + eg.attrs["default"] = "data" + + dg = eg.create_group("data") + dg.attrs["NX_class"] = "NXdata" + dg.attrs["signal"] = "data" + + vec = [1, 2, 3.14] + ds = dg.create_dataset("data", data=[vec, vec, vec]) + ds.attrs["units"] = "arbitrary" + + ds = dg.create_dataset("x", data=vec) + ds.attrs["units"] = "m" + + ds = dg.create_dataset("y", data=vec) + ds.attrs["units"] = "mm" + + dg.attrs["axes"] = punx.utils.string_list_to_hdf5(["x,y",]) + dg.attrs["x_indices"] = [0] + dg.attrs["y_indices"] = [1] + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + # TODO: assert that @axes has NOT been defined properly + + def test_item_names(self): + """issue #104: test non-compliant item names""" + with h5py.File(self.hdffile) as f: + eg = f.create_group(u"entry") + eg.attrs[u"NX_class"] = u"NXentry" + eg.create_dataset(u"titl:e", data=u"item name is not compliant") + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + self.assertLess(sum, 0, "scoring detects error(s)") + + +class Test_Default_Plot(unittest.TestCase): + + def setUp(self): + # create the test file + tfile = tempfile.NamedTemporaryFile(suffix='.hdf5', delete=False) + tfile.close() + self.hdffile = tfile.name + self.validator = None + + def tearDown(self): + if self.validator is not None: + self.validator.close() +# self.validator.h5 = None + self.validator = None + os.remove(self.hdffile) + self.hdffile = None + + def setup_simple_test_file(self): + f = h5py.File(self.hdffile) + eg = f.create_group("entry") + eg.attrs["NX_class"] = "NXentry" + dg = eg.create_group("data") + dg.attrs["NX_class"] = "NXdata" + ds = dg.create_dataset("y", data=[1, 2, 3.14]) + ds = dg.create_dataset("x", data=[1, 2, 3.14]) + ds.attrs["units"] = "arbitrary" + f.close() + + def locate_findings_by_test_name(self, test_name, status = None): + status = status or punx.finding.OK + flist = [] + # walk through the list of findings + for f in self.validator.validations: + if f.test_name == test_name: + if f.status == status: + flist.append(f) + return flist + + def test_default_plot_v3_pass(self): + self.setup_simple_test_file() + f = h5py.File(self.hdffile, "r+") + f.attrs["default"] = "entry" + f["/entry"].attrs["default"] = "data" + f["/entry/data"].attrs["signal"] = "y" + f.close() + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + + flist = self.locate_findings_by_test_name("NeXus default plot") + self.assertEqual(len(flist), 1) + flist = self.locate_findings_by_test_name("NeXus default plot v3 NIAC2014") + self.assertEqual(len(flist), 1) + flist = self.locate_findings_by_test_name("NeXus default plot v3, NXdata@signal") + self.assertEqual(len(flist), 1) + + def test_default_plot_v3_pass_multi(self): + self.setup_simple_test_file() + f = h5py.File(self.hdffile, "r+") + f.attrs["default"] = "entry" + f["/entry"].attrs["default"] = "data" + f["/entry/data"].attrs["signal"] = "y" + eg = f["/entry"] + dg = eg.create_group("data2") + dg.attrs["NX_class"] = "NXdata" + dg.attrs["signal"] = "moss" + ds = dg.create_dataset("turtle", data=[1, 2, 3.14]) + ds = dg.create_dataset("moss", data=[1, 2, 3.14]) + eg = f.create_group("entry2") + eg.attrs["NX_class"] = "NXentry" + eg.attrs["default"] = "data3" + dg = eg.create_group("data3") + dg.attrs["NX_class"] = "NXdata" + dg.attrs["signal"] = "u" + dg.create_dataset("u", data=[1, 2, 3.14]) + f.close() + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + self.assertGreater(sum, 0, "scoring detects no error") + + flist = self.locate_findings_by_test_name("NeXus default plot") + self.assertEqual(len(flist), 1) + flist = self.locate_findings_by_test_name("NeXus default plot v3 NIAC2014") + self.assertEqual(len(flist), 1) + flist = self.locate_findings_by_test_name("NeXus default plot v3, NXdata@signal") + self.assertEqual(len(flist), 3) + + def test_default_plot_v3_fail(self): + self.setup_simple_test_file() + f = h5py.File(self.hdffile) + f.attrs["default"] = "entry" + f["/entry"].attrs["default"] = "will not be found" + f.close() + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + self.assertLess(sum, 0, "scoring detects error(s)") + + test_name = "NeXus default plot" + flist = self.locate_findings_by_test_name(test_name) + self.assertEqual(len(flist), 0) + + if self.validator.manager.classes["NXentry"].groups["data"].minOccurs > 0: + expectation = punx.finding.ERROR + else: + expectation = punx.finding.NOTE + flist = self.locate_findings_by_test_name(test_name, expectation) + self.assertEqual(len(flist), 1) + + def test_default_plot_v2_pass(self): + self.setup_simple_test_file() + f = h5py.File(self.hdffile) + f["/entry/data/x"].attrs["signal"] = 1 + f["/entry/data/y"].attrs["signal"] = 2 + f.close() + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + self.assertGreater(sum, 0, "scoring detects no error") + + test_name = "NeXus default plot" + flist = self.locate_findings_by_test_name(test_name) + self.assertEqual(len(flist), 1) + flist = self.locate_findings_by_test_name(test_name + " v2") + self.assertEqual(len(flist), 1) + flist = self.locate_findings_by_test_name( + test_name + " v2, @signal!=1", + punx.finding.WARN) + self.assertEqual(len(flist), 1) + + def test_default_plot_v2_fail_no_signal(self): + self.setup_simple_test_file() + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + if self.validator.manager.classes["NXentry"].groups["data"].minOccurs > 0: + self.assertLess(sum, 0, "scoring detects error(s)") + + test_name = "NeXus default plot" + flist = self.locate_findings_by_test_name(test_name) + self.assertEqual(len(flist), 0) + + if self.validator.manager.classes["NXentry"].groups["data"].minOccurs > 0: + expectation = punx.finding.ERROR + else: + expectation = punx.finding.NOTE + flist = self.locate_findings_by_test_name(test_name, expectation) + self.assertEqual(len(flist), 1) + + def test_default_plot_v2_fail_multi_signal(self): + self.setup_simple_test_file() + with h5py.File(self.hdffile) as f: + f["/entry/data/x"].attrs["signal"] = 1 + f["/entry/data/y"].attrs["signal"] = 1 + + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + sum, count, score = self.validator.finding_score() + self.assertGreater(count, 0, "items counted for scoring") + self.assertLess(sum, 0, "scoring detects error(s)") + + test_name = "NeXus default plot" + flist = self.locate_findings_by_test_name(test_name) + self.assertEqual(len(flist), 0) + + if self.validator.manager.classes["NXentry"].groups["data"].minOccurs > 0: + expectation = punx.finding.ERROR + else: + expectation = punx.finding.NOTE + flist = self.locate_findings_by_test_name(test_name, expectation) + self.assertEqual(len(flist), 1) + + test_name = "NeXus default plot v2, @signal=1" + flist = self.locate_findings_by_test_name(test_name) + self.assertEqual(len(flist), 2) + + test_name = "NeXus default plot v2, multiple @signal=1" + flist = self.locate_findings_by_test_name(test_name, punx.finding.ERROR) + self.assertEqual(len(flist), 1) + + def test_default_plot_v1_pass(self): + self.setup_simple_test_file() + + def test_default_plot_v1_fail(self): + self.setup_simple_test_file() + + +class Test_Example_data(unittest.TestCase): + + def setUp(self): + self.path = os.path.abspath(os.path.dirname(punx.__file__)) + self.path = os.path.join(self.path, "data") + + def test_Data_Q(self): + self.hdffile = os.path.join(self.path, "Data_Q.h5") + self.validator = punx.validate.Data_File_Validator(ref=DEFAULT_NXDL_FILE_SET) + self.validator.validate(self.hdffile) + + # TODO: assert that /entry/data@axes has NOT been defined properly + + +def suite(*args, **kw): + test_suite = unittest.TestSuite() + test_list = [ + Test_Constructor, + Test_Constructor_Exceptions, + Test_Example_data, + Test_Validate, + Test_Default_Plot, + Test_Changing_NXDL_Rules, + ] + for test_case in test_list: + test_suite.addTest(unittest.makeSuite(test_case)) + return test_suite + + +if __name__ == '__main__': + runner=unittest.TextTestRunner(verbosity=2) + runner.run(suite())