Scan#

The #S control line marks the beginning of each scan in a SPEC data file. It provides the scan number (SCAN_N in SPEC) and the scan command. Consider this example:

 1#S 1  ascan  tth -0.7 -0.5  101 1
 2#D Wed Feb 10 01:11:25 1999
 3#T 1  (Seconds)
 4#P0 -0.80000004 -0.60000003 -0.15875 0.16375
 5#N 5
 6#L Two Theta    Epoch  Seconds  ic0  winCZT
 7-0.70000003  75 1 340592 1
 8-0.69812503  76 1 340979 1
 9-0.69612503  78 1 341782 1
10-0.69412503  79 1 342594 1
11-0.69212503  80 1 343300 0
12-0.69012503  82 1 341851 0
13-0.68812503  83 1 342126 1
14-0.68612503  85 1 342311 0
15-0.68425003  86 1 343396 1
16-0.68225003  88 1 343772 1
17-0.68025003  89 1 343721 1
18-0.67825003  91 1 341127 2
19-0.67625003  92 1 343733 0
20#C Wed Feb 10 01:12:39 1999.  More scan content removed for brevity.

From this example, this structure (from #S, #D, #T, and #C control lines) is written to a new NXentry 1 group at the root of the NeXus HDF5 file:

 1S1:NXentry
 2  @NX_class = "NXentry"
 3  @default = "data"
 4  T:NX_FLOAT64 = 1.0
 5    @description = "SPEC scan with constant counting time"
 6    @units = "s"
 7  command:NX_CHAR = [b'ascan  tth -0.7 -0.5  101 1']
 8  comments:NX_CHAR = [b'Wed Feb 10 01:12:39 1999.  More scan content removed for brevity.']
 9  counting_basis:NX_CHAR = [b'SPEC scan with constant counting time']
10  date:NX_CHAR = [b'1999-02-10T01:11:25']
11  experiment_description:NX_CHAR = [b'SPEC scan']
12    @description = "SPEC data file scan"
13  scan_number:NX_INT64 = 1
14    @spec_name = "SCAN_N"
15  title:NX_CHAR = [b'1  ascan  tth -0.7 -0.5  101 1']

The name of the group (/SCAN) is composed from the scan number (SCAN_N) as:

S{SCAN_N}[.{REPEAT_NUMBER}]

If there is more than one scan with the same SCAN_N (such as #S 1) in the data file, the additional scans will be named with an additional decimal point and then a sequence number (described here as REPEAT_NUMBER) indicating the specific repeat, (such as S1, S1.1 and S1.2 for the first, second, and third scans, respectively, with #S 1)

The Scan Data will be described in the next section.

Note that command and title are almost the same content but not exactly the same. The difference is that command is the title with the scan number removed from the beginning.

If the scan uses a constant monitor count (instead of a fixed time interval), then the #T line in the scan is replaced by #M line, such as:

1#M 20000  (I0)

In the NeXus HDF5 file, the T field 2 is replaced by M

1M:NX_FLOAT64 = 20000.0
2   @description = "SPEC scan with constant monitor count"
3   @units = "counts"
4monitor:NXmonitor
5   @NX_class = "NXmonitor"
6   preset --> /S1/M
1

NXentry: https://manual.nexusformat.org/classes/base_classes/NXentry.html

2

A NeXus field is the same as an HDF5 dataset. The rename is due to historical reasons in NeXus when XML was used as a back-end data file storage format.