SYNOPSIS
PERL PROGRAM NAME:
AUTHOR: Juan Lorenzo (Perl module only)
DATE:
DESCRIPTION:
Version:
USE
NOTES
Examples
SYNOPSIS
SEISMIC UNIX NOTES FARITH - File ARITHmetic -- perform simple arithmetic with binary files
farith <infile >outfile [optional parameters]
Optional Parameters:
in=stdin input file
out=stdout output file
in2= second input file (required for binary operations)
if it can't be opened as a file, it might be a scalar
n=size_of_in, fastest dimension (used only for op=cartprod is set)
isig= index at which signum function acts (used only for
op=signum)
scale= value to scale in by, used only for op=scale)
bias= value to bias in by, used only for op=bias)
op=noop noop for out = in
neg for out = -in
abs for out = abs(in)
scale for out = in *scale
bias for out = in + bias
exp for out = exp(in)
sin for out = sin(in)
cos for out = cos(in)
log for out = log(in)
sqrt for out = (signed) sqrt(in)
sqr for out = in*in
degrad for out = in*PI/180
raddeg for out = in*180/PI
pinv for out = (punctuated) 1 / in
pinvsqr for out = (punctuated) 1 /in*in
pinvsqrt for out = (punctuated signed) 1 /sqrt(in)
add for out = in + in2
sub for out = in - in2
mul for out = in * in2
div for out = in / in2
cartprod for out = in x in2
requires: n=size_of_in, fastest dimension in output
signum for out[i] = in[i] for i< isig and
= -in[i] for i>= isig
requires: isig=point where signum function acts
Seismic operations:
slowp for out = 1/in - 1/in2 Slowness perturbation
slothp for out = 1/in^2 - 1/in2^2 Sloth perturbation
Notes:
op=sqrt takes sqrt(x) for x>=0 and -sqrt(ABS(x)) for x<0 (signed sqrt)
op=pinv takes y=1/x for x!=0, if x=0 then y=0. (punctuated inverse)
The seismic operations assume that in and in2 are wavespeed profiles.
"Slowness" is 1/wavespeed and "sloth" is 1/wavespeed^2.
Use "suop" and "suop2" to perform unary and binary operations on
data in the SU (SEGY trace) format.
The options "pinvsq" and "pinvsqrt" are also useful for seismic
computations involving converting velocity to sloth and vice versa.
The option "cartprod" (cartesian product) requires also that the
parameter n=size_of_in be set. This will be the fastest dimension
of the rectangular array that is output.
The option "signum" causes a flip in sign for all values with index
greater than "isig" (really -1*signum(index)).
For file operations on SU format files, please use: suop, suop2
Author: Dave Hale, Colorado School of Mines, 07/07/89
Zhaobo Meng added scale and cartprod, 10/01/96
Zhaobo Meng added signum, 9 May 1997
Tony Kocurko added scalar operations, August 1997
John Stockwell added bias option 4 August 2004
User's notes (Juan Lorenzo) untested
CHANGES and their DATES
Import packages
instantiation of packages
Encapsulated hash of private variables
sub Step
collects switches and assembles bash instructions by adding the program name
sub note
collects switches and assembles bash instructions by adding the program name
sub clear
sub bias
sub in
sub in2
sub isig
sub n
sub op
sub out
sub scale
sub get_max_index
max index = number of input variables -1