SPEC allows one to add user-defined data columns to the scan files.
It is done by redefine the SPEC standard macros Fheader, Flabel and
Fout.
In Fheader,you tell that how many extra columns are added. In Flabel,
the name of each new column are given. In Fout, the cmd to retrieve
each
column and the output format in the data file. The uspec_column package
attempts to provide a relative easy way to redefine the Fheader, Flabel
and
Fout macros. This is based UNI_CAT's
macro by Pete Jemian.
It includes four functions to meet the needs:
/* tag -- a string, the name of the new column
fmt -- a string, output format of the data used by the sprintf() function
cmd -- a string, command to get the data
key -- a string, identifier to group the data columns. You can have several columns grouped under this key, and remove them together while keep other columns.
*/
to remove one column
/* tag -- a string key -- a string
*/
u_column_remove(key)
: to remove columns under the key
identifier
/* key -- a string : if key is "all", then all user-defined columns are deleted.
*/
to show all user defined columns
Here are some examples:
- to add the sample temperature from the epics based Lakeshore controller:
u_column_add("TempSample","%.8g","epics_get(\"xxx:LS331:TC1:SampleA\")","temp")
- to add the rois of a MCA into scan data
u_column_add("roi1","%.8g","epics_get(\"xxx:mca.R01\")","mca")
u_column_add("roi2","%.8g","epics_get(\"xxx:mca.R02\")","mca")
- to display the user defined columns
u_column_show
Columns defined as pieces of
identifier:mca
roi2 : epics_get("xxx:mca.R02") :
%.8g
roi1 : epics_get("xxx:mca.R01") :
%.8g
Columns defined as pieces of
identifier:temp
TempSample :
epics_get("xxx:LS331:TC1:SampleA") : %.8g
- to remove the roi1 column
u_column_remove("roi1","mca")
- to remove all columns under "mca" key
u_column_clear("mca")
- to clear all user columns
u_column_clear("all")