User interface : main
#
Provides the user interface(s) to the punx program.
source code settings#
Python Utilities for NeXus HDF5 files
main user interface file
Usage
console> punx -h
usage: punx [-h] [-v] {configuration,demonstrate,install,tree,validate} ...
Python Utilities for NeXus HDF5 files version: 0.2.7+30.gf373b62.dirty URL: https://prjemian.github.io/punx
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
subcommand:
valid subcommands
{configuration,demonstrate,install,tree,validate}
configuration show configuration details of punx
demonstrate demonstrate HDF5 file validation
install install NeXus definitions into the local cache
tree show tree structure of HDF5 or NXDL file
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``.
|
|
|
override standard ArgumentParser to enable shortcut feature |
process command line |
|
|
show internal configuration of punx |
|
show what punx can do |
|
Install or update the named versions of the NeXus definitions. |
|
print the tree structure of a NeXus HDF5 data file of NXDL XML file |
|
validate the content of a NeXus HDF5 data file of NXDL XML file |
- class punx.main.MyArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]#
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
- punx.main.exit_message(msg, exit_code=1)[source]#
exit this code with a message and a status
- Parameters:
msg (str) – text to be reported
exit_code (int) – 0: no error, 1: error (default)
- punx.main.func_demo(args)[source]#
show what punx can do
Internally, runs these commands:
punx validate <source_directory>/data/writer_1_3.hdf5 punx tree <source_directory>/data/writer_1_3.hdf5
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-main/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
- punx.main.func_install(args)[source]#
Install or update the named versions of the NeXus definitions.
Install into the user cache. (Developer manages the source cache.)
- punx.main.func_tree(args)[source]#
print the tree structure of a NeXus HDF5 data file of NXDL XML file