#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
- class spec2nexus.plugins.uxml.UXML_metadata[source]#
#UXML – XML metadata in scan header
IN-MEMORY REPRESENTATION
(SpecDataFileScan): UXML : XML document root
HDF5/NeXus REPRESENTATION
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
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
- 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