spec

Software for Diffraction

1.4.1. - Standard Data File Format



The format of the data files used by spec is set at the macro level. The files are ASCII, so they can be easily manipulated by other UNIX utilities such as grep, sed, awk or any of the editors. The format of files produced by the standard macros is described here.

When opened with the newfile macro, the following header is written to initialize the data file:
#F /tmp/data
#E 729994936
#D Wed Feb 17 19:22:16 1994
#C cu 110  User = bill
#O0 Two Theta  Theta  Chi  Phi
Information or control lines begin with a # character, with the character in the second column indicating the type of information that follows. The first line of the data file header contains the name by which the file was opened. The next line is the number of seconds from the UNIX epoch as returned by the time() function. In the data that will follow, each scan point will include a field containing the number of seconds elapsed since that file creation time. Next in the header is a line containing the date as returned by the date() function, then a comment line. That is followed by a line containing all the motor names in use. Each motor name is separated from the other by two spaces. What will then follow will be various comment lines created by the comment macros, user defined entries and scan data.

Each scan has a header that looks like the following, always beginning with a blank line:
#S 1  hklscan  0.9 1.1  0 0  0 0  20 1
#D Wed Feb 17 19:25:55 1994
#T 1  (Seconds)
#G0 0 0 0 0 0 1 0 0 0 0 0 0
#G1 1 1 1 90 90 90 3 3 3 90 90 90 1 0 0 0 1 0 60 30 0 0 0 0 60 30 0 -90 0 0 0
#Q .9 0 0
#P0 29.745 29.745 90 0
#N 7
#L H  K  L  Epoch  Seconds  Monitor  Detector
The first line of the scan header contains the scan number followed by the basic scan name and its arguments. (Scans invoked as hscan or kscan execute the basic hklscan, scans such as lup or dscan execute ascan, etc.) The next line is the date and time the scan was started. Following that, the #T control line indicates that the scan was counting to time and for what duration at each point. A #M would indicate counting to monitor.

The next lines give information that describe the diffractometer configuration at the start of the scan. Following #G0 are the current values of the four-circle parameters, which are defined four-circle macro file, macros/fourc.src. Following #G1 are the current parameters describing the crystal lattice and orientation matrix. The identification of these parameters is in the macro file macros/ub.mac. The #Q line gives the H,K,L coordinates at the start of the scan, while the #P0 line gives the motor positions at the start of the scan with each column corresponding to the motor names in the #O0 line of the scan header. The 7 after #N indicates there will be seven columns of data in the scan, and the #L line gives the names for each column, each name separated from the other by two spaces. The detector counts are always placed in the last column, preceded by the monitor counts, if counting to time, or the elapsed time for that data point, if counting to monitor. The Epoch column has the number of seconds elapsed from the time of the #E at the start of the file.

Following the scan header is the scan data. These are just lines of space-separated numbers that correspond to the column headers given with #L. Intervening #C comment lines may lie within the rows of data if, for example, the scan was aborted and then restarted with the scan_on macro. Otherwise, the data continues until the next non-comment control line or blank line.

You can develop your own programs and scripts to extract data from the spec data file, or you may want to use the scans.4 user function that is part of the C-PLOT package, or the stand-alone scans program that is based on scans.4.