User Defined ScansFerdi Franceschini2006-08-16 15:25Creating a Scan CommandA scan command must first be initialised with MakeScanCommand
command in the SICS configuration file before it can be used.
MakeScanCommand initialises the SICS internal scan
command.MakeScanCommandname countername headfile recoverfilArguments must be in the order describednameThe scan will be accessible as name in the
system. counternameThe name of a valid counter object to use for countingheadfileThe full pathname of a header description file. This file describes the
contents of the header of the data file. The format of this file is
described belowrecoverfil The full pathname of a file to store recover data. The internal scan
command writes the state of the scan to a file after each scan point. This
allows for restarting of aborted scans. Using a Scan Command The scan command (named here MyScan, but may have another name)
understands the following commands: MyScan runNP mode preset Executes a scan. NP is the number of scan pointsmode is the counter mode, either
or preset is the preset value for the counterScan data is written to an output file. MyScan addname start step Adds the variable specified by the argument
name to the list of variables scanned in the next
scan. The arguments start and
step define the starting point and the step width
for the scan on this variable. MyScan appendvarposi posAppend pos to the array of positions for scan
variable i. To be used from user defined scan
functions. MyScan callbackstatusTriggers callbacks configured on the scan object. Allow status one of:May be used by user functions implementing own scan loops. MyScan clearClears the list of scan variables. Must be called before each scan that
has different parameters. MyScan configure modeConfigures the scan modeAllowed mode one of: (default). Writing ASCII files Scan functions are overriden by the user. The scan stores and saves software zero point
corrected motor positions. The standard is to save the hardware positions as
read from the motor controller.MyScan continueNP mode preset Continues an interrupted scan. Used by the recovery feature. MyScan function list Lists the available configurable function names. The calling style of
these functions is described in the next section about stdscan. MyScan functionfunctionnameReturns the currently configured function for
functionnameMyScan functionfunctionname newfunctionnameSets a new function to be called for the function
functionname in the scan. MyScan getcountsRetrieves the counts collected during the scan. MyScan getfileReturns the name of the current data fileMyScan getmonitoriPrints the monitor values collected during the scan for monitor
iMyScan gettimePrints the counting times for the scan points in the current scan. MyScan getvardatanRetrieves the values of a scan variable during the scan (the x axis).
n is the ID of the scan variable to retrieve
data for. ID is 0 for the first scan variable added, 1 for the second etc.
MyScan getvarpariPrints the name, start and step of the scan variable number
iMyScan interestA SICS client can be automatically notified about scan progress. This is
switched on with this command. Three types of messages are sent: a string NewScan on start of the scana string ScanEnd after the scan has
finished a string scan.Counts = {109292 8377 ...}
with the scan values after each finished scan point.
MyScan uuinterestAs for interest but the array of counts is transferred
in UU encoded format. MyScan dyninterestAs for interest but scan points are printed one by one
as a list containing: point number first_scan_var_pos counts. MyScan uninterest Uninterest switches automatic notification about scan progress off.
MyScan integrate Calculates the integrated intensity of the peak and the variance of the
intensity for the last scan. Returns either an error when insufficient scan data is available, or a
pair of numbers. Peak integration is performed along the method described by
Grant and Gabe in J. Appl. Cryst. (1978), 11, 114-120. MyScan logvarAdds var to list of variables logged during the
scan. Can be slave motors such as during
four circle work. These variables are not driven, just logged.
var is the SICS variable to log. Only
drivable parameters may be logged in such a way. MyScan noscanvarPrints the number of scan variables MyScan npPrints the number of points in the current scan. MyScan setchannelnSometimes it is required to scan not the counter but a monitor. This
command sets the channel to collect data from. n
is an integer ID for the channel to use. MyScan simscanpos FWHM height BROKENThis is a debugging command. It simulates scan data with a hundred points
between an x axis ranging from 10 to 20. A gaussian peak is produced from
the arguments given: pos the position of the peak maximumFWHM is the full width at half maxxximum for
the peak height is its heightMyScan silentNP mode preset Executes a scan. Does not produce an output fileMyScan storecounts counts time mon1 mon2 ... Don't understand the syntax nha. This stores an entry of count values into the scan data structure. To be
used from user defined scan functions. The scan pointer is incremented by
one. MyScan storecounterStore the counts and monitors in the counter object configured for the
scan into the scan data structure. Increments the scan pointer by one.
MyScan recoverRecovers an aborted scan. The scan object writes a file with all data necessary to continue the scan
after each scan point. If for some reason a scan has been aborted due to
user intervention or a system failure, this scheme allows to continue the
scan when everything is alright again. This works only if the scan has been
started with run, not with
silentMyScan windownewvalPeak Integration uses a window in order to determine if it is still in the
peak or in background. This command allows to request the size of this
window (without argument) or set it with newvalUser Definable Scan FunctionsThe last commands in the last section allow overloading functions that implement
various operations during the scan with user defined functions. This section is the
reference for user defined functions. The following operations during a scan can be
configured: count MyScan userobjectname point mode presetCalled at each scan point to perform the counting operation collect MyScan userobjectname point Called for each scan point. This function stores the scan data into the
scan data structure. drive MyScan userobjectname pointdrive to the next scan point finish MyScan userobjectnameCalled after the scan finishes and may be used to dump a data file or
perform other clean up operations after a scan. prepare MyScan userobjectnameDoes operations before a scan starts. userdata This is the name of a user defined object which may be used to store user
data for the scan. writeheader MyScan userobjectnameWrite the header of the data file writepoint MyScan userobjectname point Called for each scan point. Prints information about the scan point to the
data file and to the user. MyScan is the name of the scan object invoking the function. This can
be used for querying the scan object. userobjectname is the
name of a entity as specified as userdata in the configuration. point is the number of
the current scan point.