STAT: Compute Statistics of Data in a File

Form: STAT variable=function[expression]
variable
is a VISTA math variable in which the value of the statistic is stored.
expression
is an arithmetic expression which involves at least one reference to data in an OPEN'ed ASCII file.
function
is one of the following:
 $$
MAX :Find the maximum value of the expression.
 $$
MIN :Find the minimum value of the expression.
 $$
FIRST :Finds the first value of the expression.
 $$
LAST :Find the last value of the expression.
 $$
COUNT :Counts the number of lines in the file. In this case 'expression' is a logical file name.
 $$
LOAD : Loads the arithmetic expression from each line in the input file into a specified buffer using STAT N=LOAD[buffer,expression]

The STAT command can be used to determine information about the data values in an ASCII file. For the MAX and MIN functions, the given expression is evaluated for each line in the file. For the FIRST function, the expression is evaluated for the first line in the file and for the LAST function the expression is evaluated for the last line in the file. The COUNT function merely counts the lines in the file. Remember that SKIP'ed lines (see the SKIP command) are never included in the calculations. These STAT functions are not the same as the normal VISTA math functions and can not be included in other mathematical expressions.

The LOAD function allows the user to load data from an input ASCII file into a VISTA image buffer. Arithmetic operations may be performed on the input data before loading into the buffer. Simply specify the desired buffer and the arithmetic expression to load. The new buffer will automatically be created.

Examples:

STAT LINES=COUNT[DATAFILE]
Set the variable LINES to the number of lines in the file DATAFILE. DATAFILE must have been opened with the OPEN command. SKIP'ed lines are not counted.

STAT MAXVAL=MAX[2.5*LOG10[@PHOT.2]
] Evaluates the expression 2.5*LOG10[@PHOT.2] for each line in the file PHOT and sets MAXVAL to have the maximum value. The file PHOT will be left repositioned to the beginning of the file after the STAT command completes.

STAT N=LOAD[1,@PHOT.1*@PHOT.2]
Loads the product of the values in the first and second columns of the input file PHOT into VISTA buffer number 1.