#MAKE_DEPEND=yes
SEPINC=/usr/local/share/make/
include ${SEPINC}/SEP.top
#include ./Src/ProgMakefile
include ../Ill_ADCIG/flat/FigFlatMakefile

BIN=./Bin
PAR=./Par
#FIG=./Fig
RESDIR=./Fig
Fig=./Fig
DATA=./Data
SRC=./Src

LATOPTS  = style=html
#LATOPTS = option=web 'style=jfc,makeidx,html,amsmath'
SIGDIR = /mnt/sepdata/1a/sigsbee_multiple
OLEVEL=2
#UF90FLAGS =-mp -check bounds
UF90FLAGS =-parallel -openmp -openmp_report2  -O3 -axW -vec_report3
MAINLIBS=-lsep2df90 -lsep3df90 -lsep3d -lsepf90 -lsep -L${LIBDIR}  -lsepgeef90
UF90LIBS=${MPILIBS} ${MAINLIBS} -lsepparf90 -lseppar_mpi -lsepgeef90 -lsep2df90 -static-libcxa -lguide#-Bstatic
UF77LIBS = ${BEILIB}

RESULTSER = Ang2O_class3 \
	AVO_class3 \
	AVO_class4 \
	O2A_class3_0 \
	O2A_class3_1 \
	O2A_class3_2 \
	O2A_class3_FT \
	O2A_class4_0 \
	O2A_class4_1 \
	O2A_class4_2 \
	O2A_class4_FT \
	OFF_class3 \
	OFF_class4 \
	ampt_inv1001 \
	ampb_inv1001 \
	ampt_tr1001 \
	ampb_tr1001 \
	ampt_ft1001 \
	ampb_ft1001 \
	adcig_inv1001 \
	adcig_tr1001 \
	adcig_ft1001 \
	test1 \
	test2 \
	test3 \
	test4 \
	test5 \
	test6 \
	test7 \

COLOR=yes
########################################
#
# Senoid Vel.model
#
Sinvel.H:
	./Bin/velsin2.x > $@

SinShot.H:
	Fdmod intag=Sinvel.H no_stdout=1 oxs=0 dxs=20 nxs=1000 tmax=2. bx=0 ex=300 hsfile=temp.H
	Bandpass flo=5 fhi=42 < temp.H | Mute vmute=6000 tmute=0.7 tramp=0.05 >> $@

SinShot2.H:
	Fdmod intag=Sinvel.H no_stdout=1 oxs=5000 dxs=20 nxs=1 tmax=4. bx=400 ex=400 hsfile=temp.H
	Bandpass flo=5 fhi=42 < temp.H | Mute vmute=6000 tmute=0.7 tramp=0.05 >> $@

Sinvelmig.H:
	Window3d <Sinvel.H n1=300 | Pad beg2=200 end2=200 extend=1 > j1.H
	Transp reshape=1,3 plane=12 < j1.H > $@

Sinprep.H:SinShot.H
	Window < SinShot.H j1=5 > j1.H
	< j1.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=3 f_min1=6 f_max1=36 f_max=42 maxsize=1000 > j2.H
	< j2.H Transp reshape=1,3,5 plane=23 | Pad beg1=100 end1=100 > $@

Sinsource.H:
	Window n3=1 min3=0 n2=1 min2=0 max1=0.9733 < SinShot.H | Window j1=5 | Pad end1=233 > j1.H; echo o1=-0.85 >>j1.H
	< j1.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=3 f_min1=6 f_max1=36 f_max=42 maxsize=1000 > j2.H 
	< j2.H Transp reshape=1,3,5 plane=23 > $@

SinMig01.H: Sinprep.H
	@date
	nohup Parallel command=/net/koko/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX/ShotMig files="Sinprep.H,Sinsource.H,Sinvelmig.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=1000 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=1000 ox_shots=0 \
	par=Singo_sis.P taper=y taper_pcent=2 marine=y minx=-6000 maxx=16000 & #restart=y

SinMigtst.H:
	@date
#	Window3d squeeze=n <Sinprep.H n4=1 min4=0 >j1.H
	/net/koko/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX86_64/ShotMig D=j1.H D_d=Sinsource.H V=Sinvelmig.H R=$@  \
	pverb=2  nx_shots=1 ox_shots=0 \
	par=Singo_sis.P taper=y taper_pcent=2 marine=y minx=-6000 maxx=16000 & #restart=y

SinADCIG01.H:
	< SinMig01.H Transp reshape=2,4,5 plane=13 > SinODCIG01.H
	< SinODCIG01.H Pad beg2=86 end2=87 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=60 eps=10 maxmem=1000 > $@

#!!!!!!!!!!
#!
#! Computing Greens fct to invert ODCIGs in gomorrah
#!
#!	/net/koko/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX/ShotMig.x \

SinGreen.H:
	Pad end4=801 extend=1 <Sinsource.H >SinsourceW.H
	/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX86_64/ShotMig.x \
	D_d=SinsourceW.H V=Sinvelmig.H W_d=$@ \
	nx=1000 ox=-200. dx=20. \
	nref=8 min_slow_dev=.01 taper=y taper_pcent=2 marine=n \
	nx_W=750 ox_W=0. dx_W=20.
	date

SinGreen1.H:
	Pad end4=801 extend=1 <Sinsource.H >SinsourceW.H
	/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX86_64/ShotMig.x \
	D_d=SinsourceW.H V=Sinvelmig.H W_d=$@ \
	nx=1000 ox=-200. dx=20. \
	nref=8 min_slow_dev=.01 taper=y taper_pcent=2 marine=n \
	nx_W=750 ox_W=0. dx_W=20.
	date

SinHes_ax21_az11_hx01.H:
	date
	< ppp1.H Window3d squeeze=n j6=2 max6=30 | ~valencia/research/Src_Hessian/Bin/LINUX86_64/Lt_L_old_3D_off_wave_6_omp.x outtag=$@  \
	nax=21 naz=11 nay=1 marine=y noffx=1  \
	nry=1 nrx=300 orx=0 drx=20 nsy=1 nsx=500 osx=0 dsx=20 minix=2000 nx=401 miniz=1800 nz=101

SinHes_ax21_az11_hx11.H:
	date
	< ppp1.H Window3d squeeze=n j6=2 max6=30 | ~valencia/research/Src_Hessian/Bin/LINUX86_64/Lt_L_old_3D_off_wave_6_omp.x outtag=$@  \
	nax=21 naz=11 nay=1 marine=y noffx=11 \
	nry=1 nrx=300 orx=0 drx=20 nsy=1 nsx=500 osx=0 dsx=20 minix=2000 nx=401 miniz=1800 nz=101

SinHes_ax01_az01_hx01_w25.H:
	date
	< SinGreen.H Window3d squeeze=n n3=1 min3=25 | Transp plane=34 max_memory=1000 > pp1.H
	< pp1.H Transp reshape=4,6 plane=12 max_memory=1000 > ppp1.H
	< ppp1.H ~valencia/research/Src_Hessian/Bin/LINUX86_64/Lt_L_old_3D_off_wave_6_omp.x outtag=$@  \
	nax=1 naz=1 nay=1 marine=y noffx=1  \
	nry=1 nrx=300 orx=0 drx=20 nsy=1 nsx=500 osx=0 dsx=20 minix=0 nx=601 miniz=0 nz=301

SinHes_ax01_az01_hx01_w15.H:
	date
	< SinGreen.H Window3d squeeze=n n3=1 min3=15 | Transp plane=34 max_memory=1000 > pp1.H
	< pp1.H Transp reshape=4,6 plane=12 max_memory=1000 > ppp1.H
	< ppp1.H ~valencia/research/Src_Hessian/Bin/LINUX86_64/Lt_L_old_3D_off_wave_6_omp.x outtag=$@  \
	nax=1 naz=1 nay=1 marine=y noffx=1  \
	nry=1 nrx=300 orx=0 drx=20 nsy=1 nsx=500 osx=0 dsx=20 minix=0 nx=601 miniz=0 nz=301

SinHes_ax01_az01_hx01_w05.H:
	date
#	< SinGreen.H Window3d squeeze=n n3=1 min3=5 | Transp plane=34 max_memory=1000 > pp1.H
	< pp1.H Transp reshape=4,6 plane=12 max_memory=1000 > ppp1.H
	< ppp1.H ~valencia/research/Src_Hessian/Bin/LINUX86_64/Lt_L_old_3D_off_wave_6_omp.x outtag=$@  \
	nax=1 naz=1 nay=1 marine=y noffx=1  \
	nry=1 nrx=300 orx=0 drx=20 nsy=1 nsx=500 osx=0 dsx=20 minix=0 nx=601 miniz=0 nz=301

SinInv_ax21_az11_hx11.H:
#inv_bpgom_az21ax21.H:
	< SinHes_ax21_az11_hx11.H Transp reshape=3,6,10 > pp1.H
	< pp1.H Transp reshape=2,3,5,6,10 plane=24 > pp2.H
	< pp2.H Transp reshape=7,9,10 plane=23 > pp22.H
	< mig_bpgom_under.H Window3d min1=58234.2 n1=151 min5=7980 n5=401 | Transp | Interp o2out=58234.2 d2out=82.02 > mig_bpgom_under_interp.H
	< mig_bpgom_under_interp.H Window3d n2=300| Pad n1=402 | Transp reshape=2,4| Scale scale_to=1. > pp3.H
	< LtL_bpgom_az21_ax21_wave_f10_marine_t_full.H /net/koko/homes/sep/alejandro/research/NoStaDecon/Bin/LINUX86_64/Sparse_Mxv_inv_off_fly.x mig=pp3.H  niter=5 eps=0. alpha=.001 na=4 initial=0 reg_damp=1 resw=resweigh.H  remov=rmovs1.H mmov=mmovs1.H wmov=wmov.H>$@

	< SinHes_ax21_az11_hx11.H /net/koko/homes/sep/alejandro/research/NoStaDecon_save/Bin/LINUX86_64/Sparse_Mxv_inv_oldsolver_prec_ang2off.x \
	mig=pp3.H niter=5 eps=0. alpha=.001 na=4 initial=0 reg_damp=1 \
	remov=rmovs1.H mmov=mmovs1.H wmov=wmov.H > $@
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
#
#
diagonal01:
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=0  n3=1 f3=0  >  n0.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=1  n3=1 f3=1  >  n1.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=2  n3=1 f3=2  >  n2.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=3  n3=1 f3=3  >  n3.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=4  n3=1 f3=4  >  n4.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=5  n3=1 f3=5  >  n5.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=6  n3=1 f3=6  >  n6.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=7  n3=1 f3=7  >  n7.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=8  n3=1 f3=8  >  n8.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=9  n3=1 f3=9  >  n9.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=10 n3=1 f3=10 > n10.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=11 n3=1 f3=9 > n11.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=12 n3=1 f3=8 > n12.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=13 n3=1 f3=7 > n13.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=14 n3=1 f3=6 > n14.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=15 n3=1 f3=5 > n15.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=16 n3=1 f3=4 > n16.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=17 n3=1 f3=3 > n17.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=18 n3=1 f3=2 > n18.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=19 n3=1 f3=1 > n19.H
	Window3d <SinHes_ax21_az11_hx01.H n1=1 f1=20 n3=1 f3=0 > n20.H
	Cat3d n0.H  n1.H  n2.H  n3.H  n4.H  n5.H  n6.H  n7.H  n8.H  n9.H \
	n10.H n11.H n12.H n13.H n14.H n15.H n16.H n17.H n18.H n19.H n20.H axis=3 > junk1.H
	echo o3=-1125. >> junk1.H
	Transp reshape=1,3,5 plane=12 <junk1.H |Pad beg2=1 end2=1 extend=1 >LtL_Sis_az1_ax1_wave_marine_old_off_diag02.H
	Window n1=382 < LtL_Sis_az1_ax1_wave_marine_old_off_diag02.H > 002-DIAGOFF02.H
	Math file1=001-ODCIG.H file2=002-DIAGOFF02.H exp="file1*file2" > funk1.H
	Transp plane=34 < funk1.H | Pad beg2=43 end2=44 end1=100 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=30 maxmem=1000 >j1.H
	; <j1.H Window max1=16000 > junk1.H
	Transp plane=34 < 001-ODCIG.H | Pad beg2=43 end2=44 end1=100 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=30 maxmem=1000 >
	j2.H ; <j2.H Window max1=16000 > junk2.H
	Math file1=junk1.H file2=junk2.H exp="file1*file2/(file2*file2+0.005)" > junk3.H
	Transp plane=23 < junk3.H | Median wind1=31 wind2=11 | Transp plane=23 > 004-DIAGANG02.H
	Rm j*H
	Rm n*.H junk1.H

diagonal03:
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=0 n6=1 f4=3 > n0.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=1 n6=1 f4=4 > n1.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=2 n6=1 f4=5 > n2.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=3 n6=1 f4=6 > n3.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=4 n6=1 f4=7 > n4.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=5 n6=1 f4=8 > n5.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=6 n6=1 f4=9 > n6.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=7 n6=1 f4=10 > n7.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=8 n6=1 f4=11 > n8.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=9 n6=1 f4=12 > n9.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=10 n6=1 f4=13 > n10.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=11 n6=1 f4=14 > n11.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=12 n6=1 f4=15 > n12.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=13 n6=1 f4=16 > n13.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=14 n6=1 f4=17 > n14.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=15 n6=1 f4=18 > n15.H
	Window3d <SinHes_ax21_az11_hx01.H n4=1 f6=16 n6=1 f4=19 > n16.H



########################################
#
# Synthetic shots
#
ac_ref1.H:
	${BIN}/refcoef1.x > $@


###########################
#       Migration         #
###########################

Velinc4.H:
	Vel n1=1351 n2=3601 d1=10 d2=10 o1=0 o2=-10000 n3=1 d3=1 o3=1 vc=5000 xa1=-10000 alfa1=30 z1=0 vr1=3500 const1=1 > $@

Velinc4mig.H: Velinc4.H
	Transp reshape=1,3 plane=12 < Velinc4.H > $@

Velinclow.H:
	Vel n1=1351 n2=3601 d1=10 d2=10 o1=0 o2=-10000 n3=1 d3=1 o3=1 vc=4500 xa1=-10000 alfa1=30 z1=0 vr1=3150 const1=1 > $@

Velinclowmig.H: Velinclow.H
	Transp reshape=1,3 plane=12 < Velinclow.H > $@

Velinchi.H:
	Vel n1=1351 n2=3601 d1=10 d2=10 o1=0 o2=-10000 n3=1 d3=1 o3=1 vc=5500 xa1=-10000 alfa1=30 z1=0 vr1=3850 const1=1 > $@

Velinchimig.H: Velinchi.H
	Transp reshape=1,3 plane=12 < Velinchi.H > $@

Shotinc4.H: Velinc4mig.H
	Fdmod intag=Velinc4.H no_stdout=1 oxs=0 dxs=10 nxs=701 tmax=4 bx=800 ex=0 hsfile=Shotemp4.H 
	Bandpass flo=8 fhi=42 < Shotemp4.H | Mute vmute=5000 tmute=0.7 tramp=0. > Shotemp41.H
#	Window3d squeeze=n j1=4 < Shotemp41.H > $@

Shotincpush4.H: Velinc4mig.H
	Fdmod intag=Velinc4.H no_stdout=1 oxs=0 dxs=10 nxs=701 tmax=4 ex=800 bx=0 hsfile=Shotemp4.H 
	Bandpass flo=8 fhi=42 < Shotemp4.H | Mute vmute=5000 tmute=0.9 tramp=0. > Shotemp41.H
	Window3d squeeze=n j1=4 < Shotemp41.H > $@

source_inc.H:
	Window3d squeeze=n < Shotinc4.H n2=1 min2=-1000 j1=2 max1=1 n3=1 min3=2000 | Bandpass flo=8 fhi=42 | Pad end1=736 > j.H ; echo o1=-0.2 >> j.H
	< j.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=6 f_min1=8 f_max1=32 f_max=38 maxsize=1000 > j1.H
	< j1.H Transp reshape=1,3,5 plane=23 > $@;echo o3=5.83164 d3=0.25355 >> $@

prep4.H:
	<Shotinc4.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=6 f_min1=8 f_max1=32 f_max=38 maxsize=1000 > j1.H
	< j1.H Transp reshape=1,3,5 plane=23 | Pad beg1=400 end1=100 >$@

#############################################
Velinc5_25.H:
	Vel n1=1351 n2=1001 d1=10 d2=25 o1=0 o2=-10000 n3=1 d3=1 o3=1 vc=5000 xa1=-10000 alfa1=30 z1=0 vr1=3500 const1=1 > $@

Velincmig5_25.H: 
	Transp reshape=1,3 plane=12 < Velinc5_25.H > $@

Shotinc5_25.H: 
	Fdmod intag=Velinc5_25.H no_stdout=1 oxs=-1000 dxs=25 nxs=401 tmax=5 bx=240 ex=0 hsfile=Shotemp5.H 
	Bandpass flo=8 fhi=42 < Shotemp5.H | Mute vmute=5000 tmute=0.7 tramp=0. > $@
#	Window3d squeeze=n j1=4 < Shotemp41.H > $@

source5_inc.H:
	Window3d squeeze=n < Shotemp5.H n3=1 min3=2000 n2=1 min2=-2500 max1=1 | Bandpass flo=8 fhi=42 | Window j1=4 | Pad n1out=1236 > jj.H ; echo o1=-0.508 >> jj.H
	< jj.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=6 f_min1=8 f_max1=32 f_max=38 maxsize=1000 > j1.H
	< j1.H Transp reshape=1,3,5 plane=23 > $@ # ;echo o3=5.83164 d3=0.25355 >> $@

prep5.H:
	<Shotinc5_25.H Window3d squeeze=n j1=4 > j.H; <j.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=6 f_min1=8 f_max1=32 f_max=38 maxsize=1000 > j1.H
	< j1.H Transp reshape=1,3,5 plane=23 | Pad beg1=200 end1=50 >$@

Mig5_inc.H: prep5.H
	Pad < Velincmig5_25.H beg1=200 extend=1 >jvel5_pad.H
	@date
	nohup Parallel command=./ShotMigNew files="prep5.H,source5_inc.H,jvel5_pad.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=401 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=401 ox_shots=-1000 \
	par=go_sis_inc.P taper=y taper_pcent=2 marine=y minx=-12500 maxx=10000 #restart=y

ADCIG5_inc.H:
	< Mig5_inc.H Window3d squeeze=n min1=-4000 max1=4000 | Transp reshape=2,4,5 plane=13 |Pad end1=100 beg2=43 end2=44 > j1.H
	< j1.H /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=60 eps=1 maxmem=1000 > $@

###############################################

#############################################
Velinc2_25.H:
	Vel n1=1351 n2=1001 d1=10 d2=25 o1=0 o2=-10000 n3=1 d3=1 o3=1 vc=3000 xa1=-10000 alfa1=20 z1=0 vr1=2800 const1=1 > $@

Velincmig2_25.H:Velinc2_25.H 
	Transp reshape=1,3 plane=12 < Velinc2_25.H > $@

Shotinc2_25.H:Velincmig2_25.H 
	Fdmod intag=Velinc2_25.H no_stdout=1 oxs=-1000 dxs=25 nxs=601 tmax=8 bx=320 ex=0 hsfile=Shotemp2.H 
	 Window3d max1=5.5 j1=4 < Shotemp2.H | Bandpass flo=8 fhi=34 | Mute vmute=3400 tmute=1.5 tramp=0. > $@

source2_inc.H:
	Window3d squeeze=n < Shotemp2.H n3=1 min3=2000 n2=1 min2=-1500 max1=1 | Bandpass flo=8 fhi=34 | Window j1=4 | Pad end1=675 > jj.H ; echo o1=-0.509 >> jj.H 
	< jj.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=6 f_min1=8 f_max1=32 f_max=38 maxsize=1000 > j2.H
	< j2.H Transp reshape=1,3,5 plane=23 > $@; echo o3=5.81702 d3=0.181782 >> $@ 

prep2.H:
	<Shotinc2_25.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=6 f_min1=8 f_max1=32 f_max=38 maxsize=1000 > j1.H
	< j1.H Transp reshape=1,3,5 plane=23 | Pad beg1=200 end1=50 >$@

Mig2_inc.H: prep2.H
	Pad < Velincmig2_25.H beg1=200 end1=200 extend=1 >jvel2_pad.H
	@date
	nohup Parallel command=./ShotMigNew files="prep2.H,source2_inc.H,jvel2_pad.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=601 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=601 ox_shots=-1000 \
	par=go_sis_inc2.P taper=y taper_pcent=2 marine=y minx=-10000 maxx=15000 #restart=y

ADCIG2_inc.H:
	< Mig2_inc.H Window3d squeeze=n min1=-2000 max1=6000 | Transp reshape=2,4,5 plane=13 |Pad end1=100 beg2=43 end2=44 > j1.H
	< j1.H /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=60 eps=1 maxmem=1000 > $@

Velincmig2_25_lo.H: 
	Math file1=Velincmig2_25.H exp="file1*0.950" > $@

Mig2_inc_lo.H: prep2.H
	Pad < Velincmig2_25_lo.H beg1=200 end1=200 extend=1 >jvel2_lo_pad.H
	@date
	nohup Parallel command=./ShotMigNew files="prep2.H,source2_inc.H,jvel2_lo_pad.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=601 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=601 ox_shots=-1000 \
	par=go_sis_inc2.P taper=y taper_pcent=2 marine=y minx=-10000 maxx=15000 #restart=y

ADCIG2_inc_lo.H:
	< Mig2_inc_lo.H Window3d squeeze=n min1=-2000 max1=6000 | Transp reshape=2,4,5 plane=13 |Pad end1=100 beg2=43 end2=44 > j1.H
	< j1.H /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=60 eps=1 maxmem=1000 > $@


###############################################


Mig01_inclo_inic.H: prep4.H
	@date
	Window3d squeeze=n min4=2000 n4=1 <prep4.H > prepin.H
	Window3d squeeze=n max3=5000 <velow.H > vx.H
	./ShotMigNew D=prepin.H D_d=source_inc.H V=vx.H R=$@ \
	pverb=2  \
	nx_shots=1 ox_shots=2000 \
	par=go_sis_inc.P taper=n taper_pcent=2 marine=y minx=-10000 maxx=2200 & #restart=y

Mig01_inchi_inic.H: prep4.H
	@date
	Window3d squeeze=n max3=10000 <Velinchimig.H |Pad extend=1 beg1=1400 end1=1400 >velhi.H
	./ShotMigNew D=prepin.H D_d=source_inc.H V=velhi.H R=$@ \
	pverb=2  \
	nx_shots=1 ox_shots=2000 \
	par=go_sis_inc.P taper=n taper_pcent=2 marine=y minx=-10000 maxx=2200 & #restart=y

Mig01_inc_inic.H: prep4.H
	@date
	Window3d squeeze=n min4=2000 n4=1 <prep4.H | Pad end1=100 > prepin.H
	./ShotMigNew D=prepin.H D_d=source_inc.H V=vel4.H R=$@ \
	pverb=2  \
	nx_shots=1 ox_shots=0 \
	par=go_sis_inc.P taper=y taper_pcent=2 marine=y minx=-10000 maxx=9000 & #restart=y

Mig01_inc.H: prep4.H
	@date
	<prep4.H Pad end1=100 > prepin.H
	Window3d squeeze=n max3=10000 <Velinc4mig.H |Pad extend=1 beg1=1400 end1=1400 >vel4.H
	nohup Parallel command=./ShotMigNew files="prepin.H,source_inc.H,vel4.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=701 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=701 ox_shots=0 \
	par=go_sis_inc.P taper=n taper_pcent=2 marine=y minx=-15000 maxx=8000 #restart=y

Mig01_inc_tap.H: 
	@date
#	<prep4.H Pad end1=100 > prepin.H
#	Window3d squeeze=n max3=10000 <Velinc4mig.H |Pad extend=1 beg1=1400 end1=1400 >vel4.H
	nohup Parallel command=./ShotMigNew files="prepin.H,source_inc.H,vel4.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=701 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=701 ox_shots=0 \
	par=go_sis_inc.P taper=y taper_pcent=2 marine=y minx=-15000 maxx=8000 & #restart=y

Mig01_inc_lo.H: prep4.H
	@date
	Window3d squeeze=n max3=10000 <Velinclowmig.H |Pad extend=1 beg1=1400 end1=1400 >velow.H
	nohup Parallel command=./ShotMigNew files="prepin.H,source_inc.H,velow.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=701 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=701 ox_shots=0 \
	par=go_sis_inc.P taper=n taper_pcent=2 marine=y minx=-15000 maxx=8000 #restart=y

Mig01_inc_hi.H: prep4.H
	@date
	Window3d squeeze=n max3=10000 <Velinchimig.H |Pad extend=1 beg1=1400 end1=1400 >velhi.H
	nohup Parallel command=./ShotMigNew files="prepin.H,source_inc.H,velhi.H,$@" \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=701 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=701 ox_shots=0 \
	par=go_sis_inc.P taper=n taper_pcent=2 marine=y minx=-15000 maxx=8000 #restart=y

ADCIG_inc_dip.H:
	Window3d <Mig01_inc_tap.H n1=1 min1=-2000 |Transp | Pad end1=100 > j1.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=5. niter=50 mode=2 < j1.H amax=40 amin=-40 dax=0.5 > $@

ADCIG_inc_dip_sep.H:
	Window3d <Mig01_inc_tap.H n1=1 min1=-2000 squeeze=n | Pad end1=100 > j1.H
	< SinMig01.H Transp reshape=2,4,5 plane=13 > SinODCIG01.H
	< SinODCIG01.H Pad beg2=86 end2=87 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=60 eps=10 maxmem=1000 > $@
############################
#
# Test with new modeled data
#
fd_mod0.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=0 style=0 " pclip=100 > /dev/null out=fd_mod0.v 
	pstexpen fd_mod0.v fd_mod0.ps;convert fd_mod0.ps fd_mod0.jpg 

fd_mod2_i50_e5.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=50 eps=5. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=50 style=0 eps=5." pclip=100 > /dev/null out=fd_mod2_i50_e5.v 
	pstexpen fd_mod2_i50_e5.v fd_mod2_i50_e5.ps;convert fd_mod2_i50_e5.ps fd_mod2_i50_e5.jpg

fd_mod2_i100_e10.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=10. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=0 eps=10." pclip=100 > /dev/null out=fd_mod2_i100_e10.v 
	pstexpen fd_mod2_i100_e10.v fd_mod2_i100_e10.ps;convert fd_mod2_i100_e10.ps fd_mod2_i100_e10.jpg

fd_mod2_i100_e5.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=5. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=0 eps=5." pclip=100 > /dev/null out=fd_mod2_i100_e5.v 
	pstexpen fd_mod2_i100_e5.v fd_mod2_i100_e5.ps;convert fd_mod2_i100_e5.ps fd_mod2_i100_e5.jpg

fd_mod2_i100_e1.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=1. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=0 eps=1." pclip=100 > /dev/null out=fd_mod2_i100_e1.v 
	pstexpen fd_mod2_i100_e1.v fd_mod2_i100_e1.ps;convert fd_mod2_i100_e1.ps fd_mod2_i100_e1.jpg

fd_mod0_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=0 style=0 " pclip=100 > /dev/null out=fd_mod0_gap.v 
	pstexpen fd_mod0_gap.v fd_mod0_gap.ps;convert fd_mod0_gap.ps fd_mod0_gap.jpg 

fd_mod2_i50_e5_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=50 eps=5. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=50 style=0 eps=5." pclip=100 > /dev/null out=fd_mod2_i50_e5_gap.v 
	pstexpen fd_mod2_i50_e5_gap.v fd_mod2_i50_e5_gap.ps;convert fd_mod2_i50_e5_gap.ps fd_mod2_i50_e5_gap.jpg

fd_mod2_i100_e10_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=10. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=0 eps=10." pclip=100 > /dev/null out=fd_mod2_i100_e10_gap.v 
	pstexpen fd_mod2_i100_e10_gap.v fd_mod2_i100_e10_gap.ps;convert fd_mod2_i100_e10_gap.ps fd_mod2_i100_e10_gap.jpg

fd_mod2_i100_e5_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=5. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=0 eps=5." pclip=100 > /dev/null out=fd_mod2_i100_e5_gap.v 
	pstexpen fd_mod2_i100_e5_gap.v fd_mod2_i100_e5_gap.ps;convert fd_mod2_i100_e5_gap.ps fd_mod2_i100_e5_gap.jpg

fd_mod2_i100_e1_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=1. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=0 eps=1." pclip=100 > /dev/null out=fd_mod2_i100_e1_gap.v 
	pstexpen fd_mod2_i100_e1_gap.v fd_mod2_i100_e1_gap.ps;convert fd_mod2_i100_e1_gap.ps fd_mod2_i100_e1_gap.jpg

fd_mod2_i1000_e1_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=1000 eps=1. style=0 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=1000 style=0 eps=1." pclip=100 > /dev/null out=fd_mod2_i1000_e1_gap.v 
	pstexpen fd_mod2_i1000_e1_gap.v fd_mod2_i1000_e1_gap.ps;convert fd_mod2_i1000_e1_gap.ps fd_mod2_i1000_e1_gap.jpg

fd_mod2_i100_e10_st1_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=10. style=1 amax=60 amin=-60 dax=1 > $@
	Grey <$@ title="mode=2 niter=100 style=1 eps=10." pclip=100 > /dev/null out=fd_mod2_i100_e10_st1_gap.v 
	pstexpen fd_mod2_i100_e10_st1_gap.v fd_mod2_i100_e10_st1_gap.ps;convert fd_mod2_i100_e10_st1_gap.ps fd_mod2_i100_e10_st1_gap.jpg

fd_mod2_i100_e1_st1_gap.H:
#	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=1. style=1 amax=70 amin=-70 dax=1 > $@
	< $@ Window min2=-20 | Wiggle yreverse=y wherexlabel=t transp=1 title="mode=2 niter=100 style=1 eps=1." pclip=100 > /dev/null out=fd_mod2_i100_e1_st1_gap.v 
#	Grey <$@ title="mode=2 niter=100 style=1 eps=1." pclip=100 > /dev/null out=wfd_mod2_i100_e1_st1_gap.v 
	pstexpen wfd_mod2_i100_e1_st1_gap.v wfd_mod2_i100_e1_st1_gap.ps;convert wfd_mod2_i100_e1_st1_gap.ps wfd_mod2_i100_e1_st1_gap.jpg

fd_mod2_i100_e.1_st1_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=.1 style=1 amax=70 amin=-70 dax=1 > $@
	< $@ Grey title="mode=2 niter=100 style=1 eps=.1" pclip=100 > /dev/null out=fd_mod2_i100_e.1_st1_gap.v 
	pstexpen fd_mod2_i100_e.1_st1_gap.v fd_mod2_i100_e.1_st1_gap.ps;convert fd_mod2_i100_e.1_st1_gap.ps fd_mod2_i100_e.1_st1_gap.jpg

wfd_mod2_i100_e1_st1_gap.H:
	<x.H Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=100 eps=1. style=1 amax=70 amin=-70 dax=1 > $@
	< $@ Window min2=-60 max2=60 | Wiggle yreverse=y wherexlabel=t transp=1 title="mode=2 niter=100 style=1 eps=1." pclip=100 > /dev/null out=wfd_mod2_i100_e1_st1_gap.v 
#	Grey <$@ title="mode=2 niter=100 style=1 eps=1." pclip=100 > /dev/null out=wfd_mod2_i100_e1_st1_gap.v 
	pstexpen wfd_mod2_i100_e1_st1_gap.v wfd_mod2_i100_e1_st1_gap.ps;convert wfd_mod2_i100_e1_st1_gap.ps wfd_mod2_i100_e1_st1_gap.jpg

########################################
#
# Test off2ang alias
#
AVO_0a%.H:
	${BIN}/AVO.x n1=500 o1=0 d1=10 n2=33 o2=-20 d2=2.5 depth=2000 A=-2 B=-0 C=0 > ${DATA}/$@
	echo esize=4 >> ${DATA}/$@

OFF_0a%.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x adj=.false. < ./Data/AVO_0a$*.H style=1 > $@

########################################
#
# AVO 0
#
######
# In off2ang_sd.x style = 0 is the default 
# When using style: style = 0 --> applies the cosine weight to the transformation (good for adjoint)
#		    style = 1 --> do not (good for inversion)
#
AVO_class00.H:
	${BIN}/AVO.x n1=500 o1=0 d1=10 n2=61 o2=-60 d2=2 depth=2000 A=-2 B=0 C=0 > ${DATA}/$@
	echo esize=4 >> ${DATA}/$@

OFF_class0cos.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x adj=.false. < ./Data/AVO_class00.H style=0 > $@

OFF_class0.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x adj=.false. < ./Data/AVO_class00.H style=1 > $@

O2A_class0_FT.H:
	Pad < OFF_class0.H beg2=6 end2=6 >j1.H; /net/koko/bob/SEP_BOB/bin/OFF2ANG inverse=n verb=y eps=1 <j1.H  > $@

O2A_class0_0.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 < OFF_class0.H style=1 amax=60 amin=-60 dax=2 > $@

O2A_class0_0cos.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 < OFF_class0.H style=0 amax=60 amin=-60 dax=2 > $@

O2A_class0_1.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=.1 niter=50 mode=1 < OFF_class0.H amax=60 amin=-60 dax=2 > $@

O2A_class0_2.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=1. niter=50 mode=2 < OFF_class0.H amax=60 amin=-60 dax=2 > $@

O2A_class0_2a.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=1. niter=50 mode=2 < OFF_class0.H amax=60 amin=-60 dax=2 > $@
#-------------------------------
O2A_class0_0coscos.H:
	Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 < OFF_class0cos.H style=0 amax=60 amin=-60 dax=2 > $@

#------------------------------
# Figs
#
AVO_class00.v:
	< Data/AVO_class00.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='a' label1='Depth(m)' label2='angle(deg)' wheretitle=b \
	screenratio=2 screenht=2.5 screenwd=2.5 labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=y wantaxis2=y o2num=-60 d2num=20. > /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-5.5 vpstyle=n > Fig/$@

OFF_class0.v:
	< OFF_class0.H Window min1=1000 max1=3000 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='b' label1='Depth(m)' label2='offset(m)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b wantaxis1=y wantaxis2=y \
	wantaxis1=y wantaxis2=y \
	o2num=-600 d2num=200.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-5.5 vpstyle=n > Fig/$@

O2A_class0.v:
	< O2A_class0_0.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='c' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-3. vpstyle=n > Fig/$@

amp_class0.v:
	< O2A_class0_0.H Window min1=2000 n1=1 |Scale scale_to=1 | Graph \
	title='d' label2='Amplitude' label1='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=0.2 max2=1.1 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-3 vpstyle=n > Fig/$@

O2A_class0cos.v:
	< O2A_class0_0cos.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='e' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > Fig/$@

amp_class0cos.v:
	< O2A_class0_0cos.H Window min1=2000 n1=1 |Scale scale_to=1| Graph \
	title='f' label2='Amplitude' label1='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=0.2 max2=1.1 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

test1.v: AVO_class00.v OFF_class0.v O2A_class0.v amp_class0.v O2A_class0cos.v amp_class0cos.v
	vp_Overlay Fig/AVO_class00.v Fig/OFF_class0.v Fig/O2A_class0.v Fig/amp_class0.v Fig/O2A_class0cos.v Fig/amp_class0cos.v > Fig/$@

#------------------------------------------------
O2A_class0cos1.v:
	< O2A_class0_0coscos.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='a' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > Fig/$@

amp_class0cos1.v:
	< O2A_class0_0coscos.H Window min1=2000 n1=1 |Scale scale_to=1| Graph \
	title='b' label2='Amplitude' label1='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=0.2 max2=1.1 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

test2.v: O2A_class0cos1.v amp_class0cos1.v
	vp_Overlay Fig/O2A_class0cos1.v Fig/amp_class0cos1.v > Fig/$@

########################################
#
# AVO 3
#
AVO_class03.H:
	${BIN}/AVO.x n1=500 o1=0 d1=10 n2=61 o2=-60 d2=2 depth=2000 A=-2 B=-4 C=-2 > ${DATA}/$@
	echo esize=4 >> ${DATA}/$@

OFF_class3.H: AVO_class03.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x adj=.false. < ./Data/AVO_class03.H style=0 > $@

O2A_class3_FT.H: OFF_class3.H
	Pad < OFF_class3.H beg2=5 end2=6 >j1.H; /net/koko/bob/SEP_BOB/bin/OFF2ANG inverse=n verb=y eps=1 <j1.H  > $@

O2A_class3_0.H: OFF_class3.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 < OFF_class3.H style=1 amax=60 amin=-60 dax=2 > $@

O2A_class3_1.H: OFF_class3.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=.1 niter=50 mode=1 < OFF_class3.H style=0 amax=60 amin=-60 dax=2 > $@

O2A_class3_2.H: OFF_class3.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=10. niter=20 mode=2 < OFF_class3.H style=0 amax=60 amin=-60 dax=2 > $@

%.jpg:
	< $*.H Window min2=-20 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 > /dev/null out=Fig/$*.v 
#	pstexpen $*.v $*.ps;convert $*.ps $@
#------------------------------
# Figs
#
AVO_class3.v: AVO_class03.H
	< Data/AVO_class03.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='a' label1='Depth(m)' label2='angle(deg)' wheretitle=b \
	screenratio=2 screenht=2.5 screenwd=2.5 labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=y wantaxis2=y o2num=-60 d2num=20. > /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-5.5 vpstyle=n > Fig/$@

OFF_class3.v: OFF_class3.H
	< OFF_class3.H Window min1=1000 max1=3000 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='b' label1='Depth(m)' label2='offset(m)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b wantaxis1=y wantaxis2=y \
	wantaxis1=y wantaxis2=y \
	o2num=-600 d2num=200.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-5.5 vpstyle=n > Fig/$@

O2A_class3_FT.v: O2A_class3_FT.H
	< O2A_class3_FT.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='c' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-3. vpstyle=n > Fig/$@

O2A_class3_0.v: O2A_class3_0.H
	< O2A_class3_0.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='d' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-3. vpstyle=n > Fig/$@

O2A_class3_2.v: O2A_class3_2.H
	< O2A_class3_2.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='e' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > Fig/$@

amp_class3.v: AVO_class03.H
	< Data/AVO_class03.H Window min1=2000 n1=1 |Scale scale_to=1 |Scale rscale=-1| Graph \
	title=' ' label1=' ' label2=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=n wantaxis2=n \
	wheretitle=b min2=-1.5 max2=0 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@


amp_class3FT.v: O2A_class3_FT.H
	< O2A_class3_FT.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1| Graph \
	title=' ' label1=' ' label2=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=1 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=n wantaxis2=n \
	wheretitle=b min2=-1.5 max2=0 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

amp_class3_0.v: O2A_class3_0.H
	< O2A_class3_0.H Window min1=2000 n1=1 |Scale scale_to=1 |Scale rscale=-1| Graph \
	title=' ' label1=' ' label2=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=2 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=n wantaxis2=n \
	wheretitle=b min2=-1.5 max2=0 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@


amp_class3_2.v: O2A_class3_2.H
	< O2A_class3_2.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1| Graph \
	title='f' label2='Amplitude' label1='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=-1.5 max2=0 wherexlabel=t \
	o1num=-60 d1num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

amp_class3_1.v: O2A_class3_1.H
	< O2A_class3_1.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1| Graph \
	title=' ' label2=' ' label1=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=6 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=n wantaxis2=n \
	wheretitle=b min2=-1.5 max2=0 wherexlabel=t \
	o2num=-60 d2num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

test3.v: AVO_class3.v OFF_class3.v O2A_class3_FT.v O2A_class3_0.v O2A_class3_2.v amp_class3.v amp_class3FT.v amp_class3_0.v amp_class3_2.v
	vp_Overlay Fig/AVO_class3.v Fig/OFF_class3.v Fig/O2A_class3_FT.v Fig/O2A_class3_0.v Fig/O2A_class3_2.v \
	Fig/amp_class3.v Fig/amp_class3FT.v Fig/amp_class3_0.v Fig/amp_class3_2.v > Fig/$@




########################################
#
# AVO 4
#
AVO_class04.H:
	${BIN}/AVO.x n1=500 o1=0 d1=10 n2=61 o2=-60 d2=2 depth=2000 A=-2 B=3 C=1 > ${DATA}/$@
	echo esize=4 >> ${DATA}/$@

OFF_class4.H: AVO_class04.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x adj=.false. < ./Data/AVO_class04.H style=0 > $@

O2A_class4_FT.H: OFF_class4.H
	Pad < OFF_class4.H beg2=6 end2=6 >j1.H; /net/koko/bob/SEP_BOB/bin/OFF2ANG inverse=n verb=y eps=1 <j1.H  > $@

O2A_class4_0.H: OFF_class4.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x mode=0 < OFF_class4.H style=1 amax=60 amin=-60 dax=2 > $@

O2A_class4_1.H: OFF_class4.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=.1 niter=50 mode=1 < OFF_class4.H style=0 amax=60 amin=-60 dax=2 > $@

O2A_class4_2.H: OFF_class4.H
	Yaxun/${BIN}/LINUX/off2ang_sd.x eps=10. niter=20 mode=2 < OFF_class4.H style=0 amax=60 amin=-60 dax=2 > $@

%.jpg:
	< $*.H Window min2=-20 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 > /dev/null out=Fig/$*.v 
#	pstexpen $*.v $*.ps;convert $*.ps $@
#------------------------------
# Figs
#
AVO_class4.v: AVO_class04.H
	< Data/AVO_class04.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='a' label1='Depth(m)' label2='angle(deg)' wheretitle=b \
	screenratio=2 screenht=2.5 screenwd=2.5 labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=y wantaxis2=y o2num=-60 d2num=20. > /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-5.5 vpstyle=n > Fig/$@

OFF_class4.v: OFF_class4.H
	< OFF_class4.H Window min1=1000 max1=3000 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='b' label1='Depth(m)' label2='offset(m)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b wantaxis1=y wantaxis2=y \
	wantaxis1=y wantaxis2=y \
	o2num=-600 d2num=200.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-5.5 vpstyle=n > Fig/$@

O2A_class4_FT.v: O2A_class4_FT.H
	< O2A_class4_FT.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='c' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-3. vpstyle=n > Fig/$@

O2A_class4_0.v: O2A_class4_0.H
	< O2A_class4_0.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='d' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-3. vpstyle=n > Fig/$@

O2A_class4_2.v: O2A_class4_2.H
	< O2A_class4_2.H Window min1=1000 max1=3000 j2=2 | Wiggle yreverse=y wherexlabel=t transp=1 title=" " pclip=100 \
	title='e' label1='Depth(m)' label2='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b \
	wantaxis1=y wantaxis2=y \
	o2num=-60 d2num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > Fig/$@

amp_class4.v: AVO_class04.H
	< Data/AVO_class04.H Window min1=2000 n1=1 |Scale scale_to=1 |Scale rscale=-1| Graph \
	title=' ' label1=' ' label2=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=n wantaxis2=n \
	wheretitle=b min2=-1.1 max2=1.1 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@


amp_class4FT.v: O2A_class4_FT.H
	< O2A_class4_FT.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1| Graph \
	title=' ' label1=' ' label2=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=1 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wantaxis1=n wantaxis2=n \
	wheretitle=b min2=-1.1 max2=1.1 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

amp_class4_0.v: O2A_class4_0.H
	< O2A_class4_0.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1 | Graph \
	title=' ' label1=' ' label2=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=2 \
	wantaxis1=n wantaxis2=n \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=-1.1 max2=1.1 wherexlabel=t \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@


amp_class4_2.v: O2A_class4_2.H
	< O2A_class4_2.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1| Graph \
	title='f' label2='Amplitude' label1='angle(deg)' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=5 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=-1.1 max2=1.1 wherexlabel=t \
	o1num=-60 d1num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

amp_class4_1.v: O2A_class4_1.H
	< O2A_class4_1.H Window min1=2000 n1=1 |Scale scale_to=1|Scale rscale=-1| Graph \
	title=' ' label2=' ' label1=' ' \
	screenratio=2 screenht=2.5 screenwd=2.5 dash=6 \
	labelsz=2 labelfat=n titlesz=3.5 \
	wheretitle=b min2=-1.1 max2=1.1 wherexlabel=t \
	o2num=-60 d2num=20. \
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-3 ycenter=-.5 vpstyle=n > Fig/$@

test4.v: AVO_class4.v OFF_class4.v O2A_class4_FT.v O2A_class4_0.v O2A_class4_2.v amp_class4.v amp_class4FT.v amp_class4_0.v amp_class4_2.v
	vp_Overlay Fig/AVO_class4.v Fig/OFF_class4.v Fig/O2A_class4_FT.v Fig/O2A_class4_0.v Fig/O2A_class4_2.v \
	Fig/amp_class4.v Fig/amp_class4FT.v Fig/amp_class4_0.v Fig/amp_class4_2.v > Fig/$@

###################################################################
#
# Testing weights in off2ang
# Bill Symes dataset
#
#
bill_test.v:
	<Imagertmhx.H Window n3=1 f3=200 | Yaxun/${BIN}/LINUX/off2ang_sd.x mode=2 niter=50 eps=1. style=1 amax=60 amin=-60 dax=1 > bill_test.H
	Grey <bill_test.H title="mode=0 niter=50 style=1 eps=1." newclip=1 > /dev/null out=$@ 
	pstexpen bill_test.v bill_test.ps;convert bill_test.ps bill_test.jpg

#######################################################
#
# Old stuff
#
ang_test_biondo.H:
	< off_test.H Transp reshape=2,4,5,6 plane=23 | Rtoc > pp1.H
	< pp1.H Ft3d sign1=1 sign3=1 > pp2.H
	< pp2.H Transp reshape=2,3,5,6 plane=13 > pp3.H
	< pp3.H /net/koko/homes/sep/alejandro/research/Ang_BB/Off2Ang3D_v5.x \
        par=Coplanar_azim_ang.P apply_jac_gamma=n apply_jac_azim_1=n  \
    comaz_data=y \
    n_gamma=32 gamma_0=-45 d_gamma=2.8125 \
    space_domain=n Coplanar_ang=pp4.H datapath=/scr4/claudio/  > $@.head
	< pp4.H Ft3d sign2=-1 sign3=-1 maxsize=100| Real > $@

 
off_test_biondo.H:
	< off_test.H Transp reshape=2,4,5,6 plane=23 | Rtoc > pp1.H
	< pp1.H Ft3d sign1=1 sign3=1 > pp2.H
	< pp2.H Transp reshape=2,3,5,6 plane=13 > pp3.H
	< pp3.H /net/koko/homes/sep/alejandro/research/Ang_BB/Off2Ang3D_v5.x \
        par=Coplanar_azim_ang.P apply_jac_gamma=n apply_jac_azim_1=n  \
    comaz_data=y \
    n_gamma=32 gamma_0=-45 d_gamma=2.8125 \
    space_domain=n Coplanar_ang=pp4.H datapath=/scr4/claudio/  > $@.head
	< pp4.H Ft3d sign2=-1 sign3=-1 maxsize=100| Real > $@

clean:
	rm -f *.o *.fix.* *.mod *.x .make.dependencies.LINUX86_64

include ${SEPINC}/SEP.bottom
