Chapter 3. NeXus classes

Table of Contents

Overview of NeXus classes
NeXus Base Classes
NXaperture
NXattenuator
NXbeam
NXbeam_stop
NXbending_magnet
NXcapillary
NXcharacterization
NXcollection
NXcollimator
NXcrystal
NXdata
NXdetector
NXdetector_group
NXdisk_chopper
NXentry
NXenvironment
NXevent_data
NXfermi_chopper
NXfilter
NXflipper
NXgeometry
NXguide
NXinsertion_device
NXinstrument
NXlog
NXmirror
NXmoderator
NXmonitor
NXmonochromator
NXnote
NXobject
NXorientation
NXparameters
NXpolarizer
NXpositioner
NXprocess
NXroot
NXsample
NXsensor
NXshape
NXsource
NXsubentry
NXtranslation
NXuser
NXvelocity_selector
NXxraylens
NeXus Application Classes
NXarchive
NXdirecttof
NXfluo
NXindirecttof
NXiqproc
NXlauetof
NXmonopd
NXrefscan
NXreftof
NXsas
NXsastof
NXscan
NXspe
NXsqom
NXtas
NXtofnpd
NXtofraw
NXtofsingle
NXtomo
NXtomophase
NXtomoproc
NXxas
NXxasproc
NXxbase
NXxeuler
NXxkappa
NXxlaue
NXxlaueplate
NXxnb
NXxrot
NeXus Contributed Classes
NXbeamline
NXelectrostatic_kicker
NXmagnetic_kicker
NXquadrupole_magnet
NXsai_controller
NXseparator
NXsnsevent
NXsnshisto
NXsolenoid_magnet
NXspin_rotator
NXtechnical_data

Information is stored in a NeXus data file by grouping together similar parts. For example, information about the sample could include a descriptive name, the temperature, and other items. NeXus specifies the contents of these groupings using classes. In some parts of this manual, these classes might be called group type or some similar term. In this section, the NeXus classes are described in detail. Each class is specified using the NeXus Definition Language (NXDL). The rules and structure of NXDL are described in a separate chapter.

There are three types of NeXus class file: base classes, application definitions, and contributed definitions. Base class definitions define the complete set of terms that might be used in an instance of that class. Application definitions define the minimum set of terms that must be used in an instance of that class. Contributed definitions include propositions from the community for NeXus base classes or application definitions, as well as other NXDL files for long-term archival by NeXus.

Overview of NeXus classes

Each of the NeXus classes is described in two basic ways. First, a short list of descriptive information is provided as a header, then a condensed listing of the basic structure, then a table providing documentation for the various components of the NeXus class.

category

The category of NXDL, either:

base (base class)
application (application definition)
contributed (contributed definition)

NXDL source

Name of the NeXus class and a URL to the source listing in the NeXus subversion repository.

version

A string that documents this particular version of this NXDL.

SVN Id

Subversion repository checkout identification, stripped of the surrounding dollar signs. (The Id is blank on files copied direct from the repository that are not checked out by a subversion client.)

NeXus Definition Language

The NeXus Definition Language (NXDL) (described in NXDL: NeXus Definition Language) is used to describe the components in the NeXus Base Classes, as well as application and contributed definitions. The intent of NXDL is to provide a rules-based method for defining a NeXus data file that is specific to either an instrument (where NeXus has been for years) or an area of scientific technique or analysis. NXDL replaces the meta-DTD method used previously to define the NeXus base classes.

extends class

NeXus class extended by this class. Most NeXus base classes only extend the base class definition (NXDL).

other classes included

List (including URLs) of other classes used to define this class.

symbol list

List of the symbols (if present) that define mnemonics that represent the length of each dimension in a vector or array.

documentation

Description of the NeXus class. DocBook markup (formatting is allowed).

A compact listing of the basic structure (groups, fields, dimensions, attributes, and links) is prepared for each NXDL specification. Indentation shows nested structure. Attributes are prepended with the @ symbol while links use the characters --> to represent the path to the intended source of the information.

The table has columns to describe the basic information about each field or group in the class. An example of the varieties of specifications are given in the following table using items found in various NeXus base classes.

Table 3.1. Example Tabular representation of a NeXus class

NameTypeUnitsDescription (and Occurrences)
program_nameNX_CHAR 

Name of program used to generate this file

@versionNX_CHAR 

Program version number

Occurences: 1 : default

@configurationNX_CHAR 

configuration of the program

thumbnail NXnote  

A small image that is representative of the entry. An example of this is a 640x480 JPEG image automatically produced by a low resolution plot of the NXdata.

@mime_typeNX_CHAR expected: mime_type="image/*"
  NXgeometry  describe the geometry of this class
distanceNX_FLOATNX_LENGTH

Distance from sample

mode

"Single Bunch"

| "Multi Bunch"

 

source operating mode

target_material

Ta

| W

| depleted_U

| enriched_U

| Hg

| Pb

| C

 

Pulsed source target material


In the above example, the fields might appear in a NeXus XML data file as

Example 3.1. Example fragment of a NeXus XML data file

<program_name version="1.0a" configuration="standard">
    MaxSAS
</program_name>
<NXnote name="thumbnail" mime_type="image/*">
    <!-- contents of an NXnote would appear here -->
</NXnote>
<distance units="mm">125.6</distance>
<mode> Single Bunch </mode>
<target_material>depleted_U</target_material>

The columns in the table are described as follows:

Name (and attributes)

Name of the data field. Since name needs to be restricted to valid program variable names, no "-" characters can be allowed. Name must satisfy both HDF and XML naming rules.

NameStartChar ::=  _ | a..z | A..Z
NameChar      ::=  NameStartChar | 0..9
Name          ::=  NameStartChar (NameChar)*

Or, as a regular expression:    [_a-zA-Z][_a-zA-Z0-9]*
equivalent regular expression:  [_a-zA-Z][\w_]*

Attributes, identified with a leading "at" symbol (@) and belong with the preceding field or group, are additional metadata used to define this field or group.

In the example above, the program_name element has two attributes: version (required) and configuration (optional) while the thumbnail element has one attribute: mime_type (optional).

Type

Type of data to be represented by this variable. The type is one of those specified in the NeXus Definition Language (see NXDL: NeXus Definition Language).

In the case where the variable can take only one value from a known list, the list of known values is presented, such as in the target_material field above: Ta | W | depleted_U | enriched_U | Hg | Pb | C . Selections with included whitespace are surrounded by quotes. See the example above for usage.

Units

Data units, given as character strings, must conform to the NeXus units standard. See the "NeXus units" section for details.

Description (and Occurences)

A simple text description of the data field. No markup or formatting is allowed.

The absence of Occurences in the item description signifies that both minOccurs and maxOccurs have the default values. If the number of occurences of an item are specified in the NXDL (through @minOccurs and @maxOccurs attributes), they will be reported in the Description column similar to the example shown above.

Default values for occurences are shown in the following table. The NXDL element type is either a group (such as a NeXus base class), a field (that specifies the name and type of a variable), or an attribute of a field or group. The number of times an item can appear ranges between minOccurs and maxOccurs. A default minOccurs of zero means the item is optional. For attributes, maxOccurs cannot be greater than 1.

Table 3.2. Default values for occurences

NXDL element typeminOccursmaxOccurs
group0unbounded
field0unbounded
attribute01