User's Guide

MF

Performs mathematic operations on one or more columns of an IBIS tabular file

Function:

Performs mathematic operations on one or more columns of an image based information system (IBIS) tabular file. FORTRAN-like expressions are entered to indicate the operations to be performed and the input and output column numbers to be used.

Parameters:

INFILE
Input file. Input IBIS tabular file to be modified.

MATHEXP
Mathematical expression. The mathematical expressions to be used. The expressions are written as a parameter string and must follow a certain syntax.

The variables representing column numbers are written as keywords. An upper-case "C" followed by a number indicates a column used as input or output.

The functions available are: SQRT, ALOG, ALOG10, AINT, SIN, COS, TAN, ASIN, ACOS, ATAN, ATAN2, ABS, MIN or AMIN1, MAX or AMAX1, and MOD or AMOD. The standard binary operations +, -, *, /, **, are also included. All operations listed operate as in FORTRAN with the exception of MIN and MAX which are binary only. The expression is evaluated using the same precedence of operators as in FORTRAN.

The logic operations, .AND., .OR., .XOR., and .NOT. are also available. The logical operations are performed bitwise on the operands.

The relational operators, .LT., .LE., .EQ., .NE., .GE., and .GT. can be used in expressions. If the relationship test evaluates to true, a value of one is written to the output column. Otherwise, if the result is false, a value of zero is output.

Column statistics can also be calculated. This operation is different than the previous operations because it operates on a vertical column instead of horizontally across a row. These special operations must be preceded by a # in the expression. The allowable column operations are: #MEAN, #SIGMA, #MIN, #MAX, #SUM, and #FIRST. However, these operations cannot be used in an arithmetic expression. For example, the expression "C5 = #MEAN(C3)*10" is not valid.

The maximum number of columns that can be referenced in one execution is 19.

Examples:

  1. LAS> mf infile=tab mathexp=("c7=c2+c3","c6=0")

    For each row in the IBIS tabular file, the values from column 2 and column 3 are added together and the result is output to column 7 and a zero value is output to column 6.

  2. LAS> mf infile=tab mathexp="c8=c2/c3+100+sqrt(c2)"

    The value from column 2 is divided by the value from column 3 and added to 100 plus the square root of the column 2 value to obtain the result which is output to column 8. This process is repeated for each row in the IBIS tabular file.

  3. LAS> mf infile=tab mathexp="c9=#mean(c2)"

    The mean of column 2 is calculated and that value is placed in every row entry in column 9 of the IBIS tabular file.

  4. LAS> mf infile=tab mathexp="c2=c4.and.c7"

    A bitwise AND operation is performed on the operands from column 4 and 7 and the result is written in column 2. This process is repeated for each row in the IBIS tabular file.

Description/Algorithm:

The program begins with the standard initialization and retrieval of user-specified parameters. The input file is opened. The input expression is parsed to determine the input and output columns and the operations to be performed. The expression is compiled into machine instructions and the data from the input columns is retrieved. The expression is applied to the input data to obtain the result which is written to the indicated output column.

Nonfatal Error Message:

  1. [mf-close] Error closing input file

    An error was encountered while closing the input file. The data may still be valid.

Fatal Error Messages:

  1. [mf-exprssn] Error in input expression

    An error was encountered while parsing the input expression. Verify the syntax of the expression.

  2. [mf-fatal] Fatal error encountered

    A fatal error was encountered during processing. The IBIS tabular file may or may not be valid. The message that is displayed immediately preceding this message is the specific error that was encountered.

  3. [mf-open] Error opening file

    An error was encountered while trying to open the IBIS tabular file.

  4. [mf-read] Error reading file

    An error was encountered while trying to read from the IBIS tabular file.

  5. [mf-write] Error writing file

    An error was encountered while trying to write to the IBIS tabular file.

User Notes:

    None.