DOCUMENTATION

SYNOPSIS

PERL PROGRAM NAME:  SUAMP - output amp, phase, real or imag trace from			
AUTHOR: Juan Lorenzo (Perl module only)
DATE:   
DESCRIPTION:
Version: 

USE

NOTES

Examples

SEISMIC UNIX NOTES

 SUAMP - output amp, phase, real or imag trace from			
 	(frequency, x) domain data					

 suamp <stdin >stdout mode=amp						

 Required parameters:							
 none									
 Optional parameter:							
 mode=amp	output flag		 				
 		=amp	output amplitude traces				
 		=logamp	output log(amplitude) traces			
 			=phase	output phase traces			
 			=ouphase output unwrapped phase traces (oppenheim)
 			=suphase output unwrapped phase traces (simple)	
 			=real	output real parts			
 	     	=imag	output imag parts	 			
 jack=0	=1  divide value at zero frequency by 2   		
		(operative only for mode=amp)				

 .... phase unwrapping options	..... 					
 unwrap=1	 |dphase| > pi/unwrap constitutes a phase wrapping	
			(operative only for mode=suphase)		
 trend=1	remove linear trend from the unwrapped phase		
 zeromean=0	assume phase(0)=0.0, else assume phase is zero mean	
 smooth=0	apply damped least squares smoothing to unwrapped phase 
 r=10.0	    ... damping coefficient, only active when smooth=1	

 Notes:								
 	The trace returned is half length from 0 to Nyquist. 		

 Example:								
 	sufft <data | suamp >amp_traces					
 Example: 								
	sufft < data > complex_traces					
 	 suamp < complex_traces mode=real > real_traces			
 	 suamp < complex_traces mode=imag > imag_traces			

 Note: the inverse of the above operation is: 				
	suop2 real_traces imag_traces op=zipper > complex_traces	

 Note: Explanation of jack=1 						
 The amplitude spectrum is the modulus of the complex output of	
 the fft. f(0) is thus the average over the range of integration	
 of the transform. For causal functions, or equivalently, half		
 transforms, f(0) is 1/2 of the average over the full range.		
 Most oscillatory functions encountered in wave applications are	
 zero mean, so this is usually not an issue.				

 Note: Phase unwrapping: 						

 The mode=ouphase uses the phase unwrapping method of Oppenheim and	
 Schaffer, 1975. 							
 The mode=suphase generates unwrapped phase assuming that jumps	
 in phase larger than pi/unwrap constitute a phase wrapping.		

 Credits:
	CWP: Shuki Ronen, Jack K. Cohen c.1986

 Notes:
	If efficiency becomes important consider inverting main loop
      and repeating extraction code within the branches of the switch.

 Trace header fields accessed: ns, trid
 Trace header fields modified: ns, trid

CHANGES and their DATES

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 jack

sub mode

sub r

sub smooth

sub trend

sub unwrap

sub zeromean

sub get_max_index

max index = number of input variables -1