MAKE_DEPEND=yes
include ${SEPINC}/SEP.top
UF90DEFINES=-DLINUX -DUSE_FFTW -DFFTW=1 -DSEP_OMP -DOMP # -DDBUG 
UF90INCLUDES=-I.
UF90FLAGS=-O3 -openmp -openmp_report2 -fast
FFTWLIBS=-L/opt/FFTW/lib -lfftw3f
MAINLIBS=-lsupersetf90 -lsuperset -lsepparf90 -lseppar -lsep2df90 -lsep3df90 -lsep3d -lsepf90 -lsep -lsepgeef90

VEC= -L/opt/intel/Compiler/11.1/059/mkl/lib/em64t -lmkl -lvml
UF90LIBS=-lsep2df90 -lsepparf90 -lseppar -lsupersetf90 -lsuperset ${FFTWLIBS} ${ACMLIB} ${MAINLIBS} -openmp -lpthread

########################
BIN=./bin
PAR=./par
RESDIR=./Fig
R = ${RESDIR}
FIG=./Fig
DATA=./data
OBJ=./obj
########################
Prst_ExpRefl=/net/koko/claudio/Research/Prst_ExpRefl
report=/net/koko/claudio/Research/report
########################
gauss.vel.H:
	Cp /data/trip_lens/velocityext.H gauss00.H
	Window3d < gauss00.H max1=2000 > gauss000.H
	< gauss000.H Pad beg2=1000 end2=1800 extend=1 > gauss0000.H;echo o2=-10750 >> gauss0000.H
	< gauss000.H Pad beg2=1800 end2=1000 extend=1 > gauss0001.H;echo o2=-10750 >> gauss0001.H
	Math file1=gauss0000.H file2=gauss0001.H exp="0.5+0.5*((1-file1)+file2)" | Scale dscale=3000 > gauss0002.H
	< gauss0002.H Pad end1=100 beg2=1000 end2=1000 extend=1 | Window3d j1=2 j2=2 > $@
	< gauss.vel.H Gpow gpow=-1| Transp plane=12 reshape=1,3 > gauss0temp.H; <gauss0temp.H Pad extend=1 end3=500 > gauss.slo.H
	Rm gauss0*H

gauss.bslo.H:
	Math file1=gauss.slo.H exp="file1*0+1/3000" >$@

gauss.dslo.H:
	Math file1=gauss.slo.H file2=gauss.bslo.H exp="file1-file2" > $@

gauss.shot: gauss.vel.H
	Wavelet n1=801 d1=0.006 wavelet=ricker2 phase=0 fund=25 order=0.2 tdelay=2.4 domain=time > j2.H ; echo o1=-2.4 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=50 f_max=53.2 wei=y is2d=y > j1.H; <j1.H Window3d | Cabs |Smooth rect1=7 > j2.H
	Math file1=j2.H exp="file1*0">j1.H;Math file1=j2.H exp="file1*-1">j3.H;Cmplx j3.H j1.H|\
	Transp plane=13 > csou.H
	< gauss.vel.H Mute vmute=0 tmute=2000 tramp=0 > gauss.temp.H 
	Math file1=gauss.temp.H exp="1+file1/3000" > gauss.velref.H
	Transp plane=12 reshape=1,3 < gauss.vel.H|Lloyd_vel nref=6 min_region_pct=2 niter_lloyd=120 min_slow_dev=.01 >gauss.lloyd.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou.H vel=gauss.vel.H vref=gauss.lloyd.H \
	vreflect=gauss.velref.H shots=gauss.crec.H extrapolator=pspi vsal= 4000 nrefvel= 6 \
	traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
	nrec=801 orec=-4000 drec=10 nsht=401 osht=-4000 dsht=20 zmin=0 zmax=2100 node=14 > /dev/null

gauss.bmig: gauss.bslo.H
	echo o6=0 >> gauss.crec.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou.H rec=gauss.crec.H \
	vel=gauss.bslo.H bkgimg=gauss.mig.bslo.H \
	zmin=0 zmax=2500 nh=31 oh=-150 migration=1 areal=0 \
	padtraces=200 traces_in_taper=50 node=14 extrapolator=ffd

gauss.mig: gauss.slo.H
	echo o6=0 >> gauss.crec.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou.H rec=gauss.crec.H \
	vel=gauss.slo.H bkgimg=gauss.mig.slo.H \
	zmin=0 zmax=2300 nh=41 oh=-200 migration=1 areal=0 \
	padtraces=200 traces_in_taper=50 node=14 extrapolator=ffd

gauss.dmig.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou.H rec=gauss.crec.H \
	vel=gauss.bslo.H extrapolator=ffd deltaS=gauss.dslo.H \
	zmin=0 zmax=2500 nh=31 oh=-150 jh=1 adj=0 areal=0 \
	padtraces=200 traces_in_taper=50 node=10 > $@ 


gauss.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou.H rec=gauss.crec.H \
	vel=gauss.bslo.H extrapolator=ffd deltaI=gauss.dmig.shtp.H \
	zmin=0 zmax=2500 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=200 traces_in_taper=50 node=14 > $@ 


#
#square1.slow.H:
#	${Prst_ExpRefl}/Tese/bin/OW_sqrvel.x back_vel=1 vel_pert=0.11 xcenter=-1000 zcenter=250 extentx=500 extentz=250 slow_out=$@ > /dev/null

#square2.slow.H:
#	${Prst_ExpRefl}/Tese/bin/OW_sqrvel.x back_vel=1 vel_pert=-0.091 xcenter=1000 zcenter=250 extentx=500 extentz=250 slow_out=$@ > /dev/null

square.slow.H: square1.slow.H square2.slow.H
	Math file1=square1.slow.H file2=square2.slow.H exp="(file1+file2-1)" |Scale dscale=3000 |Gpow gpow=-1 >$@
	< $@ Gpow gpow=-1|Window3d|Transp>square.vel.H

square.bslo.H: 
	Math file1=square.slow.H exp="file1*0+1/3000" >$@

square.dslo.H:
	Math file1=square.slow.H file2=square.bslo.H exp="file1-file2" > $@

square.shot: 
	Wavelet n1=801 d1=0.002 wavelet=ricker2 phase=0 fund=15 order=0.2 tdelay=0.8 domain=time > j2.H ; echo o1=-0.8 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=36 f_max=40 wei=y is2d=y > j1.H; <j1.H Window3d | Cabs |Smooth rect1=7 > j2.H
	Math file1=j2.H exp="file1*0">j1.H;Math file1=j2.H exp="file1*-1">j3.H;Cmplx j3.H j1.H|\
	Transp plane=13 > csou.H
	< square.vel.H Mute vmute=0 tmute=900 tramp=0 > square.temp.H 
	Math file1=square.temp.H exp="1+file1/3000" > square.velref.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou.H vel=square.vel.H \
	vreflect=square.velref.H shots=square.crec.H extrapolator=ffd \
	traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
	nrec=601 orec=-3000 drec=10 nsht=201 osht=-2000 dsht=20 zmin=0 zmax=1000 node=14 > /dev/null

square.bmig: 
	echo o6=0 >> square.crec.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou.H rec=square.crec.H \
	vel=square.bslo.H bkgimg=square.mig.bslo.H \
	zmin=0 zmax=1200 nh=31 oh=-150 migration=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

square.dmig.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou.H rec=square.crec.H \
	vel=square.bslo.H extrapolator=ffd deltaS=square.dslo.H \
	zmin=0 zmax=1200 nh=31 oh=-150 jh=1 adj=0 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

square.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou.H rec=square.crec.H \
	vel=square.bslo.H extrapolator=ffd deltaI=square.dmig.shtp.H \
	zmin=0 zmax=1200 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

square.dso.shtp.H:
	 < square.mig.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

square.dso.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou.H rec=square.crec.H \
	vel=square.bslo.H extrapolator=ffd deltaI=square.dso.shtp.H \
	zmin=0 zmax=1200 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 
##########################
square1.slow.H:
	${Prst_ExpRefl}/Tese/bin/OW_sqrvel.x back_vel=1 vel_pert=.25 xcenter=-2000 zcenter=250 extentx=500 extentz=250 slow_out=$@ > /dev/null

square2.slow.H:
	${Prst_ExpRefl}/Tese/bin/OW_sqrvel.x back_vel=1 vel_pert=-.1666667 xcenter=2000 zcenter=250 extentx=500 extentz=250 slow_out=$@ > /dev/null

square11.slow.H: square1.slow.H square2.slow.H
	Math file1=square1.slow.H file2=square2.slow.H exp="(file1+file2-1)" |Scale dscale=3000 |Gpow gpow=-1|Pad beg1=1000 end1=1000 extend=1 >$@
	< $@ Gpow gpow=-1|Window3d|Transp>square11.vel.H

square1.bslo.H: 
	Math file1=square11.slow.H exp="file1*0+1/3000" >$@

square1.dslo.H:
	Math file1=square11.slow.H file2=square1.bslo.H exp="file1-file2" > $@


square1.shot:
	Wavelet n1=951 d1=0.002 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=0.95 domain=time > j2.H ; echo o1=-0.95 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=26 f_max=33.4 wei=y is2d=y > j1.H; <j1.H Window3d | Cabs |Smooth rect1=7 > j2.H
	Math file1=j2.H exp="file1*0">j1.H;Math file1=j2.H exp="file1*-1">j3.H;Cmplx j3.H j1.H|\
	Transp plane=13 > csou1.H
	< square11.vel.H Mute vmute=0 tmute=900 tramp=0 > square.temp.H 
	Math file1=square.temp.H exp="1+file1/3000" > square.velref.H
	Transp plane=12 reshape=1,3 < square11.vel.H|Lloyd_vel nref=3 min_region_pct=2 niter_lloyd=120 min_slow_dev=.01 \
	>square.lloyd.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou1.H vel=square11.vel.H \
	vreflect=square.velref.H shots=square1.crec.H extrapolator=pspi lloyd=1 vref=square.lloyd.H \
	traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
	nrec=801 orec=-4000 drec=10 nsht=801 osht=-4000 dsht=10 zmin=0 zmax=1000 node=14 > /dev/null

square1.bmig: 
	echo o6=0 >> square1.crec.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou1.H rec=square1.crec.H \
	vel=square1.bslo.H bkgimg=square1.mig.bslo.H \
	zmin=0 zmax=1500 nh=51 oh=-250 migration=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

square1.dmig.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=square1.crec.H \
	vel=square1.bslo.H extrapolator=ffd deltaS=square.dslo.H \
	zmin=0 zmax=1500 nh=31 oh=-150 jh=1 adj=0 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

square1.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=square1.crec.H \
	vel=square1.bslo.H extrapolator=ffd deltaI=square1.dmig.shtp.H \
	zmin=0 zmax=1500 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

square1.dso.shtp.H:
	 < square1.mig.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

square1.dso.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=square1.crec.H \
	vel=square1.bslo.H extrapolator=ffd deltaI=square1.dso.shtp.H \
	zmin=0 zmax=1500 nh=51 oh=-250 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

#############
twin.slo.H:
	< ${report}/sep136/tang1/twin.slow.H Scale dscale=0.6666667 |Pad beg1=2000 end1=2000 extend=1 > $@

twin.velo.H:
	< twin.slo.H Window3d | Transp | Gpow gpow=-1 > $@

twin.bslo.H: 
	Math file1=twin.slo.H exp="file1*0+1/3000" >$@

twin.dslo.H:
	Math file1=twin.slo.H file2=twin.bslo.H exp="file1-file2" > $@

twin.shot%:
	Wavelet n1=2001 d1=0.0024 wavelet=ricker2 phase=0 fund=25 order=0.2 tdelay=2.4 domain=time > j2.H ; echo o1=-2.4 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=44 f_max=53.3 wei=y is2d=y  | Transp plane=35 > csou1.H
#	<j1.H Window3d | Cabs  > j2.H
#	Math file1=j2.H exp="file1*0">j1.H;Math file1=j2.H exp="file1*-1">j3.H;Cmplx j3.H j1.H|\
	< twin.velo.H Mute vmute=0 tmute=$* tramp=0 > twin.temp.H 
	Math file1=twin.temp.H exp="1+file1/3000" > twin.velref.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou1.H vel=twin.velo.H \
	vreflect=twin.velref.H shots=twin.crec$*.H extrapolator=ffd \
	traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
	nrec=801 orec=-4000 drec=10 nsht=401 osht=-4000 dsht=20 zmin=0 zmax=1600 node=14 > /dev/null

twin.bmig%: 
	echo o6=0 >> twin.crec$*.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou1.H rec=twin.crec$*.H \
	vel=twin.bslo.H bkgimg=twin.mig$*.bslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 migration=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

twin.dmig%.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=twin.crec$*.H \
	vel=twin.bslo.H extrapolator=ffd deltaS=twin.dslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=0 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

twin.grad$*.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=twin.crec$*.H \
	vel=twin.bslo.H extrapolator=ffd deltaI=twin.dmig$*.shtp.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

twin.dso_%.shtp.H:
	 < twin.mig$*.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

twin.dso%.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=twin.crec$*.H \
	vel=twin.bslo.H extrapolator=ffd deltaI=twin.dso_$*.shtp.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

twin1.velo.H:
	Math file1=twin.velo.H exp="(file1/3000-1)*6000+3000" > $@
	< $@ Transp plane=12 reshape=1,3 | Gpow gpow=-1 > twin1.slow.H

twin1.dslo.H:
	Math file1=twin1.slow.H file2=twin.bslo.H exp="file1-file2" > $@

#twin1.shot%:
#	Wavelet n1=2001 d1=0.0024 wavelet=ricker2 phase=0 fund=25 order=0.2 tdelay=2.4 domain=time > j2.H ; echo o1=-2.4 >> j2.H ;
#	< j2.H Transf f_min=0 f_min1=4 f_max1=44 f_max=53.3 wei=y is2d=y  | Transp plane=35 > csou1.H
#	< twin.velo.H Mute vmute=0 tmute=$* tramp=0 > twin.temp.H 
#	Math file1=twin.temp.H exp="1+file1/3000" > twin.velref.H
#	nohup Parallel command=${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x \
#	files="csou1.H,twin1.velo.H,twin.velref.H,twin1.crec$*.H" \
#	tags="sou,vel,vreflect,shots" usage="INPUT,INPUT,INPUT,OUTPUT" \
#	axis="3,2,2,4" file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE,COPY" nblock=401 \
#	device=eth0 pverb=2 mach_mfile=mfile \
#	extrapolator=ffd traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
#	nrec=801 orec=-4000 drec=10 nsht=401 osht=-4000 dsht=20 zmin=0 zmax=1600 node=4

twin1.shot%:
	Wavelet n1=2001 d1=0.0024 wavelet=ricker2 phase=0 fund=25 order=0.2 tdelay=2.4 domain=time > j2.H ; echo o1=-2.4 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=44 f_max=53.3 wei=y is2d=y  | Transp plane=35 > csou1.H
	< twin.velo.H Mute vmute=0 tmute=$* tramp=0 > twin.temp.H 
	Math file1=twin.temp.H exp="1+file1/3000" > twin.velref.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou1.H vel=twin1.velo.H \
	vreflect=twin.velref.H shots=twin1.crec$*.H extrapolator=ffd \
	traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
	nrec=801 orec=-4000 drec=10 nsht=401 osht=-4000 dsht=20 zmin=0 zmax=1600 node=14 > /dev/null

twin1.bmig%: 
	echo o6=0 >> twin1.crec$*.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou1.H rec=twin1.crec$*.H \
	vel=twin.bslo.H bkgimg=twin1.mig$*.bslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 migration=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

twin1.dmig%.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=twin1.crec$*.H \
	vel=twin.bslo.H extrapolator=ffd deltaS=twin1.dslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=0 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

twin1.grad$*.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=twin1.crec$*.H \
	vel=twin.bslo.H extrapolator=ffd deltaI=twin1.dmig$*.shtp.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

twin1.dso_%.shtp.H:
	 < twin1.mig$*.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

twin1.dso%.grad.shtp.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=csou1.H rec=twin1.crec$*.H \
	vel=twin.bslo.H extrapolator=ffd deltaI=twin1.dso_$*.shtp.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

#------------------------------
twin1.eps0.perm%:
	Window3d min1=-6000 max1=6010 < twin1.mig1500.bslo.H squeeze=n > rs1.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=rs1.H sou_cig=rs1.H sou=csou1.H \
	vel=twin.bslo.H rec_out=twin1.crec$*.eps0.perm.H sou_out=twin1.csou$*.eps0.perm.H extrapolator=ffd \
	padtraces=101 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=2000 node=14

twin1.eps0_.perm.bmig%: 
	echo o6=0 >> twin1.crec$*.eps0.perm.H;echo o6=0 >> twin1.csou$*.eps0.perm.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=twin1.csou$*.eps0.perm.H rec=twin1.crec$*.eps0.perm.H \
	vel=twin.bslo.H bkgimg=twin1.mig$*.eps0.perm.bslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 migration=1 areal=1 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

twin1.dso__%.eps0.perm.H:
	 < twin1.mig$*.eps0.perm.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

twin1.dso%.grad.eps0.perm.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=twin1.csou$*.eps0.perm.H rec=twin1.crec$*.eps0.perm.H \
	vel=twin.bslo.H extrapolator=ffd deltaI=twin1.dso__$*.eps0.perm.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=1 \
	padtraces=100 traces_in_taper=50 node=14 > $@ 

#----------------------------------------
twin.slovz.H:
	Math file1=${report}/sep136/tang1/twin.slow.H exp="(1/file1-2000)/1000+1" > j0.H
	Math file1=${report}/sep136/tang1/twin.slow.H exp="file1*0+1" | Window3d|Transp |Pad end1=850 extend=1|Tpow tpow=1 | \
	Window3d j1=2 n1=201 | Transp plane=12 reshape=1,3 > j1.H; echo d3=10 >> j1.H
	Math file1=j0.H file2=j1.H exp="(file2+1500)*file1" | Gpow gpow=-1 > j2.H
	Pad < j2.H beg1=1000 end1=1000 extend=1 | Scale dscale=1 2 > $@
	Math file1=j1.H exp="(file1+1500)/1" | Pad beg1=1000 end1=1000 extend=1 | Gpow gpow=-1 > twin2.bslo.H
	Window3d < $@ | Transp|Gpow gpow=-1 > twin.veloz.H

twin2.shot%:
	Wavelet n1=2001 d1=0.003 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=3 domain=time > j2.H ; echo o1=-3 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=36 f_max=42 wei=y is2d=y  | Transp plane=35 > csou1.H
	Math file1=twin.veloz.H exp="1+file1*0" | Mute vmute=0 tmute=$* tramp=0 > twin.temp.H 
	Math file1=twin.temp.H exp="1+0.5*file1" > twin.velref.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou1.H vel=twin.veloz.H \
	vreflect=twin.velref.H shots=twin2.crec$*.H extrapolator=ffd \
	traces_in_taper=100 padtraces=0 xmin=-10000 xmax=10000 \
	nrec=801 orec=-4000 drec=10 nsht=401 osht=-4000 dsht=20 zmin=0 zmax=1600 node=14 > /dev/null

twin2.bmig%:
	echo o6=0 >> twin2.crec$*.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou1.H rec=twin2.crec$*.H \
	vel=twin2.bslo.H bkgimg=twin2.mig$*.bslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 migration=1 areal=0 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

twin2.bslo2.H:
	Scale dscale=2 < twin2.bslo.H > $@

#------------------------------
twin2.eps0.perm%:
	Wavelet n1=1001 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=2 domain=time > j2.H ; echo o1=-2 >> j2.H ;
	< j2.H Transf f_min=0 f_min1=4 f_max1=36 f_max=42 wei=y is2d=y  | Transp plane=35 > csou2.H
	Window3d min1=-6000 max1=6010 < twin2.mig1500.bslo.H squeeze=n > rs1.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=rs1.H sou_cig=rs1.H sou=csou2.H \
	vel=twin2.bslo.H rec_out=twin2.crec$*.eps0.perm.H sou_out=twin2.csou$*.eps0.perm.H extrapolator=pspi nrefvel=4 vsal=10000 \
	padtraces=50 traces_in_taper=200 encode=1 encz=1 eps=1 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=2000 node=15 \
	white=.1 shaper=1 

twin2.eps0_.perm.bmig%: 
	echo o6=0 >> twin2.crec$*.eps0.perm.H;echo o6=0 >> twin2.csou$*.eps0.perm.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=twin2.csou$*.eps0.perm.H rec=twin2.crec$*.eps0.perm.H \
	vel=twin2.bslo.H bkgimg=twin2.mig$*.eps0.perm.bslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 migration=1 areal=1 \
	padtraces=100 traces_in_taper=50 node=15 extrapolator=pspi lloyd=1 nrefvel=4 vsal=10000 ffd

twin2.dso__%.eps0.perm.H:
	 < twin2.mig$*.eps0.perm.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

twin2.dso%.grad.eps0.perm.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=twin2.csou$*.eps0.perm.H rec=twin2.crec$*.eps0.perm.H \
	vel=twin2.bslo.H extrapolator=ffd deltaI=twin2.dso__$*.eps0.perm.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=1 \
	padtraces=100 traces_in_taper=50 node=14 > $@

twin2a.eps0.perm%:
	Window3d min1=-6000 max1=6010 < twin2.mig1500.bslo.H squeeze=n > rs1.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=rs1.H sou_cig=rs1.H sou=csou1.H \
	vel=twin2.bslo2.H rec_out=twin2a.crec$*.eps0.perm.H sou_out=twin2a.csou$*.eps0.perm.H extrapolator=ffd \
	padtraces=0 traces_in_taper=200 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=2000 node=14

twin2a.eps0_.perm.bmig%: 
	echo o6=0 >> twin2a.crec$*.eps0.perm.H;echo o6=0 >> twin2a.csou$*.eps0.perm.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=twin2a.csou$*.eps0.perm.H rec=twin2a.crec$*.eps0.perm.H \
	vel=twin2.bslo2.H bkgimg=twin2a.mig$*.eps0.perm.bslo.H \
	zmin=0 zmax=2000 nh=31 oh=-150 migration=1 areal=1 \
	padtraces=100 traces_in_taper=50 node=14 extrapolator=ffd

twin2a.dso__%.eps0.perm.H:
	 < twin2a.mig$*.eps0.perm.bslo.H ../../Prst_ExpRefl/Tese/bin/OW_dso.x > $@

twin2a.dso%.grad.eps0.perm.H:
	${Prst_ExpRefl}/Tese/bin/OWwemva_opers.x sou=twin2a.csou$*.eps0.perm.H rec=twin2a.crec$*.eps0.perm.H \
	vel=twin2.bslo2.H extrapolator=ffd deltaI=twin2a.dso__$*.eps0.perm.H \
	zmin=0 zmax=2000 nh=31 oh=-150 jh=1 adj=1 areal=1 \
	padtraces=0 traces_in_taper=150 node=15 > $@



regclean_%:
	@-touch $*; Rm $*; touch $*; \rm $*

clean : texclean 
	@-touch j.o j.mod j.x *.fix.f90; \rm *.o *.mod *.x *.fix.f90

include ${SEPINC}/SEP.bottom
