User interface: subcommand: tree#

show tree structure of HDF5 or NXDL file

command line help

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#

All options as default choices:

 1console> punx tree punx/data/writer_1_3.hdf5
 2
 3/path/to/punx/data/writer_1_3.hdf5 : NeXus data file
 4  Scan:NXentry
 5    @NX_class = "NXentry"
 6    data:NXdata
 7      @NX_class = "NXdata"
 8      @axes = "two_theta"
 9      @signal = "counts"
10      @two_theta_indices = [0]
11      counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
12        @units = "counts"
13      two_theta:NX_FLOAT64[31] = [17.92608, 17.92591, 17.92575, '...', 17.92108]
14        @units = "degrees"

No attributes:

1console> punx tree -a punx/data/writer_1_3.hdf5
2
3/path/to/punx/data/writer_1_3.hdf5 : NeXus data file
4Scan:NXentry
5  data:NXdata
6    counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
7    two_theta:NX_FLOAT64[31] = [17.92608, 17.92591, 17.92575, '...', 17.92108]

Only start and end values of arrays:

 1console> punx tree -m 3 punx/data/writer_1_3.hdf5
 2
 3/path/to/punx/data/writer_1_3.hdf5 : NeXus data file
 4Scan:NXentry
 5  @NX_class = "NXentry"
 6  data:NXdata
 7    @NX_class = "NXdata"
 8    @axes = "two_theta"
 9    @signal = "counts"
10    @two_theta_indices = [0]
11    counts:NX_INT32[31] = [1037, '...', 1321]
12      @units = "counts"
13    two_theta:NX_FLOAT64[31] = [17.92608, '...', 17.92108]
14      @units = "degrees"

Minimal: no attributes or array values:

1console> punx tree -a -m 0 punx/data/writer_1_3.hdf5
2
3/path/to/punx/data/writer_1_3.hdf5 : NeXus data file
4Scan:NXentry
5  data:NXdata
6    counts:NX_INT32[31] = [ ... ]
7    two_theta:NX_FLOAT64[31] = [ ... ]