Batch Processing

Contents
Overview
Batch processing is based on extensive customisation of QSAS by Stein
Haaland, to whom the QSAS team are grateful for providing his code.
The Batch Processing window is launched from the Plug-Ins
menu. It allows commands from an ascii script file to be run that can
access data ingestion, calculation (calculator and Plug-Ins) and
plotting. Sequences of operations may be performed easily.

Batch Files
A batch file is an ascii file containing a list of commands understood
by QSAS batch handling. The full list of commands is shown on the top of
the sample batch file for convenience.
Use any editor to create or modify your batch file and save as plain text.
Note ISO time is written in the form 2004-01-19T14:12:50.00 with arbitrary precision after the decimal point.
Operations understood currently are :
(elements in <> are to be replaced by suitable text)
- EXITONERROR flag to stop if error detected
- WRITELOG <Path/Name> writes timing info to named file
- CLEARWL clears working list Data and
Time objs
- CLEARDATA clears just working list Data
- CLEARTIME clears just time objects on the WL
- RESTORE_SESSION <FILENAME_WITH_PATH> restore the named session
- RESTORE_WL <FILENAME_WITH_PATH> restore the named WL saveset
- RESTORE_CALC <FILENAME_WITH_PATH> restore the named Calculator saveset
- RESTORE_PLOT <FILENAME_WITH_PATH> restore the named Plot saveset
- CREATE_TIME <ISOTIME1> <ISOTIME2> <Optional_Name_of_object> creates a new time interval object from start and stop time strings with name provided (default name is Ivl)
- CREATE_TIME_DURATION <ISOTIME_START> <DURATION> <Optional_Name_of_object> creates a new time interval object from start time string and duration in seconds with name provided (default name is Ivl)
- CREATE_SHIFTED_TIME <ISOTIME1> <ISOTIME2> <SHIFT_SEC> <Optional_Name_of_object> creates
a new time interval object from start and stop time strings and a shift
in seconds to be added to both start and stop, with name provided
(default name is Ivl)
- CREATE_SHIFTED_TIME_DURATION <ISOTIME_START>
<DURATION> <SHIFT_SEC> <Optional_Name_of_object> creates
a new time interval object from start time string and duration in
seconds with the start time shifted by the shift in seconds, with name
provided (default name is Ivl)
- CREATE_DOYTIME <YYYY_DOY_HHMMSS(.SS) START> <DURATION> <Optional_Name_of_object> creates
a new time interval object from start time string (in DOY format) and
duration in seconds with name provided (default name is Ivl)
- CREATE_DOYTIME_SHIFT <YYYY_DOY_HHMMSS(.SS)
START> <DURATION> <SHIFT_SEC>
<Optional_Name_of_object> creates a new time interval object from start time string (in DOY
format) and duration in seconds and start time moved by shift in seconds with name provided (default name is Ivl)
- CONSTANT_VEC <Name_of_object> <X> <Y> <Z> creates a constant vector object with given name and cartesian components as shown.
- CONSTANT_STR <Name_of_object> <TEXT_VALUE> creates a constant string object from TEXT_VALUE with given name.
- CONSTANT_INT <Name_of_object> <INT_VALUE> creates a constant integer object from INT_VALUE with given name.
- CONSTANT_DBL <Name_of_object> <DOUBLE_VALUE> creates a constant double object from DOUBLE_VALUE with given name.
- INIT_PLUG_ARGS <N_IN_ARGS> <N_OUT_ARGS> sets the number of args in/out for the next plugin to be run
-
SET_IN_PLUG_ARG <ARG_NUM> <ARG_TEXT> sets plugin input argument number arg_num to arg_text (which may be an object name with path on the WL). One of these is required for each plugin input before plugin is run.
-
SET_OUT_PLUG_ARG <ARG_NUM> <ARG_TEXT>
sets plugin output name for argument arg_num to arg_text(name)
- PLUGINPATH
<PATH> set path to be prepended to PLUGIN_NAME_WITH_PATH. Cancel with empty arg.
- RUNPLUGIN <PLUGIN_NAME_WITH_PATH> run the named plugin
-
CALC_PAGE
<PAGE_NUMBER> evaluate calculations on page of calculator
- SHELL <COMMAND>
<ARGUMENTS> execute named command line instruction
- PRINTDIRECT
<FILENAME_WITH_PATH.ext> prints to file type
defined by .ext (.pdf .jpg .png .svg)
- READ_DATA <FILENAME_WITH_PATH>
<VARIABLE_NAME> <optional_ISOTIME_START>
<optional_ISOTIME_END> reads named variable from named file (with path). If no start or end time provided it gets the whole range.
- WAIT pause until resume button
pressed
- DELETEITEM <FILENAME_WITH_PATH>
<Optional_NAME_AFTER_SPACE> deletes the named item from the WL. Note that Time Intervals need two args as there is a space in "Time Intervals" itself.
- .stop stop batch processing here (useful when debugging to stop after a specific command).
Running a Batch File
Launching the Run Batch File window from the Plug-Ins menu. This will have a button Open batch file, which will bring up a file dialog to open your batch file.
The name and path of the batch file currently open will be displayed below the button.
The buttons at the bottom of the window will allow the file to be run or stepped through, and commands will be printed in the text window as they are executed.
Note that the calculator, plug-In and plot windows are not displayed,
and commands are executed in the background. It is therefore necessary
to save plots to a file within the script commands. Objects are saved to
the working list as normal after plugins or calculations are executed.
Tips/FAQ
-
The easiest way to create a script is to edit the sample script included with QSAS examples/Batch/SampleBatchScript.qbt.
- Note that the script commands available are listed as comments at the top of the sample script.
Page created by Tony Allen, csc-support-dl@imperial.ac.uk
Last up-dated: October 2016 Tony Allen