[Nexus] Announcing beta-version of the NXvalidate Python package

Osborn, Raymond rosborn at anl.gov
Mon Sep 16 17:04:01 BST 2024


I am happy to announce that we have just issued the first beta-release of NXvalidate (https://github.com/nexpy/nxvalidate), a new Python package used to inspect and validate NeXus files. It is currently available for installation on the PyPI server and the source code can be downloaded from Github. When it is more mature, it will be merged into the nexusformat package, with a GUI interface in NeXpy (https://nexpy.github.io/nexpy/). I hope to discuss this at the upcoming meeting of the NeXus International Advisory Committee and would welcome any feedback if you try it out before then. Please note that this is not a production release. Please post any issues to https://github.com/nexpy/nxvalidate/issues.

Installation
Released versions of nxvalidate can be installed using “pip install nxvalidate” and the source code can be downloaded from the NeXpy Git repository:

    % git clone http://github.com/nexpy/nxvalidate.git

Usage
The nxvalidate package provides a single command-line script.

% nxinspect -h
usage: nxinspect [-h] [-f FILENAME] [-p PATH] [-a [APPLICATION]]
                 [-b BASECLASS] [-i] [-w] [-e] [-v]

Inspects and validates NeXus files.

options:
  -h, --help            show this help message and exit
  -f FILENAME, --filename FILENAME
                        name of the NeXus file to be validated
  -p PATH, --path PATH
                        path to group to be validated in the NeXus file
  -b BASECLASS, --baseclass BASECLASS
                        name of the base class to be listed
  -a [APPLICATION], --application [APPLICATION]
                        validate the NeXus file against its application definition
  -i, --info            output info messages in addition to warnings and errors
  -w, --warning         output info messages in addition to warnings and errors
  -e, --error           output info messages in addition to warnings and errors
  -v, --version         show program's version number and exit

N.B., the command is “nxinspect,” rather than “nxvalidate” to avoid confusion with the existing “cnxvalidate” application (https://github.com/nexusformat/cnxvalidate).

Examples

  1.  To compare the contents of a NeXus file with the base classes defined by the NeXus standard and print conflicting fields or groups, type:

% nxinspect -f <filename.nxs> -e

The --info, --warning and --error switches control how much information is output. The default is --warning.

  2.  To check whether the contents of the NeXus file conform to the required contents of the application definition specified in the file, type:

% nxinspect -f <filename.nxs> -a

  3.  To check whether the contents of the NeXus file conform to the required contents of an application definition file, type:

% nxinspect -f <filename.nxs> -a <application.nxdl.xml>

  4.  To print the contents of a base class, type:

% nxinspect -b <base-class-name>

With regards,
Ray Osborn
--
Ray Osborn, Senior Scientist
Materials Science Division
Argonne National Laboratory
Lemont, IL 60439, USA
Phone: +1 (630) 252-9011
Email: ROsborn at anl.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nexusformat.org/pipermail/nexus/attachments/20240916/a38e29bc/attachment.htm>


More information about the NeXus mailing list