#UXML: UXML metadata plugin

Looks for #UXML control line control lines. These lines contain metadata written as XML structures and formatted according to the supplied XML Schema uxml.xsd in the same directory as the uxml.py plugin. The lines which comprise the XML are written as a list in each scan: scan.UXML. If there are no #UXML control lines, then scan.UXML does not exist.

Once the scan has been fully read scan.UXML is converted into an XML document structure (using the lxml.etree package) which is stored in scan.UXML_root. The structure is validated against the XML Schema uxml.xsd. If invalid, the error message is reported by raising a UXML_Error python exception.

A fully-validated structure can be written using the Writer class. The UXML metadata is written to the scan’s NXentry group as subgroup named UXML with NeXus base class NXnote. The hierarchy within this UXML is defined from the content provided in the SPEC scan.

Please consult the XML Schema file for the rules governing the use of #UXML in a SPEC data file: * uxml.xsd

#UXML: UXML structured metadata

exception spec2nexus.plugins.uxml.UXML_Error[source]
class spec2nexus.plugins.uxml.UXML_metadata[source]

#UXML – XML metadata in scan header


  • (SpecDataFileScan): UXML : XML document root


  • various items below the NXentry parent group, as indicated in the UXML

Public methods

process(text, scan, *args, **kws) read #UXML lines from SPEC data file into scan.UXML

Internal methods

walk_xml_tree(h5parent, xml_node) parse the XML node into HDF5 objects
make_NeXus_links() create all the hardlinks as directed
prune_dict(d, keys) remove keys from dictionary d
dataset(h5parent, xml_node) HDF5/NeXus dataset specification
group(h5parent, xml_node) HDF5/NeXus group specification
hardlink(h5parent, xml_node) HDF5/NeXus hard link specification
dataset(h5parent, xml_node)[source]

HDF5/NeXus dataset specification

group(h5parent, xml_node)[source]

HDF5/NeXus group specification

HDF5/NeXus hard link specification

create all the hardlinks as directed

postprocess(scan, *args, **kws)[source]

convert the UXML text into an XML object (scan.UXML_root)

Parameters:scan (SpecDataFileScan) – data from a single SPEC scan
process(text, scan, *args, **kws)[source]

read #UXML lines from SPEC data file into scan.UXML

prune_dict(d, keys)[source]

remove keys from dictionary d

walk_xml_tree(h5parent, xml_node)[source]

parse the XML node into HDF5 objects

writer(nxentry, writer, scan, *args, **kws)[source]

Describe how to store this data in an HDF5 NeXus file