[NeXus-code-tickets] [NeXusCode] #249: NXtraverse

NeXus Data Format Library and Applications noreply at nexusformat.org
Wed Oct 6 08:09:56 BST 2010


#249: NXtraverse
---------------------------+------------------------------------------------
 Reporter:  Pedro.vicente  |       Owner:  Pedro.vicente
     Type:  task           |      Status:  new          
 Priority:  major          |   Milestone:               
Component:  napi           |     Version:  trunk        
 Keywords:                 |  
---------------------------+------------------------------------------------
 NXtraverse, traverses and displays NeXus files (paths, data). Various
 aspects of NeXus datasets are optionally read and displayed. File
 traversal is achieved by using a recursive algorithm: NeXus datasets are
 displayed, NeXus groups are recursively iterated.

 Algorithm.  File iteration is achieved by recursively calling the
 following NeXus API functions,  starting at the HDF5 root group:

 NXgetgroupinfo; returns the number of objects (HDF5 groups and datasets).

 Iterate the objects obtained in 1); in each step the following functions
 are called

 NXgetnextentry; returns the object type (dataset or group). A selection is
 made: If the object is a dataset type, its contents are read. If the
 object is a group type, the group is opened with the NeXus API function
 NXopengroup, then the same sequence in 1) to 3) is recursively called, and
 then the group is closed with NXclosegroup.


 Usage. Usage of the tool is

 ./nxtraverse -f <filename> [-h] [-r] [-a] [-n N]

 [-f]    traverse file <filename>[-h]    print this usage message and exit
 [-r]    do not read data[-a]    do not read attributes[-n]    print only
 N number of elements; N defaults to 5, * for all elements


 Ouput example

 ./nxtraverse -f BSS_5663_histo.nxs

 prints all objects (datasets, attributes, groups) in the file named
 “BSS_5663_histo.nxs”.  For arrays, the default first 5 elements are
 printed. Each object is displayed in 1 line. First the object path is
 displayed, after that, if the object is a dataset, data is displayed after
 an equal sign “=”. Attributes are distinguished from datasets by printing
 the symbol “#” after the dataset name they belong to.

 /entry
 /entry/DASlogs
 /entry/DASlogs/frequency
 /entry/DASlogs/frequency/average_value=0.013787
 /entry/DASlogs/frequency/average_value#units=Hz
 /entry/DASlogs/frequency/time=0 0.016667 0.033333 0.05 0.066666 ...

-- 
Ticket URL: <http://trac.nexusformat.org/code/ticket/249>
NeXus Data Format Library and Applications <http://www.nexusformat.org/>
NeXus Data Format Library and Applications



More information about the NeXus-code-tickets mailing list