unicat plugin#

#H & #V - Metadata in SPEC data files as defined by APS UNICAT

Handles the UNICAT control lines which write additional metadata in the scans using #H/#V pairs of labels/values.

class spec2nexus.plugins.unicat.UNICAT_MetadataMnemonics[source]#

#H – UNICAT metadata names (numbered rows: #H0, #H1, …)

Individual metadata names are expected to be single-word strings but may be multi-word strings as long as the words in the string are separated by only one space. The delimiter between metadata names is two consecutive spaces. A tab (\t) character is also acceptable but should be avoided.

IN-MEMORY REPRESENTATION

  • (SpecDataFileHeader) : H : labels

  • (SpecDataFileScan): metadata : {labels: values}

HDF5/NeXus REPRESENTATION

  • NXnote group named metadata below the NXentry group, such as /entry/metadata

    • datasets created from dictionary <scan>.metadata

process(text, spec_obj, *args, **kws)[source]#

required: Handle this line from a SPEC data file.

PARAMETERS

text str:

?raw text?

spec_obj obj:

Instance of SpecDataFile, SpecDataFileHeader, or SpecDataFileScan

class spec2nexus.plugins.unicat.UNICAT_MetadataValues[source]#

#V – UNICAT metadata values (numbered rows: #V0, #V1, …)

Individual metadata values are expected to be numbers but may be multi-word strings as long as the words in the string are separated by only one space. The delimiter between metadata values is two consecutive spaces. A tab ('\t') character is also acceptable but should be avoided.

All numerical values will be converted into floating point numbers. Only if that conversion fails, the text of the value will be reported verbatim.

IN-MEMORY REPRESENTATION

  • (SpecDataFileScan): V : values

  • (SpecDataFileScan): metadata : {labels: values}

HDF5/NeXus REPRESENTATION

  • NXnote group named metadata below the NXentry group, such as /entry/metadata

    • datasets created from dictionary <scan>.metadata

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

interpret the UNICAT metadata (mostly floating point) from the scan header

Parameters

scan (SpecDataFileScan) – data from a single SPEC scan (instance of SpecDataFileScan)

process(text, scan, *args, **kws)[source]#

required: Handle this line from a SPEC data file.

PARAMETERS

text str:

?raw text?

spec_obj obj:

Instance of SpecDataFile, SpecDataFileHeader, or SpecDataFileScan

writer(h5parent, writer, scan, nxclass=None, *args, **kws)[source]#

Describe how to store this data in an HDF5 NeXus file