#! /bin/sh
# Purpose: Successively kill each of the reflectors in the standard
#	suplane "test pattern".  See README for details.
demo=dip1

amps=1,0,0,1	# In this demo, we try to kill a reflector of given slope

###MODEL###
# We make some simple data with suplane.  Note that in units of
# trace/timesample the default slopes in suplane are 0, 1, 2, so
# that the middle reflector is spatially just at Nyquist and the
# the steepest reflector is spatially aliased.
#
# In this demo, we "fool the program" (see the sudipfilt self-doc)
# by using nominal units in sudipfilt.  The data is created with
# "physical" parameters of dt=4ms and (nominally) dx=d2=0.016km=16m:
dt=1
dx=1

# First make the synthetic data for the dip filtering demo.
# Assume that trace spacing is measured in km.
suplane | sushw key=d2 a=0.016 >suplane.data

# Plot the model 
supswigp <suplane.data title="Data: 3 sloping reflectors--Use dt=dx=1" \
	label1="Samples" label2="Trace" f1=1 d1=1 f2=1 d2=1 >${demo}.1.eps
 
# Zap the flat reflector
slopes=-1.0,-0.5,0.5,1.0
bias=0.0
sudipfilt <suplane.data dt=$dt dx=$dx \
	 slopes=$slopes amps=$amps bias=$bias |
supswigp title="slope=$slopes amps=$amps bias=$bias" \
	label1="Samples" label2="Trace" f1=1 d1=1 f2=1 d2=1 >${demo}.2.eps

# Zap the middle reflector
slopes=0.5,0.75,1.25,1.5
bias=0.0
sudipfilt <suplane.data dt=$dt dx=$dx \
	 slopes=$slopes amps=$amps bias=$bias |
supswigp title="slope=$slopes amps=$amps bias=$bias" \
	label1="Samples" label2="Trace" f1=1 d1=1 f2=1 d2=1 >${demo}.3.eps

# Zap the steep reflector
slopes=1.5,1.75,2.25,2.5
bias=0.0
sudipfilt <suplane.data dt=$dt dx=$dx \
	 slopes=$slopes amps=$amps bias=$bias |
supswigp title="slope=$slopes amps=$amps bias=$bias" \
	label1="Samples" label2="Trace" f1=1 d1=1 f2=1 d2=1 >${demo}.4.eps

# Failed because steep reflector is spatially aliased.  Here the
# bias parameter can help (see the sudipfilt self-doc).  Look at
# the F-K spectrum:
suspecfk <suplane.data |
supswigp title="F-K Spectrum of Data" \
	label1="Frequency" label2="K" >${demo}.5.eps

# Try again, biasing actual slope 2 to slope 0
slopes=1.5,1.75,2.25,2.5
bias=2.0
sudipfilt <suplane.data dt=$dt dx=$dx \
	 slopes=$slopes amps=$amps bias=$bias |
supswigp title="slope=$slopes amps=$amps bias=$bias" \
	label1="Samples" label2="Trace" f1=1 d1=1 f2=1 d2=1 >${demo}.6.eps
 
echo 
echo "Output PostScript files:"

echo -n "     "
for i in ${demo}.*.eps
do
	 echo -n "$i "
done
echo
echo "You may view these with your PostScript Previewer"

exit 0
