NXdir

From NeXus

Jump to: navigation, search

NXdir is a console based tool that allows inspecting the contents of a NeXusfile. It allows for directory like listing of contents as well as printing out data.

If you have any questions/comments/bug reports email Peter Peterson <petersonpf@ornl.gov>

Contents

News

May 7, 2004
New version of NXdir is v0.2.5. This version now supports NX_INT8 and NX_UINT8 as well as fixes some bugs with reading integers from a nexus file.
Apr 15, 2004
New version of NXdir is v0.2.4. The added feature is writing out an NXdata to file (1D and 2D only for now). Let me know if the format should be changed.
Mar 17, 2004
New version of NXdir is v0.2.3. This version provides more consistency between abolsute and relative paths. It also allows for anchoring the path at both ends using a "/".
Mar 01, 2004
First public release of NXdir is v0.2.2 with linux binary here.

Usage

NXdir runs on the command line with a variety of arguments. Below is the online help information (note that defaults can be changed during compilation).

About NXdir
-h|--help Print this help information
--version Print the version information
Node Selection
-p Path inside the file to look in. This can be absolute or relative and can be class or name of a given field. To anchor the path at the beginning or end place a "/" there. To specify that a level must exist, but the name or class can be anything, use a dot ".". To specify that any number of levels can exist, use a star "*".
Output Control
-o/+o Print (or not) the value of selected nodes, if possible. Defaults to false (+o).
-l|--max-array [value] Change the number of elements that are printed for arrays. Forces "-o". (10)
-t|--tree-mode <value> multi|tree
--path-mode <value> Select whether paths are written with names or classes. Allowed values are (name)|class|both
--data-mode <value> How data is printed. Allowed values are (script)
--printline <value> How data is printed with respect to tree. Allowed values are (single).
--write-data <filename> Select a file to write out selected NXdata to.

Some common usages are:

  • Print the online help:
    nxdir --help
  • List the everything at the root level of the file:
    nxdir lrcs3000.nxs
  • Find the user names in all of the files in the directory:
    nxdir *.nxs -p NXuser/name -o
  • Find all the data in a file:
    nxdir NPDF_E2_R0003000.nx.hdf -p NXdata
  • Print out how the entire file is organized
    nxdir trics058582002.hdf -p "*"
    (The asterix is in quotes so it is not expanded by the shell)

Downloads

Prerequisites

  • C++ compiler
  • NeXus libraries

or

  • Precompiled binary

Installation

Binary
Some binaries can be found above. Download, rename to something you will remember (like nxdir) and move into your path.
Unix/Linux/Irix/MacOSX
Unpack the tarball, enter the directory and type make. Copy the resulting binary nxdir into your path.

Un-installing

Remove the file nxdir.

The installation process did not modify the registry or other system settings in any way.

Frequently Asked Questions (FAQ)

What is NXdir?
NXdir is a console tool used for inspection the contents of a NeXus file, it can print out the organization of the file as well as any data enclosed. It is intended to be a cross between the unix tools ls and grep. It should help people writing scripts access to NeXus files without having to compile in the NeXus API.
The way NXdir prints arrays is hard to read, could you please change it?
No, but a format easier for you to read can be added. Please send petersonpf@ornl.gov an example of a two dimensional array in a format you like.
Personal tools