This chapter explains the functions that are available in SPECTRA. Each description is organized in the following way:
Function name
*
on_name(arg_type [arg_name],...)
An asterisk in the function name indicates how a name can be abbreviated. Arguments are explained by their type and if necessary by a name that helps the user to understand the meaning of the argument. The argument types are:
float_expr
An expression that is decoded as a floating point number, involving symbol translations and scalar arithmetic. Example: sin(float_expr), sin(pi/2). |
int_expr
An expression that is decoded as an integer number. The evaluation of an int_expr is done similar to float_expr. But in addition the mantissa of the result is truncated. Example: fact(int_expr). SPECTRA |
gqe_id
A GQE identifier, see section 8 for a definition of this term, example: attribute( gqe_id, keyword), attr(bpu1, x_min). |
keyword
If an argument is of the type keyword, it has to be chosen from a list of available items, example: attribute( gqe_id, keyword). The keywords for the attribute function are identical to the qualifier names of the corresponding SET command. Example: SPECTRA |
scan_id
A GQE identifier of a scan, e.g.: integral(scan_id), integral(bpu1). |
text_expr
An expression that is decoded as a text string, involving symbol translations and concatenations. Example: uppercase( text_expr). SPECTRA |
vector_expr
An expression that consists of a vector_id or an arithmetic expression involving vector_id's, example: The function abs( vector_expr) can be used like: calc new_name = abs(1000 * bpu1).
|
vector_id
An identifier that selects the x- or y-values of a SCAN (see section 8), example:
SPECTRA
|
void
No argument required, example: date(void), date(). |
The output of functions depends on the context. The types number and text appear in symbolic expressions, vectors only in calc (and vcalc) commands. Note that calc commands may contain symbolic expressions. Lets look at some examples. The command
SPECTRAproduces a single number, since the verb calc is not involved. A vector reference appears in the next example:>
*
= sin(3.1415927)
0
SPECTRA>
calc test = sin(bpu1)
The sinus() function operates on all y-values of bpu1.
The following calc command multiplies a vector
by a scalar:
SPECTRASince bpu1 is a SCAN, sin(bpu1) is a vector. The vector is multiplied by the scalar number sin(pi) and the resulting zeros are copied to the SCAN test. Here are some other examples for symbolic expressions:>
pi = 3.1415927
SPECTRA>
calc test = sin(bpu1)*
sin(pi)
pi = 4* atan(1) |
if (abs(x) > 0) then end |
set bpu1/x_max=2* attr(bpu1, x_max) |
new_name = ”SCAN_"date()”_"time() |
In many of the examples the SCAN bpu1 is used. It can be read by the command:
SPECTRA>
read gra_examples:bpu1
The operation of functions is quite often demonstrated by
a command of the type:
SPECTRA>
*
= some_function()
result