Skip to content

API for command line tools

pynxtools supports a number of command line applications. This page provides documentation for their current API.

Data conversion

Note that simply calling dataconverter defaults to dataconverter convert.

dataconverter

Usage:

dataconverter [OPTIONS] COMMAND [ARGS]...

Options:

Name Type Description Default
--help boolean Show this message and exit. False

Subcommands

  • convert: This command allows you to use the converter functionality of the dataconverter.
  • generate-template: Generates and prints a template to use for your nxdl.
  • get-readers: Prints a list of all installed readers.

dataconverter convert

This command allows you to use the converter functionality of the dataconverter.

Usage:

dataconverter convert [OPTIONS] [FILES]...

Options:

Name Type Description Default
--input-file text Deprecated: Please use the positional file arguments instead. The path to the input data file to read. Repeat for more than one file. default=[] This option is required if no '--params-file' is supplied. []
--reader choice (example | json_map | json_yml | multi) The reader to use. Examples are json_map or readers from a pynxtools plugin. default='json_map' This option is required if no '--params-file' is supplied. json_map
--nxdl text The name of the NeXus application definition file to use without the extension nxdl.xml. This option is required if no '--params-file' is supplied. None
--output text The path to the output NeXus file to be generated. default='output.nxs' output.nxs
--params-file filename Allows to pass a .yaml file with all the parameters the converter supports. None
--ignore-undocumented boolean Ignore all undocumented fields during validation. False
--fail boolean Fail conversion and don't create an output file if the validation fails. False
--skip-verify boolean Skips the verification routine during conversion. False
--mapping text Takes a .mapping.json file and converts data from given input files. None
-c, --config file A json config file for the reader None
--help boolean Show this message and exit. False

dataconverter generate-template

Generates and prints a template to use for your nxdl.

Usage:

dataconverter generate-template [OPTIONS]

Options:

Name Type Description Default
--nxdl text The name of the NeXus application definition file to use without extension. For example: NXmpes _required
--required boolean Use this flag to only get the required template. False
--pythonic boolean Prints a valid Python dictionary instead of JSON False
--output path Writes the output into the filepath provided. None
--help boolean Show this message and exit. False

dataconverter get-readers

Prints a list of all installed readers.

Usage:

dataconverter get-readers [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

NeXus file validation

read_nexus

Functionality to extract documentation and concept definition information about the individual parts of a NeXus/HDF5 file.

Usage:

read_nexus [OPTIONS]

Options:

Name Type Description Default
-f, --nexus-file text NeXus file with extension .nxs. None
-d, --documentation text Definition path in nexus output (.nxs) file. Returns debug log relevant with that definition path. Example: /entry/data/delays None
-c, --concept text Concept path from application definition file (.nxdl,xml). Finds out all the available concept definition (IS-A realation) for rendered concept path. Example: /NXarpes/ENTRY/INSTRUMENT/analyser None
--help boolean Show this message and exit. False

NOTE: Only one option from (-d and -c) is acceptable.

ELN generation

generate_eln

Helper tool for generating ELN files in YAML format.

Usage:

generate_eln [OPTIONS]

Options:

Name Type Description Default
--nxdl text Name of NeXus definition without extension (.nxdl.xml). _required
--skip-top-levels integer To skip the level of parent hierarchy level. E.g. for default 1 the part Entry[ENTRY] from /Entry[ENTRY]/Instrument[INSTRUMENT]/... will be skiped. 1
--output-file text Name of file that is neede to generated output file. eln_data
--eln-type choice (eln | scheme_eln) Choose a type of ELN output (eln or scheme_eln). eln
--help boolean Show this message and exit. False