view man/man1/op.1 @ 0:5242703e91d3 tip

Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author tomwalters
date Fri, 20 May 2011 15:19:45 +0100
parents
children
line wrap: on
line source
.TH OP 1 "14 September 1993"

.SH NAME
op \- Ordered sequence of operations on input stream.

.SH SYNTAX 
op  [options]  [file]

.SH DESCRIPTION

A sequence of operations is done on each item in the input stream.
The operations are done in the order they appear on the
command line. Operations can be repeated as many times as needed on the
command line.

Input items may be binary numbers (short or float) or ascii lines
(terminated by CR) according to the type option.

.SH OPTIONS

1. Operations.

The list of operations is as follows. Some operations take valued
arguments (which are real numbers), others are flags, as indicated:

.nf
    operation           result for each input item x

    add=<value>         x+<value>
    negate=on           -x
    multiply=<value>    x*<value>
    divide=<value>      x/<value>
    remainder=<value>   real remainder of x/<value>
    inverse=on          1/x
    round=on            x rounded to nearest integer
    absolute=on         |x|
    power=<value>       x^<value>
    exponent=<value>    <value>^x
    e-exponent=on       e^x
    log=<value>         log(x) to base <value>
    e-log=on            log(x) to base e.
    sin=on              sin(x)
    cos=on              cos(x)
    tan=on              tan(x)
    threshold=<value>   if ( x  <value> ) 0 else if ( x = <value> ) 1
    diff1=on            first difference
    diff2=on            second difference
    diff3=on            third difference
    cusum=on            cumulative sum
    cumean=on           cumulative (recursive) mean an
    cumin=on            cumulative min
    cumax=on            cumulative max
.fi


2. type.

The `type' option sets the data type for all input and output items.
Recognised data types are: short, float, ascii.

Ascii data is read in line-by-line, and comment lines are allowed.
The following operation apply only to ascii input items, enabling
comment lines to be stripped or echoed directly to the output.

.nf
    strip=<value>       ignore lines beginning with <value> string
    echo=<value>        echo lines beginning with <value> string
    number=on           number output lines
.fi

If number=on then stripped lines are not numbered; they simply dissappear.
If there are no operations, (other than comment stripping/echoing or line
numbering), then ascii lines are echoed.


.SH EXAMPLES

1. Specify the following ordered sequence of operations on each binary
float in the input stream: invert (take reciprocal), scale up by 100,
square (raise to power 2), invert (take reciprocal), square root (raise to
power 0.5).

op type=float inverse=on multiply=100 power=2 inverse=on power=.5  file

2. Increase dynamic range by powering up and scaling down.
(Note that internal calculating is done in floating point; the short datatype
applies only to input and output).

op type=short power=4 divide=3e8 file

3. Print out the result of log2(17/16).

echo 17 | op type=ascii -div16 -log2

4. For each input number x output exp(-0.2x)

op mult=-0.2 e-exp=on

5. Read ascii data ignoring any comment lines defined as beginning with the
string "**". Read one ascii number per line and for each number x output 149-x.

op type=ascii strip="**" neg=on add=149  file

.SH "SEE ALSO"

options merge
.SH COPYRIGHT
.LP
Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
.LP
Permission to use, copy, modify, and distribute this software without fee 
is hereby granted for research purposes, provided that this copyright 
notice appears in all copies and in all supporting documentation, and that 
the software is not redistributed for any fee (except for a nominal 
shipping charge). Anyone wanting to incorporate all or part of this 
software in a commercial product must obtain a license from the Medical 
Research Council.
.LP
The MRC makes no representations about the suitability of this 
software for any purpose.  It is provided "as is" without express or 
implied warranty.
.LP
THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 
THE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES 
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 
SOFTWARE.