Here we review the syntax of mathematical expressions. Any user who wishes
to use VISTA effectively should review this section carefully.
Arithmetic expressions come in four types:
- 1.
- An explicit numeric value. Examples are: 3, 3.14159, -59.39, 2.32E-05
- 2.
- Variable names. Variables are created and their values
assigned with the SET command. Variable names must be
composed of alphanumeric characters. There can be up to
seven characters in the name. The first character of the
variable name should be an alphabetic character.
- 3.
- Data file references. Data file references allow you to
use numeric values from a VMS ASCII text file. Data file
references begin with the @ symbol followed by the file
name, a period (.), and then the column number. The
column number can itself be either a numeric integer constant
or a variable name. An example is given in the description
of the READ command.
- 4.
- Constants or variables connected with arithmetic operators
or using functions (general arithmetic expressions).
The following table lists arithmetic functions supported in VISTA, with
examples of their use. ('Binary' means relating two objects - 'unary'
means applying to one object.)
Symbol |
Function |
Examples |
|
|
+ |
binary addition |
B+C |
2+5 |
|
- |
binary subtraction |
B-C |
2-5 |
|
* |
binary multiplication |
B*C |
2*5 |
|
/ |
binary division |
B/C |
2-5 |
|
- |
unary negation |
-B |
|
|
^ |
exponentiation |
A00.5 |
10^3 |
|
= |
equate |
A=B |
A=B=3 |
|
The following logical operators are also supported.
Symbol |
Function |
Examples |
|
> |
logical greater than |
A>B |
A>2.5 |
< |
logical less than |
A<B |
A<100 |
== |
logical equal to |
A==B |
A==10 |
= |
logical not equal to |
A =B |
A =10 |
<= |
logical less than or equal to |
A<=B |
A<=5 |
>= |
logical greater than or equal to |
A>=B |
A>=3 |
Logical operators return a value of either 1 (true) or 0 (false).
Expressions are evaluated in the same order as they are in FORTRAN. You
may change the order of evaluation using parentheses "()". An example is
- (B+0.53)*10^ (45.6/(A+5))
VISTA supports a variety of functions. The argument to the
function is contained in square brackets. The following functions are
currently supported:
Arithmetic Functions:
- INT[E]
- nearest integer to the expression E
- ABS[E]
- absolute value of E
- MOD[E,I]
- E modulo I
- IFIX[E]
- integer part of E (truncation)
- MAX[E,F]
- the larger of E or F
- MIN[E,F]
- the smaller of E of F
- LOG10[E]
- log to the base 10 of E
- LOGE[E]
- log to the base e of E
- EXP[E]
- e raised to the power E (Use for all other exponentiations)
- SQRT[E]
- square root of absolute value of E
- RAN[A,B]
- returns a random number between A and B
Trignonmetric Functions:
- SIN[E]
- sine of E (E in radians)
- SIND[E]
- sine of E (E in degrees)
- COS[E]
- cosine of E (E in radians)
- COSD[E]
- cosine of E (E in degrees)
- ARCTAN[E]
- arctan of E, producing radians
- ARCTAND[E]
- arctan of E, producing degrees
- ARCCOS[E]
- arccos of E, producing radians
- ARCCOSD[E]
- arccos of E, producing degrees
Image Parameters:
- NR[B]
- number of rows of the object in buffer B.
- NC[B]
- number of columns of ...
- SR[B]
- start row ...
- SC[B]
- start column ...
- EXPOS[B]
- exposure time ...
- RA[B]
- right ascension in sec of time of ...
- DEC[B]
- declination in sec of arc ...
- ZENITH[B]
- zenith distance in radians ...
- UT[B]
- universal time of mid-exposure in hours ...
Examing/Editing Image Data:
- GETVAL[I,R,C]
- returns the value of the pixel at row R and
column C in image I.
- SETVAL[I,R,C,V]
- returns the value of the pixel at row R and
column C in image I, then sets the value of that pixel to V.
- WL[I,P]
- returns the wavelength of pixel P in image I.
- PIX[I,W]
- returns the pixel corresponding to
wavelength W in image I.
Functions may be used as arguments of other functions. Functions can
contain expressions of arbitrary complexity (so long as the parentheses are
balanced and there are no extraneous spaces!).
IMPORTANT!
Variable names or arithmetic expressions may be used ANYWHERE an explicit
constant may be used in keyword-value expressions. Recall that such an
expression has an 'option=value' construction. For example, if you wanted
to plot row 200 of image 4 over columns X to X+50, (where X is some
variable) you could say
- PLOT 4 R=200 XS=X XE=X+50
Note that R, XS, and XE are keywords, not variables and the equal sign
following them is not interpreted as an arithmetic operation. However,
since everything following the first = is an arithmetic expression, you
could save the 'value' of, for instance, XE, by doing the following
- PLOT 4 R=200 XS=X XE=XLAST=X+50
The variable XLAST takes on the value of X+50.