MAKE_DEPEND=yes
include ${SEPINC}/SEP.top
################# To run in gomorrah  ####################
#include /usr/local/share/make/SEP.top
##########################################################

LATOPTS  = style=html
#LATOPTS = option=web 'style=jfc,makeidx,html,amsmath'
#LATOPTS=class=geophysics
SIGDIR = /mnt/sepdata/1a/sigsbee_multiple
OLEVEL=2
#UF90FLAGS =-mp -check bounds -O3
UF90FLAGS =-parallel -g -openmp -openmp_report2  -O3 -axW -vec_report3 -C #-check bounds 
#UF90FLAGS =-parallel -openmp -openmp_report2  -O3 -axW -vec_report3
#UF90FLAGS =-parallel -openmp -openmp_report2 -axW -vec_report3
MAINLIBS=-lsep2df90 -lsep3df90 -lsep3d -lsepf90 -lsep -L${LIBDIR}  -lsepgeef90
UF77LIBS = ${BEILIB}

#WHEREFFTW = /usr/local/FFTW/FFT3_INTEL/lib/libfftw3f.a
#UF90LIBS=${MPILIBS} ${MAINLIBS} -lsepparf90 -lseppar_mpi -lsepgeef90 -lsep2df90 -static-libcxa -lguide -lseppar  -lsuperset -lsupersetf90 -#lsuperset -lsepauxf90 -lsepmathf90 -lsep3df90 -lsep3d -lsepf90 -lsep $(WHEREFFTW)

WHEREFFTW = /net/koko/linux_local/FFTW/FFTW2/lib/lib
UF90LIBS=${MPILIBS} ${MAINLIBS} -lsepparf90 -lseppar_mpi -lsepgeef90 -lsep2df90 -static-libcxa -lguide -lseppar  -lsuperset -lsupersetf90 -lsuperset -lsepauxf90 -lsepmathf90 -lsep3df90 -lsep3d -lsepf90 -lsep $(WHEREFFTW)fftw.a $(WHEREFFTW)rfftw.a #-Bstatic
#
# To run in gomorrah
#
#WHEREFFTW = /opt/FFTW/fftw-3.1.2/libbench2/libbench2.a

COLOR=y

RESULTSER = geo0 geo45 geo45t
RESULTSNR = sodcig

BIN=./bin
PAR=./par
RESDIR=./fig
FIG=./fig
DATA=./data
SRCDIR=./src

#UF90FLAGS=-O1

##############################
#
# Programs
#


################################
#
#
#
OWshot1.H:
	Vel n1=401 n2=401 n3=1 o1=0 o2=0 o3=0 d1=10 d2=20 d3=1 vc=1 xa1=0 z1=2000 vr1=2 xa2=0 z2=2010 vr2=1 const1=1 const2=1 > denOWsens.H
	Fdmod intag=velOWsens.H dfile=denOWsens.H no_stdout=1 oxs=4000 dxs=20 nxs=1 tmax=5 bx=200 ex=200 hsfile=temp11.H
	Bandpass flo=5 fhi=20 < temp11.H | Window3d j1=2 > temp12.H 
	Window3d < temp12.H max2=0 | Mute vmute=2000 tmute=1.3 | Pad beg2=0 end2=201 > temp01.H
	Window3d < temp12.H min2=0 | Mute vmute=1500 tmute=1.3 | Pad beg2=200 end2=0 > temp02.H
	Math file1=temp01.H file2=temp02.H exp="file1+file2" > $@

OWshot2.H:
	Vel n1=401 n2=401 n3=1 o1=0 o2=0 o3=0 d1=10 d2=20 d3=1 vc=2000 > vOW2000.H
	Fdmod intag=vOW2000.H dfile=denOWsens.H no_stdout=1 oxs=4000 dxs=20 nxs=1 tmax=5 bx=200 ex=200 hsfile=temp11.H
	Bandpass flo=5 fhi=20 < temp11.H | Window3d j1=2 > temp12.H 
	< temp12.H Mute vmute=2000 tmute=1.3 | Pad beg2=201 end2=201 > $@

rot1_shot2.H:
	Fdmod intag=vel.H dfile=den.H no_stdout=1 oxs=2020 dxs=20 nxs=100 tmax=5 bx=0 ex=2000 hsfile=temp12.H
	Bandpass flo=5 fhi=32 < temp12.H | Mute vmute=2500 tmute=.2 > temp22.H; < temp22.H Window j2=5 j1=10 > $@

rot1_shot3.H:
	Fdmod intag=vel.H dfile=den.H no_stdout=1 oxs=4020 dxs=20 nxs=100 tmax=5 bx=0 ex=2000 hsfile=temp13.H
	Bandpass flo=5 fhi=32 < temp13.H | Mute vmute=2500 tmute=.2 > temp23.H; < temp23.H Window j2=5 j1=10 > $@

# mv shot_rot1.H rot1_shot.H 

rot1_vel.H:
	Window3d <vel.H j1=3 j2=5 | Pad beg2=500 end2=0 extend=1 > j1.H
	Transp reshape=1,3 plane=12 < j1.H > $@

rot1_vello.H:
	Math file1=vel.H exp="file1*0.+2375." >j1.H
	Window3d <j1.H j1=3 j2=5 | Pad beg2=500 end2=0 extend=1 > j2.H
	Transp reshape=1,3 plane=12 < j2.H > $@

rot1_prep.H:rot1_shot.H
#	< rot1_shot.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=3 f_min1=5 f_max1=32 f_max=40 maxsize=1000 > j2.H
	< rot1_shot.H Pad n1out=800| /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=3 f_min1=5 f_max1=32 f_max=40 maxsize=1000 > j2.H
	< j2.H Transp reshape=1,3,5 plane=23 | Pad beg1=100 end1=100 > $@

OWsou.H:
	 Window3d < temp12.H n2=1 min2=1000 | Bandpass flo=5 fhi=20 | Window3d min1=2 max1=3.54 > OWsou.H; echo o1=-.780 >> $@ 

#rot1_mig.H: rot1_prep.H
#	@date
#	nohup Parallel command=/net/koko/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX/ShotMig files="rot1_prep.H,rot1_sou.H,rot1_vello.H,$@" \
#	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=201 axis=4,4,4,6 pverb=2  \
#	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
#	nx_shots=201 ox_shots=0 \
#	par=rot1_go_sis.P taper=y taper_pcent=2 marine=y minx=-2500 maxx=12000 & #restart=y

rot1_miglo.H:
	@date
	/net/koko/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX/ShotMig D=rot1_prep.H D_d=rot1_sou.H V=rot1_vello.H R=$@  \
	pverb=2 nx_shots=301 ox_shots=0 \
	par=rot1_go_sis.P taper=y taper_pcent=2 marine=y minx=-2500 maxx=16000 & #restart=y

rot1_mig.H:
	@date
	/net/koko/homes/sep/alejandro/research/SPWEI_SERIAL/bin/LINUX/ShotMig D=rot1_prep.H D_d=rot1_sou.H V=rot1_vel.H R=$@  \
	pverb=2 nx_shots=301 ox_shots=0 \
	par=rot1_go_sis.P taper=y taper_pcent=2 marine=y minx=-2500 maxx=16000 & #restart=y

####################
#
# GaussVel
#
shgauss.H:
	Interp type=1 d1out=5 d2out=5 <velgauss.H >velgauss_interp5x5.H
	Fdmod intag=velgauss_interp5x5.H no_stdout=1 oxs=3000 dxs=5 nxs=1 tmax=2 bx=600 ex=600 hsfile=tgauss.H
#	Bandpass flo=5 fhi=32 < tgauss.H < temp21.H Window j2=5 j1=10 > $@


################################
#
# CIG Rotation
#
sogrot: sodcig_rot.x
	rm -f ${BIN}/sodcig_rot.x;rm -f sodcig_rot.x;make sodcig_rot.x
	mv -f sodcig_rot.x ${BIN}/sodcig_rot.x

teste: teste_main.x
	rm -f ${BIN}/teste_main.x;rm -f teste_main.x;make teste_main.x
	mv -f teste_main.x ${BIN}/teste_main.x

sogrot4: sodcig4_rot.x
	rm -f ${BIN}/sodcig4_rot.x;rm -f sodcig4_rot.x;make sodcig4_rot.x
	mv -f sodcig4_rot.x ${BIN}/sodcig4_rot.x

sogor: sodcig_rot_orig.x
	rm -f ${BIN}/sodcig_rot_orig.x;rm -f sodcig_rot_orig.x;make sodcig_rot_orig.x
	mv -f sodcig_rot_orig.x ${BIN}/sodcig_rot_orig.x

rotsog: rot_sog.x
	rm -f ${BIN}/rot_sog.x;rm -f rot_sog.x;make rot_sog.x
	mv -f rot_sog.x ${BIN}/rot_sog.x
#####
#
# Diagnostics
#
sogfft: sodcig_rot_fft.x
	rm -f ${BIN}/sodcig_rot_fft.x;rm -f sodcig_rot_fft.x;make sodcig_rot_fft.x
	mv -f sodcig_rot_fft.x ${BIN}/sodcig_rot_fft.x

xxx:
	< sism2.H Pad beg2=140 end2=141 beg3=80 end3=81 end1=101 > jjj.H; echo o3=-800 >> jjj.H
#	< jjj.H ${BIN}/sodcig_rot_fft.x Rot_s_cig=Rot_s_cig1.H npadz=00 npadh=00 npadx=00 test_fft=1 > /dev/null
	< jjj.H ${BIN}/sodcig_rot_fft.x Rot_s_cig=Rot_s_cig2.H npadz=00 npadh=00 npadx=00 test_fft=2 > /dev/null
#	< jjj.H ${BIN}/sodcig_rot_fft.x Rot_s_cig=Rot_s_cig3.H npadz=00 npadh=00 npadx=00 test_fft=3 > /dev/null

xxx1:
	< sism2.H Pad beg2=121 end2=120 beg3=50 end3=51 end1=101 |${BIN}/sodcig_rot_fft.x Rot_s_cig=Rot_s_cig1.H npadz=0 npadh=0 npadx=0 test_fft=1 > /dev/null
	< sism2.H Pad beg2=121 end2=120 beg3=50 end3=51 end1=101 |${BIN}/sodcig_rot_fft.x Rot_s_cig=Rot_s_cig2.H npadz=0 npadh=0 npadx=0 test_fft=2 > /dev/null
	< sism2.H Pad beg2=121 end2=120 beg3=50 end3=51 end1=101 |${BIN}/sodcig_rot_fft.x Rot_s_cig=Rot_s_cig3.H npadz=0 npadh=0 npadx=0 test_fft=3 > /dev/null

kwrite: kwrite.x
	rm -f ${BIN}/kwrite.x;rm -f kwrite.x;make kwrite.x
	mv -f kwrite.x ${BIN}/kwrite.x

sism.H:
	${BIN}/kwrite.x 1 > jjj.H; < jjj.H Bandpass flo=.001 fhi=.005 > $@
#	${BIN}/kwrite.x 1 > $@

sism1.H:
	${BIN}/kwrite.x 1 > jjj.H; < jjj.H Bandpass flo=.001 fhi=.005 > $@
#	${BIN}/kwrite.x 1 > $@

sism2.H:
	${BIN}/kwrite.x 1 > jjj.H; < jjj.H Bandpass flo=.001 fhi=.005 > $@
#	${BIN}/kwrite.x 1 > $@

sism3.H:
	${BIN}/kwrite.x 1 > jjj.H; < jjj.H Bandpass flo=.001 fhi=.005 > $@

sism4.H:
	${BIN}/kwrite.x 1 > jjj.H; < jjj.H Bandpass flo=.001 fhi=.005 > $@

sism1_ang.H:
	< sism1.H ../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x style=1 > $@

test01:
#	Window3d max1=3000 max2=210 <sism.H >sisma.H
#	< sisma.H ${BIN}/sodcig_rot.x >$@
	< /homes/sep/claudio/Research/Ill_ADCIG/001-ODCIG.H ${BIN}/sodcig_rot.x Rot_s_cig=test_01_Rot.H test_fft=y npadz=100 npadh=100 npadx=100 > /dev/null

yyy:
	< sism1.H ${BIN}/sodcig_rot_orig.x Rot_s_cig=Rot_s_cig.H Rot_g_cig=Rot_g_cig.H npadz=100 npadh=100 npadx=100 test_fft= y > /dev/null

ttt:
#	< sism4.H Pad beg2=0 end2=121 beg3=0 end3=241 > jjj.H
#	< sism4.H Pad beg2=121 end2=0 beg3=0 end3=241 > jjj.H
#	< xxx.H Pad beg2=40 end2=41 beg3=40 end3=40 end1= 101 > jjj.H
#	< sism2.H Transp plane=23 | Window3d squeeze=n n2=1 min2=0 | Pad beg2=60 end2=61 beg3=50 end3=51 end1=51 > jjj.H; echo o2=-600 o3=-900 >> #jjj.H
	< sism4.H ${BIN}/sodcig_rot.x Ccig=Ccig.H Rot_s_cig=Rot_s_cig.H Rot_g_cig=Rot_g_cig.H npadz=0 100 npadh=0 100 npadx=0 100 > /dev/null

ttt1:
#	<  sism2.H Pad end1=101 end2=101 end3=101 | ${BIN}/sodcig_rot.x Ccig=Ccig.H Rot_s_cig=Rot_s_temp.H Rot_g_cig=Rot_g_temp.H npadz=0 npadh=0 npadx=0 > /dev/null 
#	<  sism2.H Pad end1=1 end2=1 end3=1 | ${BIN}/sodcig_rot.x Ccig=Ccig.H Rot_s_cig=Rot_s_temp.H Rot_g_cig=Rot_g_temp.H npadz=0 npadh=0 npadx=0 !> /dev/null
#	< Rot_s_temp.H Window3d n2=81 n3=181 > Rot_s_cig0.H;< Rot_g_temp.H Window3d n2=81 n3=181 > Rot_g_cig0.H
#	<  sism2.H Pad end1=21 beg2=20 end2=21 beg3=20 end3=21 | Transp plane=23 > jjj.H; echo o2=-1100 >> jjj.H 
	<  sism2.H Pad end1=1 end2=1 end3=1 | Transp plane=23 > jjj.H; echo o2=-900 >> jjj.H 
	<jjj.H ${BIN}/sodcig_rot.x Ccig=Ccig.H Rot_s_cig=Rot_s_temp.H Rot_g_cig=Rot_g_temp.H npadz=0 npadh=0 npadx=0 > /dev/null
#	< sism2.H Transp plane=23 > jjj1.H;echo o2=-900 >> jjj1.H
#	< jjj1.H ${BIN}/sodcig_rot.x Ccig=Ccig.H Rot_s_cig=Rot_s_temp.H Rot_g_cig=Rot_g_temp.H npadz=0 npadh=0 npadx=0 > /dev/null
#	< Rot_s_temp.H Window3d n2=181 n3=81 > Rot_s_cig1.H;< Rot_g_temp.H Window3d n2=181 n3=81 > Rot_g_cig1.H

ttt2:
	< sism2.H Transp plane=23 |Pad beg2=60 end2=61 beg3=50 end3=51 end1=101 > jjj.H; echo o2=-1500. o3=-900 >> jjj.H 
	<jjj.H ${BIN}/sodcig4_rot.x Ccig= Ccig.H Rot_s_cig=Rot_s_cig.H Rot_g_cig=Rot_g_cig.H npadz=0 npadh=0 npadx=0 > /dev/null

ttt3:
	< sism2.H Pad beg2=40 end2=41 beg3=50 end3=51 end1=101 > jjj.H; o3=-500 o2=-800>> jjj.H 
	<jjj.H ${BIN}/sodcig4_rot.x Ccig= Ccig.H Rot_s_cig=Rot_s_cig.H Rot_g_cig=Rot_g_cig.H npadz=0 100 npadh=0 100 npadx=0 100 > /dev/null
#	< sism3.H Transp plane=23 |Pad beg2=60 end2=61 beg3=50 end3=51 end1=101 > jjj.H; echo o2=-1500. o3=-900 >> jjj.H
#	< sism2.H Pad beg2=0 end2=121 beg3=0 end3=321 end1=1 > jjj.H
##	|Pad beg2=0 end2=121 beg3=0 end3=241 > jjj.H;echo o2=-900 >> jjj.H

ttt4:
	<  sism2.H Pad end1=1 end2=1 end3=1 | Transp plane=23 | ${BIN}/teste_main.x Rot_s_cig=Rot_s_temp.H Rot_g_cig=Rot_g_temp.H > /dev/null

vvv:
#	< sism2.H Window3d n3=100 n1=250 min2=-200 max2=200 | Transp plane=23 > jjj.H; echo o2=-900. >> jjj.H 
	< sism2.H Window3d n3=100 n1=250 min2=-200 max2=200 > jjj.H
	<jjj.H ${BIN}/sodcig_rot.x Ccig=Ccig.H Rot_s_cig=Rot_s_cig.H Rot_g_cig=Rot_g_cig.H npadz=0 npadh=0 npadx=0 > /dev/null

uuu:
	<sism2.H ../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x style=0 mode=2 niter=10 > sism2_gamma.H
	<sism2.H Transp plane=23 | ../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x style=1 > sism2_alpha.H

Rotscig.H:
#	< sism2.H Window3d min2=-400. n2=41 n3=31 n1=300 | Transp plane=23 > jjj.H ;echo o2=-150 >>jjj.H
	< sism2.H Window3d min2=-200. n2=41 n3=41 n1=300 > jjj.H
	<jjj.H ${BIN}/rot_sog.x > $@


################################################
#
# CIGROT figs
# The data were produced in Matlab and converted
# to Seplib format using Nick's' toolbox
#
rot1.v:
	Window3d <rot1.H n3=1 |Grey pclip=100 \
	title='a' label1='Depth(m)' label2='half-offset(m)' \
	screenratio=2 screenht=5 screenwd=2.5 \
	labelsz=1.5 labelfat=n titlesz=2 wantaxis1=y wantaxis2=y \
	o2num=-200 d2num=100.\
	o1num=0 d1num=250.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > fig/$@


got1.v:
	Window3d <got1.H n3=1 |Grey pclip=100 \
	title='b' label1='Depth(m)' label2='half-offset(m)' \
	screenratio=2 screenht=5 screenwd=2.5 \
	labelsz=1.5 labelfat=n titlesz=2 wantaxis1=n wantaxis2=y \
	o2num=-200 d2num=100.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-2.5 ycenter=-.5 vpstyle=n > fig/$@

geo0.v:
	vp_Overlay fig/rot1.v fig/got1.v > fig/$@

rot.v:
	Window3d <rot.H n3=1 |Grey pclip=100 \
	title='a' label1='Depth(m)' label2='half-offset(m)' \
	screenratio=2 screenht=5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=2 wantaxis1=y wantaxis2=y \
	o2num=-600 d2num=200.\
	o1num=0 d1num=250.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > fig/$@


got.v:
	Window3d <got.H n3=1 |Grey pclip=100 \
	title='b' label1='Depth(m)' label2='half-offset(m)' \
	screenratio=2 screenht=5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=2 wantaxis1=n wantaxis2=y \
	o2num=-600 d2num=200.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-2.5 ycenter=-.5 vpstyle=n > fig/$@

geo45.v:
	vp_Overlay fig/rot.v fig/got.v > fig/$@

rott.v:
	Window3d <rot.H n3=1 f3=61|Grey pclip=100 \
	title='a' label1='Depth(m)' label2='half-offset(m)' \
	screenratio=2 screenht=5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=2 wantaxis1=y wantaxis2=y \
	o2num=-600 d2num=200.\
	o1num=0 d1num=250.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-0.5 ycenter=-.5 vpstyle=n > fig/$@


gott.v:
	Window3d <got.H n3=1 f3=61|Grey pclip=100 \
	title='b' label1='Depth(m)' label2='half-offset(m)' \
	screenratio=2 screenht=5 screenwd=2.5 \
	labelsz=2 labelfat=n titlesz=2 wantaxis1=n wantaxis2=y \
	o2num=-600 d2num=200.\
	> /dev/null out=junk1.v
	vppen < junk1.v xcenter=-2.5 ycenter=-.5 vpstyle=n > fig/$@

geo45t.v:
	vp_Overlay fig/rott.v fig/gott.v > fig/$@
################################
#
# Adcig
#
mmm:
	<sism2.H  Pad beg2=121 end2=120 beg3=50 end3=51 end1=51 | ${BIN}/sod2adcig.x npadz=0 npadh=0 npadx=0 > /dev/null

mmm1:
	< sism2.H Transp plane=23 |Pad beg2=60 end2=61 beg3=50 end3=51 end1=101 > jjj.H; echo o2=-1500. o3=-900 >> jjj.H ;
	< jjj.H  ${BIN}/sod2adcig.x npadz=0 npadh=0 npadx=0 adcig=adcig.H nang=141 > /dev/null

#########################################
################################
#
# KxKh filter
#
kxkh: kxkh_flt.x
	rm -f ${BIN}/kxkh_flt.x;rm -f kxkh_flt.x;make kxkh_flt.x
	mv -f kxkh_flt.x ${BIN}/kxkh_flt.x

kfilt: kfilt.x
	rm -f ${BIN}/kfilt.x;rm -f kfilt.x;make kfilt.x
	mv -f kfilt.x ${BIN}/kfilt.x

kxkh2: kxkh_flt2.x
	rm -f ${BIN}/kxkh_flt2.x;rm -f kxkh_flt2.x;make kxkh_flt2.x
	mv -f kxkh_flt2.x ${BIN}/kxkh_flt2.x

zzz:
	< /homes/sep/claudio/Research/Ill_ADCIG/001-ODCIG.H ${BIN}/kxkh_flt.x Rot_s_cig=sig_01_flt.H apply=n npadz=100 npadh=100 npadx=100 khflt1=-0.05 kxflt1=-0.05 khflt2=-0.01 kxflt2=-0.005 khflt3=0.01 kxflt3=-0.005 khflt4=0.05 kxflt4=-0.05 fatkx=1 > /dev/null
#khflt1=-0.05 kxflt1=-0.002 khflt2=-0.05 kxflt2=-0.01 fatkx=1 > /dev/null

www:
	< /homes/sep/claudio/Research/Ill_ADCIG/001-ODCIG.H ${BIN}/kxkh_flt.x Rot_s_cig=sig_01_flt.H apply=y npadz=100 npadh=100 npadx=100 khflt1=-0.05 kxflt1=-0.05 khflt2=-0.01 kxflt2=-0.005 khflt3=0.01 kxflt3=-0.005 khflt4=0.05 kxflt4=-0.05 fatkx=1 > /dev/null
#khflt1=-0.05 kxflt1=-0.002 khflt2=-0.05 kxflt2=-0.01 fatkx=1 > /dev/null

sss:
	< /homes/sep/claudio/Research/Ill_ADCIG/001-ODCIG.H ${BIN}/kxkh_flt2.x Rot_s_cig=sig_02_flt.H apply=y npadz=100 npadh=100 npadx=100 khflt5= -0.00 kxflt5=0.05 khflt6=-0.004 kxflt6=0.00 khflt7=0.01 kxflt7=0.005 khflt8=0.4 kxflt8=0.05 khflt4=0.00 kxflt4=-0.05 khflt3=0.00 kxflt3=-0.005 khflt2=-0.01 kxflt2=-0.005 khflt1=-0.4 kxflt1=-0.05 fatkx=1 > /dev/null

kzkx1:
	< mig_Sis_pad_800_strati_sort.H Pad beg3=250 end3=250 end1=201| ${BIN}/kfilt.x Rot_s_cig=sig_02_kzkx.H apply=n domain=kzkx npadz=0 400 npadh=0 100 npadx=0 100 khflt5= -0.00 kxflt5= 0.05 khflt6= -0.004 kxflt6= 0.00 khflt7= 0.01 kxflt7= 0.005 khflt8= 0.4 kxflt8= 0.05 khflt4= 0.00 kxflt4= -0.05 khflt3= 0.00 kxflt3= -0.005 khflt2= -0.01 kxflt2= -0.005 khflt1= -0.4 kxflt1= -0.05 > /dev/null

kzkx2:
	< mig_Sis_pad_800_strati_sort.H Pad beg3=50 end3=50 end1=201| ${BIN}/kfilt.x Rot_s_cig=sig_02_kzkx.H apply=y domain=kzkx npadz=0 npadh=0 npadx=0 kzflt5=0.15 kxflt5=0.0 kzflt6=0.02 kxflt6=0.00 kzflt7=0.03 kxflt7=0.003 kzflt8=0.15 kxflt8=0.01 kzflt4=-0.15 kxflt4=-0.0 kzflt3=-0.02 kxflt3=-0.00 kzflt2=-0.03 kxflt2=-0.003 kzflt1=-0.15 kxflt1=-0.01 > /dev/null


kzkh1:
	< mig_Sis_pad_800_strati_sort.H ${BIN}/kfilt.x zzz=zzz.H Rot_s_cig=sig_02_flt.H apply=y domain=kzkh npadz=100 npadh=100 npadx=100 khflt5=-0.005 kzflt5=-0.15 khflt6=-0.01 kzflt6=-0.02 khflt7=0.005 kzflt7=-0.02 khflt8=0.01 kzflt8=-0.15 khflt4=0.005 kzflt4=0.15 khflt3=0.01 kzflt3=0.02 khflt2=-0.005 kzflt2=0.02 khflt1=-0.01 kzflt1=0.15 zmerge1=13000. zmerge2=16000. zramp=500. xmerge1=35000. xmerge2=40000. xramp=500. > /dev/null

khkx1:
	< /homes/sep/claudio/Research/Ill_ADCIG/001-ODCIG.H ${BIN}/kfilt.x Rot_s_cig=sig_02_flt.H apply=y domain=kxkh npadz=100 npadh=100 npadx=100 khflt5= -0.00 kxflt5= 0.05 khflt6= -0.004 kxflt6= 0.00 khflt7= 0.01 kxflt7= 0.005 khflt8= 0.4 kxflt8= 0.05 khflt4= 0.00 kxflt4= -0.05 khflt3= 0.00 kxflt3= -0.005 khflt2= -0.01 kxflt2= -0.005 khflt1= -0.4 kxflt1= -0.05 > /dev/null

khkx0:
#	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_02_flt.H apply=y domain=kxkh npadz=00 #npadh=00 npadx=00 khflt1=-0.03 kxflt1=-0.05 khflt2=-0.000 kxflt2=-0.005 khflt3=0.000 kxflt3=-0.005 khflt4=0.03 kxflt4=-0.05 khflt5=0.03 kxflt5=0.05 #khflt6=0.000 kxflt6=0.005 khflt7=-0.000 kxflt7=0.005 khflt8=-0.03 kxflt8=0.05 > /dev/null
#	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_flt.H apply=y domain=kxkh npadz=00 #npadh=00 npadx=00 khflt1=-0.0001 kxflt1=-0.05 khflt2=-0.0001 kxflt2=-0.005 khflt3=0.000 kxflt3=-0.005 khflt4=0.03 kxflt4=-0.05 khflt5=0.0001 #kxflt5=0.05 khflt6=0.0001 kxflt6=0.005 khflt7=-0.000 kxflt7=0.005 khflt8=-0.03 kxflt8=0.05 > /dev/null
#	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_flt.H apply=y domain=kxkh npadz=00 #npadh=00 npadx=00 khflt1=-0.03 kxflt1=-0.05 khflt2=0.000 kxflt2=-0.005 khflt3=0.001 kxflt3=-0.005 khflt4=0.005 kxflt4=-0.05 khflt5=0.03 kxflt5=0.05 #khflt6=-0.000 kxflt6=0.005 khflt7=-0.001 kxflt7=0.005 khflt8=-0.005 kxflt8=0.05 > /dev/null
#	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_flt_new.H apply=y domain=kxkh npadz=00 #npadh=00 npadx=00 khflt1=-0.04 kxflt1=-0.05 khflt2=0.000 kxflt2=-0.005 khflt3=0.001 kxflt3=-0.005 khflt4=0.04 kxflt4=-0.05 khflt5=0.04 kxflt5=0.05 #khflt6=-0.000 kxflt6=0.005 khflt7=-0.001 kxflt7=0.005 khflt8=-0.04 kxflt8=0.05 > /dev/null
#	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_flt_new.H apply=y domain=kxkh npadz=00 #npadh=00 npadx=00 khflt1=-0.04 kxflt1=-0.05 khflt2=-0.001 kxflt2=-0.005 khflt3=0.001 kxflt3=-0.005 khflt4=0.025 kxflt4=-0.05 khflt5=0.04 #kxflt5=0.05 khflt6=0.001 kxflt6=0.005 khflt7=-0.001 kxflt7=0.005 khflt8=-0.025 kxflt8=0.05 > /dev/null
#
# Up to now(8:37 Nov 18), the best parameters
#	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_flt_new.H apply=y domain=kxkh npadz=00 #npadh=00 npadx=00 khflt1=-0.04 kxflt1=-0.05 khflt2=-0.001 kxflt2=-0.005 khflt3=0.001 kxflt3=-0.005 khflt4=0.04 kxflt4=-0.05 khflt5=0.04 kxflt5=0.05 #khflt6=0.001 kxflt6=0.005 khflt7=-0.001 kxflt7=0.005 khflt8=-0.04 kxflt8=0.05 > /dev/null
	< mig_Sis_pad_800_strati_sort.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=sig_flt_new.H apply=y domain=kxkh npadz=00 npadh=00 npadx=00 khflt1=-0.06 kxflt1=-0.05 khflt2=-0.001 kxflt2=-0.005 khflt3=0.001 kxflt3=-0.005 khflt4=0.06 kxflt4=-0.05 khflt5=0.06 kxflt5=0.05 khflt6=0.001 kxflt6=0.005 khflt7=-0.001 kxflt7=0.005 khflt8=-0.06 kxflt8=0.05 > /dev/null


khkxdiff:
	< xdiff.H Pad beg2=50 end2=51 beg3=50 end3=50 | ${BIN}/kfilt.x Rot_s_cig=xdiff_flt.H apply=n domain=kxkh npadz=00 npadh=00 npadx=00 khflt1= -0.03 kxflt1= -0.05 khflt2= -0.000 kxflt2= -0.005 khflt3= 0.000 kxflt3= -0.005 khflt4= 0.03 kxflt4= -0.05 khflt5= 0.03 kxflt5= 0.05 khflt6= 0.000 kxflt6= 0.005 khflt7= -0.000 kxflt7= 0.005 khflt8= -0.03 kxflt8= 0.05 > /dev/null


# Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt.H exp="file1-file2" >xdiff.H
# Window3d min1=10150 max3=34700 < xdiff.H | Pad beg1=166 end3=137 > xdiff_cut_pad.H
# Math file1=xdiff_cut_pad.H file2=sig_02_flt_cut.H exp="file1+file2" > sig_02_flt_cutbk.H
# Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_02_flt_cutbk.H exp="file1-file2"  >multiple_model.H

# Window3d n3=200 min3=29975 n2=33 min2=-1200 < sig_flt_new.H > sig_flt_cut_new.H
# Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt_cut_new.H exp="file1-file2" >xdiff_new.H
# Window3d min1=10150 max3=34700 < xdiff_new.H | Pad beg1=166 end3=137 > xdiff_cut_pad_new.H
# Math file1=xdiff_cut_pad_new.H file2=sig_flt_cut_new.H exp="file1+file2" > sig_flt_cutbk_new.H
# Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt_cutbk_new.H exp="file1-file2"  >multiple_model_new.H

# do adaptive subtraction of the primaries to get the multiples
# 
weight.H:
	${BIN}/mute1.x cig=mig_Sis_pad_800_strati_sort.H vel=vel_sigsbee_pad.H > $@

multiple_model1.H:
	< multiple_model.H ${BIN}/mute.x > $@

mult_est_01.H:
	Transp plane=23 <mig_Sis_pad_800_strati_sort.H >junk1.H
	Transp plane=23 <multiple_model.H >junk2.H
	Transp plane=23 <weight.H | Smooth rect1=5 rect2=5 rect3=1 tridiag=1 >junk3.H
	Math file1=junk3.H file2=junk2.H exp="file1*file2" >junk4.H
	time ~claudio/Research/ResMult/Bin/Ultimatch-new-all.x < junk1.H \
		primaries_in=  multiples_in=junk4.H mu=0.001 \
		primaries_out=prim_est_01.H \
		mode=2 nsmode=2 wmode=1 nfilt=5,5 npatch=101,101 \
		op=1 niter=10 2D=1 eps=120. > $@

prim_01_subt.H:
	Math file1=junk1.H file2=mult_est_01.H exp="file1-file2" > $@

mult_est_01_cmp.H:
	time ~claudio/Research/ResMult/Bin/Ultimatch-new-all.x < mig_Sis_pad_800_strati_sort.H \
		primaries_in=  multiples_in=multiple_model1.H mu=0.001 \
		primaries_out=prim_est_01.H weight=weight.H \
		mode=2 nsmode=2 wmode=1 nfilt=7,21 npatch=33,31 \
		op=1 niter=10 2D=1 eps=0.1 > $@

mult_est_02.H:
	time ~claudio/Research/ResMult/Bin/Ultimatch-new-all.x < junk1.H \
		primaries_in=prim_01_subt.H multiples_in=junk2.H mu=0.001 \
		primaries_out=prim_est_02.H \
		mode=2 nsmode=2 wmode=1 nfilt=5,5 npatch=101,101 \
		op=2 niter=20 2D=1 eps=120. > $@


#########################################################################################################
# Window3d n3=200 min3=29975 n2=33 min2=-1200 < sig_flt_new.H > sig_flt_cut_new.H
# Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt_cut_new.H exp="file1-file2" >xdiff_new.H
# Window3d min1=10150 max3=34700 < xdiff_new.H | Pad beg1=166 end3=137 > xdiff_cut_pad_new.H
# Math file1=xdiff_cut_pad_new.H file2=sig_flt_cut_new.H exp="file1+file2" > sig_flt_cutbk_new.H
# Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt_cutbk_new.H exp="file1-file2"  >multiple_model_new.H

# do adaptive subtraction of the primaries to get the multiples
# 
multiple_model1_new.H:
	Window3d n3=200 min3=29975 n2=33 min2=-1200 < sig_flt_new.H > sig_flt_cut_new.H
	Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt_cut_new.H exp="file1-file2" >xdiff_new.H
	Window3d min1=10150 max3=34700 < xdiff_new.H | Pad beg1=166 end3=137 > xdiff_cut_pad_new.H
	Math file1=xdiff_cut_pad_new.H file2=sig_flt_cut_new.H exp="file1+file2" > sig_flt_cutbk_new.H
	Math file1=mig_Sis_pad_800_strati_sort.H file2=sig_flt_cutbk_new.H exp="file1-file2"  >multiple_model_new.H
	< multiple_model_new.H ${BIN}/mute.x > $@

mult_est_01_new.H:
	Transp plane=23 <mig_Sis_pad_800_strati_sort.H >junk1_new.H
	Transp plane=23 <multiple_model.H >junk2_new.H
	Transp plane=23 <weight.H | Smooth rect1=5 rect2=5 rect3=1 tridiag=1 >junk3_new.H
	Math file1=junk3_new.H file2=junk2_new.H exp="file1*file2" >junk4_new.H
	time ~claudio/Research/ResMult/Bin/Ultimatch-new-all.x < junk1_new.H \
		primaries_in=  multiples_in=junk4_new.H mu=0.001 \
		primaries_out=prim_est_01_new.H \
		mode=2 nsmode=2 wmode=1 nfilt=5,5 npatch=101,101 \
		op=1 niter=10 2D=1 eps=120. > $@

prim_01_subt_new.H:
	Math file1=junk1_new.H file2=mult_est_01_new.H exp="file1-file2" > $@

mult_est_01_newa.H:
	Transp plane=23 <mig_Sis_pad_800_strati_sort.H >junk1_new.H
	Transp plane=23 <multiple_model1_new.H >junk2_new.H
	Transp plane=23 <weight.H | Smooth rect1=5 rect2=5 rect3=1 tridiag=1 >junk3_new.H
	Math file1=junk3_new.H file2=junk2_new.H exp="file1*file2" >junk4_new.H
	time ~claudio/Research/ResMult/Bin/Ultimatch-new-all.x < junk1_new.H \
		primaries_in=  multiples_in=junk4_new.H mu=0.001 \
		primaries_out=prim_est_01_new.H \
		mode=2 nsmode=2 wmode=1 nfilt=5,5 npatch=101,101 \
		op=1 niter=20 2D=1 eps=120. > $@

prim_01_subt_newa.H:
	Math file1=junk1_new.H file2=mult_est_01_newa.H exp="file1-file2" > $@


mult_est_02_new.H:
	time ~claudio/Research/ResMult/Bin/Ultimatch-new-all.x < junk1_new.H \
		primaries_in=prim_01_subt_new.H multiples_in=junk2_new.H mu=0.001 \
		primaries_out=prim_est_02_new.H \
		mode=2 nsmode=2 wmode=1 nfilt=5,5 npatch=101,101 \
		op=2 niter=20 2D=1 eps=120. > $@

mig_ang.H:
	< mig_Sis_pad_800_strati.H Window3d n1=200 min1=29975 squeeze=n | Transp reshape=2,4,5 plane=13 > temp.H
	< temp.H Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=40 eps=10 maxmem=1000 > $@

flt_anga.H:
	< prim_01_subt_newa.H Transp plane=23 reshape=1,2,4,5,6 > temp.H
	< temp.H Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=40 eps=10 maxmem=1000 > $@

flt_ang.H:
	< prim_01_subt_new.H Transp plane=23 reshape=1,2,4,5,6 > temp.H
	< temp.H Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y amax=40 eps=10 maxmem=1000 > $@
#####################################################################################
inv_Sis_az11ax21_newsolver_sym_strati_off_reg_claudio.H: 
	< prim_01_subt_sort.H Window3d min1=30600 n1=121 min5=8000 n5=381  min3=-600 n3=17 squeeze=n  > ppp.H
#	< prim_01_subt_sort.H Window3d min1=30600 n1=121 min5=8000 n5=381 squeeze=n  > ppp.H
	< ppp.H Transp plane=13| Transp reshape=2,4,5,6 plane=23  > ppp1.H
	< ppp1.H  Scale scale_to=1.  > ppp3.H
	Math file1=ppp3.H exp="10.*file1" > pp3.H
	< ~valencia/research/sep124/vel_strati_pad.H Window3d  min3=8000 n1=121 min1=30600 n3=381 | Transp reshape=2,4 > ppp1.H
	Math file1=ppp1.H exp="@ABS(file1-14800)" | Scale scale_to=1. | Clip chop=greater clip=0.7 | Scale scale_to=1.| Window3d | Transp | Smooth rect1=30 rect2=30|Clip chop=less clip=.6 > ppp.H
	Math file1=ppp.H exp="file1-0.6"| Scale scale_to=1.| Transp reshape=2,4 | Pad extend=1 n1out=17 >resweigh.H
	Window3d < ~valencia/research/sep124/LtL_Sis_az21_ax21_wave_marine_strati_off_t_prec.H  min4=30600 n4=121 squeeze=n > prec.H
	< ~valencia/research/sep124/LtL_Sis_az21_ax21_wave_marine_strati_off_t.H Window3d min9=30600 n9=121 squeeze=n > LtL_Sis_az21_ax21_wave_marine_strati_off_t_w.H 
	< LtL_Sis_az21_ax21_wave_marine_strati_off_t_w.H /net/koko/homes/sep/alejandro/research/CG_new/Bin/LINUX86_64/Sparse_Mxv_inv_newsolver_sym_off.x mig=ppp3.H initial=0  niter=10 eps=0. alpha=.001 na=1 reg_off=0 beta_max=10. prec=prec.H  remov=rmov_claudio.H mmov=mmov_new_sym_reg1_claudio.H wmov=wmov.H >$@


inv_Sis_az11ax21_newsolver_sym_strati_prec_claudio.H: 
##	<prim_01_subt_sort.H  Window3d min1=30000 n1=133 min5=8000 n5=381  min3=0 n3=1 squeeze=n  > ppp.H
##	< ppp.H Transp plane=13| Transp reshape=2,4,5,6 plane=23  > ppp1.H
##	< ppp1.H  Scale scale_to=1. > p-p3.H
###   Preconditioner
##	< ~valencia/research/sep124/LtL_Sis_az21_ax21_wave_marine_strati_off_t.H Window3d min1=0 n1=1 min6=0 n6=1 squeeze=n> LtL_Sis_az21_ax21_wave_marine_strati_t.H
##	Window3d  < LtL_Sis_az21_ax21_wave_marine_strati_t.H n3=1 min3=0 n4=1 min4=0 squeeze=n | Transp reshape=5,10 > LtL_Sis_az21_ax21_wave_marine_strati_t_diag.H
##	Math file1=LtL_Sis_az21_ax21_wave_marine_strati_t_diag.H exp="1./(file1)" > LtL_Sis_az21_ax21_wave_marine_strati_t_diag_inv.H
	< LtL_Sis_az21_ax21_wave_marine_strati_t.H ~valencia/research/CG_new/Bin/LINUX86_64/Sparse_Mxv_inv_newsolver_sym.x mig=p-p3.H  prec=LtL_Sis_az21_ax21_wave_marine_strati_t_diag_inv.H  niter=20 eps=0.00 alpha=.001 na=1 reg_off=0 remov=rmov_claudio0.H mmov=mmov_new_sym_claudio.H wmov=wmov.H beta_max=10.>$@














####################################################################
#############################################
#############################################
#
# Test programs
#
source2d.H:
	${BIN}/pw_source.x theta=30 source=souincOD_centered_2ms.H xmin=0 xmax=5000 dx=10 > $@



source.H:
#	Spike n1=201 n2=1 o1=-0.05 o2=1 d1=0.0005 d2=1 k1=101 nsp=1 | Bandpass flo=10 fhi=30 >$@
#	Spike n1=201 n2=1 o1=-0.1 o2=1 d1=0.0001 d2=1 k1=101 nsp=1 | Bandpass flo=16 fhi=50 >$@
	Spike n1=501 n2=1 o1=-0.025 o2=1 d1=0.0001 d2=1 k1=251 nsp=1 | Bandpass flo=16 fhi=50 >$@

#shotinc.H
#	In /net/koko/homes/sep/claudio/Research/Off2ang
#	Fdmod intag=Velinc4.H no_stdout=1 oxs=0 dxs=10 nxs=10 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
#	cp ../../Off2ang/Shotemp41.H shotinc.H
#

#  path: ../../Off2ang
#  Window3d min1=0.1 max1=0.501 n3=1 f3=30 n2=1 f2=150 < x.H | Bandpass flo=8 fhi=42 > souindOD.H ; echo o1=-.187 >> souindOD.H
#  path: .
#  cp ../../Off2ang/souindOD.H souincOD.H
#

souinc.H:
	Window3d n3=1 n2=1 f2=400 min1=1.537 max1=1.938 < shotinc.H > $@ ; echo o1=-.200 >> $@

data.H:
#	Spike n1=1001 n2=241 o1=0. o2=-600 d1=0.0005 d2=5 n3=1 o3=0 d3=5 k1=101 nsp=1 >$@
#	Spike n1=501 n2=241 o1=0. o2=-600 d1=0.001 d2=5 n3=1 o3=0 d3=5 k1=101 nsp=1 > $@
	Spike n1=3001 n2=241 o1=0. o2=-600 d1=0.0001 d2=5 n3=1 o3=0 d3=5 k1=101 nsp=1 > $@

vel4000.H:
	Spike n2=800 n1=300 o2=-2000 o1=0 d2=5 d1=5 k1=101 nsp=1 >temp.H
	Math file1=temp.H exp="file1*0+4000" > $@

vel5000.H:
	Spike n2=10000 n1=1000 o2=-20000 o1=0 d2=10 d1=10 k1=101 nsp=1 >temp.H
	Math file1=temp.H exp="file1*0+5000" > $@

shot_ext.H: source.H
	${BIN}/rtm.x <data.H source=source.H vel=vel4000.H green=green.H nhpad=50 xmin=-850 xmax=850 > $@

shot_extsh.H: source.H
	${BIN}/rtm_shot.x <data.H source=source.H vel=vel4000.H nhpad=50 xmin=-850 xmax=850 > $@

shot_extinc.H: source.H
#	Window3d <shotinc.H n1=200 >temp.H
	${BIN}/rtm.x <shotinc.H source=souinc.H vel=vel5000.H green=green.H nhpad=100 xmin=-9500 xmax=1500 zmax=5000> $@
#	${BIN}/rtm.x <temp.H source=souinc.H vel=vel5000.H green=green.H nhpad=100 xmin=-9500 xmax=1500 zmax=8000> $@

image.H: source.H
	rm -f green.H
	Window3d <shotinc.H n1=2200 n3=1 f3=9 >temp.H
#	Window3d <shotinc.H n1=2200 n3=2 j3=8 >temp.H
	${BIN}/rtm.x <temp.H source=souinc.H vel=vel5000.H green=green.H nhpad=100 xmin=-9500 xmax=1500 zmax=5500> $@

image1.H: source.H
	rm -f green.H
#	Window3d <shotinc.H n1=2200 n3=1 f3=9 >temp.H
	Window3d <shotinc.H n1=2200 n3=2 j3=50 >temp.H
#	${BIN}/rtm.x <temp.H source=souinc.H vel=vel5000.H green=green.H nhpad=100 forward=.true. xmin=-9500 xmax=1500 zmax=5500> $@
	${BIN}/rtm.x <temp.H source=souinc.H vel=vel5000.H green=green.H green1=green1.H nhpad=100 xmin=-9500 xmax=2000 zmax=6000> $@

image2.H: source.H
	Window3d <shotinc.H n1=2200 n3=11 j3=1 >temp.H
	${BIN}/rtm.x <temp.H source=souinc.H vel=vel5000.H nhpad=100 xmin=-14500 xmax=14500 zmax=9900> $@

image3.H: source.H
#	rm -f green.H
	Window3d <shotinc.H n1=2000 n3=21 f3=49 >temp.H
	${BIN}/rtm.x <temp.H source=souinc.H vel=vel5000.H nhpad=100 xmin=-14500 xmax=14500 zmax=9900> $@

image4.H: source.H
	Window3d <temp05.H j1=2 >temp.H
	${BIN}/rtm.x <temp.H source=souincOD.H vel=vel5000.H nhpad=300 xmin=-13000 xmax=-1000 zmax=4000> $@

image5.H: source.H
	Window3d <temp05.H j1=2 >temp.H
	${BIN}/rtm.x <temp05.H source=souincOD.H vel=vel5000.H nhpad=300 xmin=-13000 xmax=-1000 zmax=4000> $@

image6.H:
	Window3d <on5ds10ns100t2b300.H max1=1.4 | Pad beg2=300 end2=600 >temp.H
	${BIN}/rtm2.x <temp.H source=souincOD_centered.H vel=vel5000.H nhpad=0 xmin=-12000 xmax=3000 zmax=7000> $@

#
# Do RTM in a smallest working space
# effectively using boundary conditions
#

bc_image.H:
	Window3d <on5ds10ns100t2b300.H max1=1.4 | Pad beg2=100 end2=20 >bc_temp.H
	${BIN}/rtm.x <bc_temp.H source=souincOD_centered.H vel=vel5000.H green=green.H nhpad=0 xmin=-10000 xmax=-3500 zmax=3000> $@

bcso_image.H:
	Window3d <on5ds10ns100t2b300.H j3=4 max1=1.4 | Pad beg2=100 end2=20 >bcso_temp.H
	${BIN}/rtm_SO.x <bcso_temp.H source=souincOD_centered.H vel=vel5000.H green=green.H vodcig= y vertcig= bcvo_image.H nsof=41 dsof=20. osof=-400. nhpad=0 xmin=-10000 xmax=-3500 zmax=3000> $@

bcso_image1.H:
	Window3d <on5ds10ns100t2b300.H j3=4 max1=1.4 | Pad beg2=100 end2=20 >bcso_temp.H
	${BIN}/rtm_SO.x <bcso_temp.H source=souincOD_centered.H vel=vel5000.H green=green.H vodcig=y vertcig=bcvo_image1.H nsof=41 dsof=20. osof=-400. nhpad=0 xmin=-10000 xmax=-3500 zmax=3000> $@

bcso_angle.H:
	Transp plane=23 < bcso_image.H | Window3d n3=1 min3=-6500 > j1.H
	../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x eps=5. niter=50 mode=2 < j1.H amax=40 amin=-40 dax=0.5 > $@

bcvo_angle.H:
	Transp plane=23 < bcvo_image.H | Window3d n3=1 min3=-6500 > j1.H
	../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x eps=5. niter=50 mode=2 < j1.H amax=40 amin=-40 dax=0.5 > $@

flat_geol.H:
	<../../Ill_ADCIG/flat/Shot100A.H Bandpass flo=6 fhi=30 |Pad beg2=50 end2=50 >flat_temp.H
	${BIN}/rtm_SO1.x <flat_temp.H source=source_flat.H vel=../../Ill_ADCIG/flat/Vel1000.H green=green.H wrec= wrec.H vodcig= y vertcig= bcvo_image.H nsof=81 dsof=10. osof=-400. nhpad=0 xmin=-6000 xmax=6000 zmax=2000> $@

flat_geol_smooth.H:
#	<../../Ill_ADCIG/flat/Shot100A.H Pad beg2=50 end2=50 >flat_temp.H
	<../../Ill_ADCIG/flat/Shot100A.H Bandpass flo=6 fhi=30 |Pad beg2=50 end2=50 >flat_temp.H
	${BIN}/rtm_SO.x <flat_temp.H source=source_flat.H vel=vel1000_smooth.H green=green_smooth.H wrec=wrec_smooth.H vodcig= y vertcig= bcvo_image.H nsof=81 dsof=10. osof=-400. nhpad=0 xmin=-6000 xmax=6000 zmax=2000> $@

flat_geol_smooth2.H:
#	<../../Ill_ADCIG/flat/Shot100A.H Pad beg2=50 end2=50 >flat_temp.H
	<../../Ill_ADCIG/flat/Shot100A.H Window3d j2=2 | Pad beg2=50 end2=50 >flat_temp.H
	<vel1000_smooth.H Window3d j2=2 >vel1000_smooth_resamp.H
	${BIN}/rtm_SO.x <flat_temp.H source=source_flat.H vel=../../Ill_ADCIG/flat/Vel1000.H _smooth_resamp.H green=green_smooth.H wrec=wrec_smooth.H vodcig= y vertcig= bcvo_image.H nsof=81 dsof=10. osof=-400. nhpad=0 xmin=-6000 xmax=6000 zmax=2000> $@

flat_angle.H:
	Transp plane=23 < flat_geol.H | Window3d n3=1 min3=-700 > j1.H
	../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x eps=25. niter=50 mode=2 < j1.H amax=60 amin=-60 dax=0.5 > $@

diag:
	Window3d <on5ds10ns100t2b300.H n3=3 max1=1.1 | Pad beg2=300 end2=600 >temp.H
	${BIN}/rtm2.x <temp.H source=souincOD_centered.H vel=vel5000.H diagnostic=y wrec=wrec.H green=green.H nhpad=0 xmin=-15000 xmax=3000 zmax=7000 > /dev/null

fdshot.H:
	Window3d <on5ds10ns100t2b300.H n3=1 max1=1.8 | Pad beg2=10 end2=10 >shotemp.H
	${BIN}/fdmod2d.x <shotemp.H source=souincOD_centered.H vel=Velinc4.H xmin=-9000 nhpad=0 xmax=-4000 zmax=4000 >$@

#############################
#
# Model: dipping 30o
# data: shot int:25m
#
dip25_0.H:
	Window3d <../../Off2ang/Shotinc5_25.H n3=1 f3=200 j1=2 max1=3| Pad beg2=200 end2=20 >dip25_temp.H
	Window3d <souincOD_centered.H j1=2 >souincOD_centered_2ms.H
	${BIN}/rtm_SO.x <dip25_temp.H source=souincOD_centered_2ms.H vel=Velinc5_25.H green=green.H nhpad=0 xmin=-12500 xmax=10000 zmax=7000 nsof= 33 dsof= 25. osof= -400.> $@

dip25a.H:
	Math file1=Velinc5_25.H exp="file1*0+5000" > vel5000.H
#	Pad extend=1 <../../Off2ang/vdip25_mig_smooth.H beg2=200 > vdip25_mig_smooth_pad.H
	Window3d <../../Off2ang/Shotinc5_25.H n3=1 j1=2 max1=3| Pad beg2=200 end2=20 >dip25_temp.H
	Window3d <souincOD_centered.H j1=2 >souincOD_centered_2ms.H
	${BIN}/rtm_SO.x <dip25_temp.H source=souincOD_centered_2ms.H vel= Velinc5_25.H wrec=wrec.H vel=vel5000.H green=green.H nhpad=0 xmin=-12500 xmax=10000 zmax=7000 nsof= 33 dsof= 25. osof= -400.> $@

dip25b.H:
#	Pad extend=1 <../../Off2ang/vdip25_mig_smooth.H beg2=200 > vdip25_mig_smooth_pad.H
	Window3d <../../Off2ang/Shotinc5_25.H n3=1 min2=-2000 n2=1 j1=2 max1=3| Pad beg2=360 end2=100 >dip25_temp.H
	Window3d <souincOD_centered.H j1=2 >souincOD_centered_2ms.H
	${BIN}/rtm_SO.x <dip25_temp.H source=souincOD_centered_2ms.H vel= Velinc5_25.H vel=vel5000.H wrec=wrecb.H green=greenb.H nhpad=0 xmin=-12500 xmax=10000 zmax=7000 nsof= 33 dsof= 25. osof= -400.> $@

dip25_adcig.H:
	Window3d j2=10 min2=-5000 max2=-2000 < dip25.H | Transp plane=23 > j1.H
	../../Off2ang/Yaxun/Bin/LINUX/off2ang_sd.x eps=5. niter=20 mode=2 < j1.H amax=60 amin=-60 dax=0.5 > $@

#############################################
Vel_hor3.H:
	Vel n1=501 n2=3001 d1=10 d2=10 o1=0 o2=-15000 n3=1 d3=1 o3=1 vc=5500 vr1=5000 vr2=4500 vr3=4000 z1=500 z2=1500 z3=3000 const1=1 const2=1 const3=1 > $@

Shot_hor3.H: 
	Fdmod intag=Vel_hor3.H no_stdout=1 oxs=0 dxs=25 nxs=1 tmax=2 bx=600 ex=600 hsfile=Shotemp_h3.H 
	Bandpass flo=10 fhi=42 < Shotemp_h3.H | Mute vmute=5300 tmute=0.5 tramp=0. > Shotemp_h31.H
	Window3d squeeze=n j1=1 < Shotemp_h31.H > $@

source_hor3.H: Vel_hor3.H
	Window3d min2=-1000 n2=1 max1=.4 < Shotemp_h3.H | Bandpass flo=10 fhi=42 > $@;echo o1=-0.182 >> $@
#	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 >> $@

hor3.H:
#	Pad extend=1 <../../Off2ang/vdip25_mig_smooth.H beg2=200 > vdip25_mig_smooth_pad.H
	<Shot_hor3.H Pad beg2=50 end2=50 > hor3_temp.H
	${BIN}/rtm_SO.x <hor3_temp.H source= source_hor3.H source=souincOD_centered_2ms.H vel= vel5000.H vel=Vel_hor3_smooth.H wrec=wrechor3.H green=greenhor3.H nhpad=0 xmin=-8000 xmax=8000 zmax=5000 nsof= 33 dsof= 25. osof= -400.> $@


#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 > $@

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

#############################################
Vel_inc3.H:
	Vel n1=1001 n2=3001 d1=10 d2=10 o1=0 o2=-15000 n3=1 d3=1 o3=1 vc=5500 vr1=5000 vr2=4500 vr3=4000 xa1=-15000 z1=0 xa2=-15000 z2=0 xa3=-15000 z3=0 alfa1=5 alfa2=15 alfa3=25 const1=1 const2=1 const3=1 > $@

Shot_inc3.H: 
#	Fdmod intag=Vel_inc3.H no_stdout=1 oxs=-6000 dxs=25 nxs=1 tmax=3 bx=600 ex=600 hsfile=Shotemp_h3.H 
	Bandpass flo=10 fhi=42 < Shotemp_h3.H | Mute vmute=5300 tmute=0.5 tramp=0. > Shotemp_h31.H
	Window3d squeeze=n j1=1 < Shotemp_h31.H > $@

source_inc3.H: Vel_hor3.H
	Window3d min2=-1000 n2=1 max1=.4 < Shotemp_h3.H | Bandpass flo=10 fhi=42 > $@;echo o1=-0.182 >> $@
#	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 >> $@

inc3.H:
#	Pad extend=1 <../../Off2ang/vdip25_mig_smooth.H beg2=200 > vdip25_mig_smooth_pad.H
	<Shot_inc3.H Pad beg2=100 end2=100 > hor3_temp.H
	${BIN}/rtm_SO.x <hor3_temp.H source= source_hor3.H source=souincOD_centered_2ms.H vel= vel5000.H vel=Vel_inc3_smooth.H wrec=wrechor3.H green=greenhor3.H nhpad=0 xmin=-15000 xmax=2000 zmax=6000 nsof= 33 dsof= 25. osof= -400.> $@


#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 > $@

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

lixo.H:
	${BIN}/rtm_SO_pw.x <hor3_temp.H source=souincOD_centered_2ms.H vel= Vel_inc3_smooth.H vel=Vel_inc3_smooth.H green=greenpw.H nhpad=0 xmin=-15000 xmax=2000 zmax=6000 nsof= 33 dsof= 25. osof= -400.> $@


###############################################
#
# Senoidal model
#
lixo:
#	Window3d max3=2.2 <../../Off2ang/SinShot.H |Pad beg2=100 end2=100 >sinsh_temp.H
#	Window3d j1=2 <../../Off2ang/Sinvel.H > Sinvel.H
#	Window3d j1=2 <../../Off2ang/Sinvel_smo_rep5_rect12_3.H >Sinvel_smo_rep5_rect123.H
#	Window3d j1=2 <../../Off2ang/Sinvel_smo_rep5_rect12_9.H >Sinvel_smo_rep5_rect129.H
#	${BIN}/rtm_SO_pw.x <sinsh_temp.H source=../../Off2ang/senshot_source.H vel=Sinvel.H green=greensinvel.H nhpad=0 xmin=-6000 xmax=16000 #zmax=4950 nsof= 33 dsof= 25. osof= -400.
#	${BIN}/rtm_SO_pw.x <sinsh_temp.H source=../../Off2ang/senshot_source.H vel=Sinvel_smo_rep5_rect123.H green=greensinvel_rep5_rec123.H nhpad=0 #xmin=-6000 xmax=16000 zmax=4950 nsof= 33 dsof= 25. osof= -400.
#	${BIN}/rtm_SO_pw.x <sinsh_temp.H source=../../Off2ang/senshot_source.H vel=Sinvel_smo_rep5_rect129.H green=greensinvel_rep5_rec129.H nhpad=0 #xmin=-6000 xmax=16000 zmax=4950 nsof= 33 dsof= 25. osof= -400.

sinsh1_mig.H:
#	Window3d n3=1 min3=8000 < ../../Off2ang/SinShot.H |Pad beg2=100 end2=100 >sinsh_temp.H
	Window3d n3=401 < ../../Off2ang/SinShot.H |Pad beg2=100 end2=100 >sinsh_temp.H
	${BIN}/rtm_SO.x < sinsh_temp.H source=../../Off2ang/senshot_source.H vel=Sinvel_smo_rep5_rect123.H green=greensinvel_rep5_rec123.H nhpad=0 xmin=-3000 xmax=17000 zmax=4950 nsof=33 dsof=25. osof=-400. > $@

sinsh0_mig.H:
	${BIN}/rtm_SO.x < sinsh_temp.H source=../../Off2ang/senshot_source.H vel=Sinvel.H green=greensinvel.H nhpad=0 xmin=-3000 xmax=17000 zmax=4950 nsof=33 dsof=25. osof=-400. > $@
########################################################
#
#
#
Velsalt.H:
	Vel n1=1001 n2=1601 d1=10 d2=10 o1=0 o2=0 n3=1 d3=1 o3=1 vc=1800 xa1=000 xa2=000 z1=1000 z2=1000 vr1=4500 vr2=2000 alfa1=0 alfa2=30  const1=1 const2=1 |Pad beg2=200 extend=1 > $@

Shotsalt.H:
	Fdmod intag=Velsalt.H no_stdout=1 oxs=2000 dxs=10 nxs=1 tmax=4 bx=0 ex=501 hsfile=Shotemp.H 
#	Fdmod intag=Velsalt.H no_stdout=1 oxs=1000 dxs=20 nxs=1 tmax=4 bx=251 ex=0 hsfile=Shotemp.H 
	Bandpass flo=8 fhi=42 < Shotemp.H | Mute vmute=1800 tmute=0.3 tramp=0. > Shotemp1.H
#	Window3d squeeze=n j1=4 < Shotemp41.H > $@

include ${SEPINC}/SEP.bottom
#include /usr/local/share/make/SEP.top
