#! /bin/sh
# Purpose: Same as XDip1, but using "physical" dt and dx
WIDTH=420
HEIGHT=400
WIDTHOFF1=0
WIDTHOFF2=430
WIDTHOFF3=860
HEIGHTOFF1=50
HEIGHTOFF2=500

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 use the nominal physical units in sudipfilt which
# are dt=4ms and dx=d2=0.016km=16m.  Thus the slopes of the three
# reflectors are {0,1,2}*0.004/0.016={0,1/4,1/2}

# First make the synthetic data for the dip filtering demo.
# Assume that trace spacing is measured in km.
dx=0.016

suplane | sushw key=d2 a=$dx >suplane.data

# Plot the model 
suxwigb <suplane.data title="Data: 3 sloping reflectors--Use dt=.004 dx=$dx" \
	windowtitle="Data" \
	label1="Time (sec)" label2="Distance (km)" \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF1 ybox=$HEIGHTOFF1 &
 
# Zap the flat reflector
slopes=-0.125,-0.0625,0.0625,0.125
bias=0.0
sudipfilt <suplane.data\
	 slopes=$slopes amps=$amps bias=$bias |
suxwigb title="slope=$slopes amps=$amps bias=$bias" \
	windowtitle="zap flat" \
	label1="Time (sec)" label2="Distance (km)" \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF2 ybox=$HEIGHTOFF1 &

# Zap the middle reflector
slopes=0.0625,0.135,0.3125,0.375
bias=0.0
sudipfilt <suplane.data\
	 slopes=$slopes amps=$amps bias=$bias |
suxwigb title="slope=$slopes amps=$amps bias=$bias" \
	windowtitle="zap middle" \
	label1="Time (sec)" label2="Distance (km)" \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF3 ybox=$HEIGHTOFF1 &

# Zap the steep reflector
slopes=0.3125,0.375,0.5625,0.635
bias=0.0
sudipfilt <suplane.data\
	 slopes=$slopes amps=$amps bias=$bias |
suxwigb title="slope=$slopes amps=$amps bias=$bias" \
	windowtitle="try steep" \
	label1="Time (sec)" label2="Distance (km)" \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF1 ybox=$HEIGHTOFF2 &

# 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 |
suxwigb title="F-K Spectrum of Data" \
	windowtitle="F-K" \
	label1="Frequency" label2="K"\
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF2 ybox=$HEIGHTOFF2 &

# Try again, biasing actual slope 2 to slope 0
slopes=0.3125,0.375,0.5625,0.635
bias=0.5
sudipfilt <suplane.data\
	 slopes=$slopes amps=$amps bias=$bias |
suxwigb title="slope=$slopes amps=$amps bias=$bias" \
	windowtitle="zap steep" \
	label1="Time (sec)" label2="Distance (km)" \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF3 ybox=$HEIGHTOFF2 &

exit 0
