In this Topic Hide
The menus Probe|More Probe Functions... and the graph menu Measure|More Functions... each open a tree list dialog box that displays the function available. In this section we describe how this system works and how it can be extended.
We have only skimmed over the basics. For more information, please refer to the scripts themselves.
The operations listed for the menus described above are obtained from one of two built-in text files. These files are:
analysis_tree.sxscr | For curve analysis functions |
probe_tree.sxscr | For probe functions |
Like built in scripts, these are embedded in the binary executable but can also be overridden by placing files of the same name in the biscript directory.
Both files use the same format. Each entry in the tree list is defined by a single line in the file. Each line contains a number of fields separated by semi-colons. The first field is that command that is called to perform the action while the remaining fields describe the hierarchy for the entry in the tree list control. The command is usually a script often with a number of arguments. To add a new function, simply add a new line to the relevant file. The order is not important.
These are the "driver" scripts that perform the curve analysis and curve analysis over cursor span analysis respectively. These don't perform the actual calculations but carry out a number of housekeeping tasks. The calculations themselves are performed by a script whose name is passed as an argument. To add a new function you need to create one of these scripts. For simple functions the script is not complicated. In the example below we show how the "Mean" function is implemented and you will see that it is very simple.
The entry for the full version of this in analysis_tree.txt is:
measure_mean;Measure;Transient;Mean;Full |
measure /ne 'calculate_mean' 'Mean' |
'calculate_mean' specifies the script to call to perform the calculation.
'Mean' specifies the y-axis label.
The 'calculate_mean' script is as follows:
Arguments data xLower xUpper @result @error |
if xUpper>xLower then |
Let result = Mean1(data, xLower, xUpper) |
else |
Let result = Mean1(data) |
endif |
|