Program sftahpef | Trace And Header Prediction Error Filtering 
[SYNOPSIS]
sftahpef < inp.rsf > out.rsf wiener=wien.rsf mix= verbose=1 minlag= maxlag= pnoise=0.001 nmix=1 mincorr= maxcorr=
[COMMENTS]

tah is the abbreviation of Trace And Header.  Madagascar programs 
that begin with sftah are a designed to:
1- read trace and headers from separate rsf files and write them to 
standard output (ie sftahread)
2- filter programs that read and write standard input/output and 
process the tah data (eg sftahnmo, sftahstack)
3- read tah data from standard input and write separate rsf files for 
the trace and headers data (ie sftahwrite)

These programs allow Seismic Unix (su) like processing in Madagascar.  
Some programs have su like names.

Some programs in this suite are sftahread, sftahgethw, ftahhdrmath, 
and sftahwrite.

The sftahpef applies prediction error filtering (often called decon)

EXAMPLE:

sftahsort                                                            //
verbose=0 input=npr3_field.rsf sort='fldr:214,254,10 tracf'          //
| sftahwindow ns=2047                                                //
| sftahgain   tpow=2                                                 //
| sftahmute  tmute=-.200,-.050,.200,3.00  xmute=0,880,1760,18000     //
ntaper=80                                                            //
| sftahpef                                                           //
verbose=1 minlag=.002 maxlag=.1  pnoise=.01 mincorr=0 maxcorr=3      //
| sftahagc  wagc=1.000 verbose=1                                     //
| sftahwrite verbose=1 mode=seq  output=pefshots.rsf                 //
>/dev/null

sfgrey <pefshots.rsf | sfpen

In this example unprocessed field traces are read by sftahsort from 
the npr3_field.rsf file.  sftahsort was used select just a 5 shotpoints 
(fldr 214 to 254 incrementing by 10) from a large dataset.  The headers
are in the file npr3_filed_hdr.rsf, the headers parameter default.  
The headers are merged with the trace amplitudes and the tah data sent 
down the pipe for further processing.

sftahwindow selects the first 2047 trace amplitudes.  The last two 
samples on this data were bad, and are elliminated from further
processing.

sftahgain multiplies the traces by time squared (t**2).  This 
approximately compensates for spreading loss that makes amplitude at
large time smaller than amplitude at small time.

sftahmute is applied to elliminate the data at small time/offset.  

sftahpef applies prediction error filtering (or decon).  A prediction 
gap or .002 seconds, or one sample) makes this decon "spiking" decon.
A three seconds window si selected to compute the autocorrelation and 
a .1 second filter is computed and applied.

After decon a 1 second agc was applies using the sftahagc.

Data is written to the output file, pefshots.rsf, using sftahwrite.  
Traces headers are written to pefshots_hdr.rsf.  The output file data 
order is sequential, or just in the order sftahwrite reads them from 
standard input.



[PARAMETERS]
float   | maxcorr | = |   | 	end of autocorrelation window in sec 
float   | maxlag | = |   | 	last lag of prediction filter (sec) 
float   | mincorr | = |   | 	start of autocorrelation window in sec 
float   | minlag | = |   | 	first lag of prediction filter (sec) 
floats  | mix | = |   | 	weights for moving average of the autocorrelations  [nmix]
int     | nmix | =1 |   | 	number of weights (floats) for moving averages 
float   | pnoise | =0.001 |   | 	relative additive noise level 
int     | verbose | =1 |   | 	

       flag to control amount of print
       0 terse, 1 informative, 2 chatty, 3 debug
    
string  | wiener | = |   | 	file to output Wiener filter (auxiliary output file name)
[DIRECTORY]
user/karl
