annotate 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
rev   line source
tomwalters@0 1 .TH OP 1 "14 September 1993"
tomwalters@0 2
tomwalters@0 3 .SH NAME
tomwalters@0 4 op \- Ordered sequence of operations on input stream.
tomwalters@0 5
tomwalters@0 6 .SH SYNTAX
tomwalters@0 7 op [options] [file]
tomwalters@0 8
tomwalters@0 9 .SH DESCRIPTION
tomwalters@0 10
tomwalters@0 11 A sequence of operations is done on each item in the input stream.
tomwalters@0 12 The operations are done in the order they appear on the
tomwalters@0 13 command line. Operations can be repeated as many times as needed on the
tomwalters@0 14 command line.
tomwalters@0 15
tomwalters@0 16 Input items may be binary numbers (short or float) or ascii lines
tomwalters@0 17 (terminated by CR) according to the type option.
tomwalters@0 18
tomwalters@0 19 .SH OPTIONS
tomwalters@0 20
tomwalters@0 21 1. Operations.
tomwalters@0 22
tomwalters@0 23 The list of operations is as follows. Some operations take valued
tomwalters@0 24 arguments (which are real numbers), others are flags, as indicated:
tomwalters@0 25
tomwalters@0 26 .nf
tomwalters@0 27 operation result for each input item x
tomwalters@0 28
tomwalters@0 29 add=<value> x+<value>
tomwalters@0 30 negate=on -x
tomwalters@0 31 multiply=<value> x*<value>
tomwalters@0 32 divide=<value> x/<value>
tomwalters@0 33 remainder=<value> real remainder of x/<value>
tomwalters@0 34 inverse=on 1/x
tomwalters@0 35 round=on x rounded to nearest integer
tomwalters@0 36 absolute=on |x|
tomwalters@0 37 power=<value> x^<value>
tomwalters@0 38 exponent=<value> <value>^x
tomwalters@0 39 e-exponent=on e^x
tomwalters@0 40 log=<value> log(x) to base <value>
tomwalters@0 41 e-log=on log(x) to base e.
tomwalters@0 42 sin=on sin(x)
tomwalters@0 43 cos=on cos(x)
tomwalters@0 44 tan=on tan(x)
tomwalters@0 45 threshold=<value> if ( x <value> ) 0 else if ( x = <value> ) 1
tomwalters@0 46 diff1=on first difference
tomwalters@0 47 diff2=on second difference
tomwalters@0 48 diff3=on third difference
tomwalters@0 49 cusum=on cumulative sum
tomwalters@0 50 cumean=on cumulative (recursive) mean an
tomwalters@0 51 cumin=on cumulative min
tomwalters@0 52 cumax=on cumulative max
tomwalters@0 53 .fi
tomwalters@0 54
tomwalters@0 55
tomwalters@0 56 2. type.
tomwalters@0 57
tomwalters@0 58 The `type' option sets the data type for all input and output items.
tomwalters@0 59 Recognised data types are: short, float, ascii.
tomwalters@0 60
tomwalters@0 61 Ascii data is read in line-by-line, and comment lines are allowed.
tomwalters@0 62 The following operation apply only to ascii input items, enabling
tomwalters@0 63 comment lines to be stripped or echoed directly to the output.
tomwalters@0 64
tomwalters@0 65 .nf
tomwalters@0 66 strip=<value> ignore lines beginning with <value> string
tomwalters@0 67 echo=<value> echo lines beginning with <value> string
tomwalters@0 68 number=on number output lines
tomwalters@0 69 .fi
tomwalters@0 70
tomwalters@0 71 If number=on then stripped lines are not numbered; they simply dissappear.
tomwalters@0 72 If there are no operations, (other than comment stripping/echoing or line
tomwalters@0 73 numbering), then ascii lines are echoed.
tomwalters@0 74
tomwalters@0 75
tomwalters@0 76 .SH EXAMPLES
tomwalters@0 77
tomwalters@0 78 1. Specify the following ordered sequence of operations on each binary
tomwalters@0 79 float in the input stream: invert (take reciprocal), scale up by 100,
tomwalters@0 80 square (raise to power 2), invert (take reciprocal), square root (raise to
tomwalters@0 81 power 0.5).
tomwalters@0 82
tomwalters@0 83 op type=float inverse=on multiply=100 power=2 inverse=on power=.5 file
tomwalters@0 84
tomwalters@0 85 2. Increase dynamic range by powering up and scaling down.
tomwalters@0 86 (Note that internal calculating is done in floating point; the short datatype
tomwalters@0 87 applies only to input and output).
tomwalters@0 88
tomwalters@0 89 op type=short power=4 divide=3e8 file
tomwalters@0 90
tomwalters@0 91 3. Print out the result of log2(17/16).
tomwalters@0 92
tomwalters@0 93 echo 17 | op type=ascii -div16 -log2
tomwalters@0 94
tomwalters@0 95 4. For each input number x output exp(-0.2x)
tomwalters@0 96
tomwalters@0 97 op mult=-0.2 e-exp=on
tomwalters@0 98
tomwalters@0 99 5. Read ascii data ignoring any comment lines defined as beginning with the
tomwalters@0 100 string "**". Read one ascii number per line and for each number x output 149-x.
tomwalters@0 101
tomwalters@0 102 op type=ascii strip="**" neg=on add=149 file
tomwalters@0 103
tomwalters@0 104 .SH "SEE ALSO"
tomwalters@0 105
tomwalters@0 106 options merge
tomwalters@0 107 .SH COPYRIGHT
tomwalters@0 108 .LP
tomwalters@0 109 Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
tomwalters@0 110 .LP
tomwalters@0 111 Permission to use, copy, modify, and distribute this software without fee
tomwalters@0 112 is hereby granted for research purposes, provided that this copyright
tomwalters@0 113 notice appears in all copies and in all supporting documentation, and that
tomwalters@0 114 the software is not redistributed for any fee (except for a nominal
tomwalters@0 115 shipping charge). Anyone wanting to incorporate all or part of this
tomwalters@0 116 software in a commercial product must obtain a license from the Medical
tomwalters@0 117 Research Council.
tomwalters@0 118 .LP
tomwalters@0 119 The MRC makes no representations about the suitability of this
tomwalters@0 120 software for any purpose. It is provided "as is" without express or
tomwalters@0 121 implied warranty.
tomwalters@0 122 .LP
tomwalters@0 123 THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
tomwalters@0 124 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
tomwalters@0 125 THE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
tomwalters@0 126 OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
tomwalters@0 127 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
tomwalters@0 128 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
tomwalters@0 129 SOFTWARE.
tomwalters@0 130