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.

command line help

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.

 1C:\Users\Pete\Documents\eclipse\punx\src\punx\main.py
 2
 3!!! WARNING: this program is not ready for distribution.
 4
 5
 6console> punx validate C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5
 7data file: C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5
 8NeXus definitions (branch): master, dated 2018-05-16 02:07:48, sha=2dc081ee4265eebf80a953080a2ed275c1799a21
 9
10findings
11============================ ====== ==================================== =============================================
12address                      status test                                 comments                                     
13============================ ====== ==================================== =============================================
14/                            TODO   NeXus base class                     NXroot: more validations needed              
15/                            OK     known NXDL                           NXroot: recognized NXDL specification        
16/                            OK     NeXus base class                     NXroot: known NeXus base class               
17/                            OK     NeXus default plot                   found by v3: /Scan/data/counts               
18/Scan                        TODO   NeXus base class                     NXentry: more validations needed             
19/Scan                        OK     group in base class                  not defined: NXroot/Scan                     
20/Scan                        OK     known NXDL                           NXentry: recognized NXDL specification       
21/Scan                        OK     NeXus base class                     NXentry: known NeXus base class              
22/Scan                        OK     NXDL group in data file              found:  in /Scan/data                        
23/Scan                        NOTE   validItemName                        relaxed pattern: [A-Za-z_][\w_]*             
24/Scan@NX_class               OK     validItemName                        pattern: NX.+                                
25/Scan@NX_class               OK     attribute value                      recognized NXDL base class: NXentry          
26/Scan@NX_class               OK     known attribute                      known: NXentry@NX_class                      
27/Scan/data                   TODO   NeXus base class                     NXdata: more validations needed              
28/Scan/data                   OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
29/Scan/data                   OK     group in base class                  defined: NXentry/data                        
30/Scan/data                   OK     known NXDL                           NXdata: recognized NXDL specification        
31/Scan/data                   OK     NeXus base class                     NXdata: known NeXus base class               
32/Scan/data@NX_class          OK     validItemName                        pattern: NX.+                                
33/Scan/data@NX_class          OK     attribute value                      recognized NXDL base class: NXdata           
34/Scan/data@NX_class          OK     known attribute                      known: NXdata@NX_class                       
35/Scan/data@axes              TODO   attribute value                      implement                                    
36/Scan/data@axes              OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
37/Scan/data@axes              OK     known attribute                      known: NXdata@axes                           
38/Scan/data@signal            OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
39/Scan/data@signal            OK     valid name @signal=counts            strict pattern: [a-z_][a-z0-9_]*             
40/Scan/data@signal            OK     attribute value                      found: @signal=counts                        
41/Scan/data@signal            OK     known attribute                      known: NXdata@signal                         
42/Scan/data@signal            OK     value of @signal                     found: /Scan/data/counts                     
43/Scan/data@signal            OK     NeXus default plot v3, NXdata@signal correct default plot setup in /NXentry/NXdata
44/Scan/data@two_theta_indices TODO   attribute value                      implement                                    
45/Scan/data@two_theta_indices OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
46/Scan/data@two_theta_indices OK     known attribute                      unknown: NXdata@two_theta_indices            
47/Scan/data/counts            OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
48/Scan/data/counts            OK     field in base class                  not defined: NXdata/counts                   
49/Scan/data/counts@units      TODO   attribute value                      implement                                    
50/Scan/data/counts@units      OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
51/Scan/data/two_theta         OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
52/Scan/data/two_theta         OK     field in base class                  not defined: NXdata/two_theta                
53/Scan/data/two_theta@units   TODO   attribute value                      implement                                    
54/Scan/data/two_theta@units   OK     validItemName                        strict pattern: [a-z_][a-z0-9_]*             
55============================ ====== ==================================== =============================================
56
57
58summary statistics
59======== ===== =========================================================== =========
60status   count description                                                 (value)  
61======== ===== =========================================================== =========
62OK       33    meets NeXus specification                                   100      
63NOTE     1     does not meet NeXus specification, but acceptable           75       
64WARN     0     does not meet NeXus specification, not generally acceptable 25       
65ERROR    0     violates NeXus specification                                -10000000
66TODO     7     validation not implemented yet                              0        
67UNUSED   0     optional NeXus item not used in data file                   0        
68COMMENT  0     comment from the punx source code                           0        
69OPTIONAL 38    allowed by NeXus specification, not identified              99       
70         --                                                                         
71TOTAL    79                                                                         
72======== ===== =========================================================== =========
73
74<finding>=99.125000 of 72 items reviewed
75
76console> punx tree C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5
77C:\Users\Pete\Documents\eclipse\punx\src\punx\data\writer_1_3.hdf5 : NeXus data file
78  Scan:NXentry
79    @NX_class = NXentry
80    data:NXdata
81      @NX_class = NXdata
82      @signal = counts
83      @axes = two_theta
84      @two_theta_indices = 0
85      counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
86        @units = counts
87      two_theta:NX_FLOAT64[31] = [17.92608, 17.92591, 17.92575, '...', 17.92108]
88        @units = degrees

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.