MAO Framework¶
The MAO (multi-atomic operation) scripting framework aims to keep the user interface fully interactive while running scripts. In this way, the user is free to inspect data, check the progress of operations, or work on collateral functionality.
The following section gives a general introduction to using the scripting framework. The Script Examples section describes full examples.
Using the framework¶
To use the framework, create a Start
function in your script file. In this
function you should:
- Optionally initialize user data
- Initialize the MAO framework
- Add operations
- Start the script in the background
Operations define the functionality and control flow of the script. You can use any function which takes no parameters as an operation in the scripting framework.
To initialize the scripting framework call NFMAOInit
in your Start
function. NFMAOInit
can be given a parameter numRuns
which sets the
number of times the script should loop through its operations. numRuns
is
set to 1 by default.
Next, add operations to the script with the NFMAOAdd
function. Each
operation must define what happens when the operation finishes. This is done
by returning a status code and specifying which operation to perform next.
Return one of the following status codes from each operation:
0
: Success, continue script1
: Success, stop script2
: Cancel, stop script3
: Failure, stop script
Before returning 0
in an operation, specify which operation to perform
next with one of the NFMAOMove...
functions. For example,
NFMAOMoveRelativeToOperation(1)
moves to the operation with operation
index one greater than the current operation. NFMAOMoveToOperation(0)
moves to the first operation. See MAO API Functions for a full list of
functions.
Core NanoFrazor operations are defined in the NanoFrazorMAO
module (see
MAO Operations). To perform a core operation, add a
NanoFrazorMAO#Start...
function and a corresponding
NanoFrazorMAO#Wait...
function to the list of operations. For example, to
perform the trajectory operation add the following:
NFMAOAdd(i,j,"NanoFrazorMAO#StartTrajectory")
NFMAOAdd(i,j+1,"NanoFrazorMAO#WaitTrajectory")
where i
and j
are appropriate indexes for the script. These functions
continue automatically to the next operation on success. That is, they contain a
NFMAOMoveRelativeToOperation(1)
.
The last operation in a script is generally NanoFrazorMAO#Exit
. This
operation counts how many times the script performs NanoFrazorMAO#Exit
and
stops the script when it has been repeated numRuns
times. If less than
numRuns
repetitions have been made the script moves to the first operation
(operation index 0).
Finally, call NFMAOStart
in your Start
function to actually launch the
script. This will return immediately and start performing operations in the
background to keep the UI responsive.
The MAO framework prints messages to the console. Inspecting the console (with the logging level set to Debug) can be useful for debugging scripts.
MAO API Functions¶
These functions allow setting up the MAO framework and changing the control flow of a script.
-
Variable
NFMAOInit
(Variable numSequences, Variable numOperations, Variable numRuns)¶ - Parameters
numSequences
-Number of sequences
numOperations
-Number of operations
numRuns
-Number of runs
-
Variable
NFMAOAdd
(Variable sequenceIndex, Variable operationIndex, String operationFunction)¶ - Parameters
sequenceIndex
-Sequence index
operationIndex
-Operation index
operationFunction
-Operation function including module name
-
Variable
NFMAOStart
()¶
-
Variable
NFGetMAONumRuns
()¶
-
Variable
NFGetMAOCurrentRunIndex
()¶
-
Variable
NFGetMAOCurrentSequenceIndex
()¶
-
Variable
NFGetMAOCurrentOperationIndex
()¶
-
Variable
NFMAOMoveToSequence
(Variable sequenceIndex)¶ - Parameters
sequenceIndex
-Sequence index
-
Variable
NFMAOMoveToOperation
(Variable operationIndex)¶ - Parameters
operationIndex
-Operation index
-
Variable
NFMAOMoveTo
(Variable sequenceIndex, Variable operationIndex)¶ - Parameters
sequenceIndex
-Sequence index
operationIndex
-Operation index
-
Variable
NFMAOMoveRelativeToSequence
(Variable sequenceOffset)¶
-
Variable
NFMAOMoveRelativeToOperation
(Variable operationOffset)¶ - Parameters
operationOffset
-Operation offset
-
Variable
NFMAOCoarseApproachSetup
()¶
-
Variable
NFMAOCoarseApproachInsert
(Variable sequenceIndex, Variable operationIndex)¶ - Parameters
sequenceIndex
-Sequence index
operationIndex
-Operation index
MAO Operations¶
These functions can be used as operations in the MAO framework. Prefix the
function with the module name NanoFrazorMAO#
when adding as a MAO
operation.
-
static Variable
StartIVCurve
()¶
-
static Variable
WaitIVCurve
()¶
-
static Variable
StartPrepSensors
()¶
-
static Variable
WaitPrepSensors
()¶
-
static Variable
StartApproachPiezo
()¶
-
static Variable
WaitApproachPiezo
()¶
-
static Variable
StartTrajectory
()¶
-
static Variable
WaitTrajectory
()¶
-
static Variable
StartLevelPlane
()¶
-
static Variable
WaitLevelPlane
()¶
-
static Variable
StartCLLForces
()¶
-
static Variable
StartCLLRunTime
()¶
-
static Variable
WaitCLLRunTimeAndForces
()¶
-
static Variable
StartElectronics
()¶
-
static Variable
StartElectronicsSetReaderOn
()¶
-
static Variable
StartElectronicsSetReaderOff
()¶
-
static Variable
StartElectronicsGetReaderAmp2
()¶
-
static Variable
WaitElectronics
()¶
-
static Variable
StartDeviceMonitor
()¶
-
static Variable
WaitDeviceMonitor
()¶
-
static Variable
StartStage
()¶
-
static Variable
WaitStage
()¶
-
static Variable
MoveToSequence0
()¶
-
static Variable
MoveToSequence1
()¶
-
static Variable
StartSequence1
()¶
-
static Variable
ReturnToPreviousSequence
()¶
-
static Variable
Exit
()¶