Metadata#
Metadata in SPEC data files may be described using various control lines. The following table describes how each control line is handled and written in a NeXus/HDF5 data file.
control line |
section |
---|---|
|
|
|
|
|
|
|
SPEC UserResults#
The SPEC data file header control line #R
is reserved 1
for users to describe any information of their choosing. This control line may
be used in a scan. It is optional but may be appear more than once. Here are
examples from various SPEC data files:
1#R 2
2#R 11 Max: 83356 at 5.469 FWHM: 0.0165099 at 5.48551 COM: 5.48525 SUM: 3.47646e+06
When present in a scan, then /SCAN/UserResults
(a NXnote 2
group) is created. The value is written as text (any leading or trailing
white space is removed) into a field within this group as item_1
(where the
number increments for each item in the scan). Here is the UserResults
group
created by the above example #R
lines:
1UserResults:NXnote
2 @NX_class = "NXnote"
3 item_1:NX_CHAR = [b'2']
4 item_2:NX_CHAR = [b'11 Max: 83356 at 5.469 FWHM: 0.0165099 at 5.48551 COM: 5.48525 SUM: 3.47646e+06']
SPEC UserReserved#
The SPEC data file header control line #U
is reserved 1
for users to describe any information of their choosing. This control line may
be used in both the header and a scan. It is optional but may be appear more
than once. Here are examples from various SPEC data files:
header
1#U p09user
scan
1#U Beam Current: 101.9
2#U Energy: 5.5000
3#U EntSlits: 1.000 x 1.000 @ 0.000, 37.775
4#U Undulator Tracking is on; Offset:0.070
When present in either the scan or its header, then /SCAN/UserReserved
(a
NXnote 2 group) is created. The value is written as text (any
leading or trailing white space is removed) into a field within this group as
header_1
or item_1
(where the number increments for each item in
the header or scan, respectively). Here is the UserReserved
group created
by the above example #U
lines:
1UserReserved:NXnote
2 @NX_class = "NXnote"
3 header_1:NX_CHAR = [b'p09user']
4 item_1:NX_CHAR = [b'Beam Current: 101.9']
5 item_2:NX_CHAR = [b'Energy: 5.5000']
6 item_3:NX_CHAR = [b'EntSlits: 1.000 x 1.000 @ 0.000, 37.775']
7 item_4:NX_CHAR = [b'Undulator Tracking is on; Offset:0.070']
UNICAT-style metadata#
UNICAT-style metadata consists of key:value pairs encoded using the #H
and
#V
control lines which describe keys and values, respectively. The design
is similar to that used to describe positioner, using #O
and #P
lines
for the keys and values. The keys are provided in the header, in numbered lines
#H0
, #H1
, … with multiple keys on a line. The corresponding values
are provided on numbered #V
lines in the scan, with matching number of
values on each line. For example:
header
1#H0 SR_current barometer_mbar
2#H1 SR_BPM_HP SR_BPM_VP SR_BPM_HA SR_BPM_VA
3#H2 DCM_energy DCM_lambda UND_energy UND_tracking UND_offset mrEnc arEnc
scan
1#V0 102.23 981.665
2#V1 -0.0201432 0.110706 28.0838 11.7067
3#V2 18 0.688801 18.1723 1 0.2 10.4046 10.318091
When present in a scan, then /SCAN/metadata
(a NXnote 2 group)
is created. Within this group, a field is written for each key:value pair. It
may be necessary to change the name of a key, to make it unique, so all fields
will have the original name of the key written as the spec_name
attribute.
Here is the metadata
group created by the above example #H
and #V
lines:
1metadata:NXnote
2 @NX_class = "NXnote"
3 @description = "SPEC metadata (UNICAT-style #H & #V lines)"
4 @target = "/S1/metadata"
5 DCM_energy:NX_FLOAT64 = 18.0
6 @spec_name = "DCM_energy"
7 DCM_lambda:NX_FLOAT64 = 0.688801
8 @spec_name = "DCM_lambda"
9 SR_BPM_HA:NX_FLOAT64 = 28.0838
10 @spec_name = "SR_BPM_HA"
11 SR_BPM_HP:NX_FLOAT64 = -0.0201432
12 @spec_name = "SR_BPM_HP"
13 SR_BPM_VA:NX_FLOAT64 = 11.7067
14 @spec_name = "SR_BPM_VA"
15 SR_BPM_VP:NX_FLOAT64 = 0.110706
16 @spec_name = "SR_BPM_VP"
17 SR_current:NX_FLOAT64 = 102.23
18 @spec_name = "SR_current"
19 UND_energy:NX_FLOAT64 = 18.1723
20 @spec_name = "UND_energy"
21 UND_offset:NX_FLOAT64 = 0.2
22 @spec_name = "UND_offset"
23 UND_tracking:NX_FLOAT64 = 1.0
24 @spec_name = "UND_tracking"
25 arEnc:NX_FLOAT64 = 10.318091
26 @spec_name = "arEnc"
27 barometer_mbar:NX_FLOAT64 = 981.665
28 @spec_name = "barometer_mbar"
29 mrEnc:NX_FLOAT64 = 10.4046
30 @spec_name = "mrEnc"
See section unicat plugin for the API documentation.
UXML#
See section #UXML: UXML metadata plugin for more details about the #UXML
control line
and the API documentation. The #UXML
lines provide an XML document
description in a scan’s metadata. It is used at APS sector 33 but not so
much elsewhere.