MAKE_DEPEND=yes
include ${SEPINC}/SEP.top
include FigMakefile
include SumMakefile
include 6planeMakefile
include Int125file

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

COLOR=yes

BIN=./bin
PAR=./par
RESDIR=./Fig
R = ${RESDIR}
FIG=./Fig
DATA=./data
OBJ=./obj

RESULTER=
RESULTCR=perm01 perm02 perm03 refpl01 refpl02 refpl03 refpl04 refpl05 refpl06 refpl07 dip01 dip02 dip03 dip04 dip05 \
	dip06 dip07 dip08 dip09 comb01b comb03 comb04 cam02 cam03 cam04 cam05 # comb02
RESULTNR=pdisp cam01

ER_v = 
CR_v = perm01.v perm02.v perm03.v refpl01.v refpl02.v refpl03.v refpl04.v refpl05.v refpl06.v refpl07.v \
       dip01.v dip02.v dip03.v dip04.v dip05.v dip06.v dip07.v dip08.v dip09.v comb01b.v comb03.v comb04.v \
	cam02.v cam03.v cam04.v cam05.v  # comb02.v

ER_pdf = 
CR_pdf = perm01.pdf perm02.pdf perm03.pdf refpl01.pdf refpl02.pdf refpl03.pdf refpl04.pdf refpl05.pdf refpl06.pdf refpl06.pdf \
	dip01.pdf dip02.pdf dip03.pdf dip04.pdf dip05.pdf dip06.pdf dip07.pdf dip08.pdf dip09.pdf comb01b.pdf comb03.pdf \
	comb04.pdf cam01.pdf cam03.pdf cam04.pdf cam05.pdf  # comb02.v

NR_pdf = pdisp.pdf cam02.pdf

cr_burn: clean
er_burn: clean
er_build: ${ER_v}
cr_build: ${CR_v}
er_pdf: ${ER_pdf}
cr_pdf: ${CR_pdf}

Prst_ExpRefl=/net/server/claudio/Research/Prst_ExpRefl
PERM=/net/server/claudio/Research/Thesis/perm
Research=/net/server/claudio/Research
##############################################################
#
# marmousi
#
3000marm_vel_smooth:
	Math file1=../2Wpar/8000marmvel_24m.H exp="1/file1" > j1.H; < j1.H Window3d min2=0 max2=9000 |\
	Smooth rect1=24 rect2=8  > j2.H
	Math file1=j2.H exp="1/file1" | Transp plane=12 reshape=1,3 | Pad beg1=833 2000 end1=793 2000 extend=1 |\
	Window3d|Transp|Mute tmute=24 vmute=0 tramp=0| Clip clip=1500 chop=less to=1500 | Transp plane=12 reshape=1,3> j.H
	Math file1=j.H exp="1/@ABS(file1)" > 3000marm_vel_smooth1.H
	Math file1=../2Wpar/8000marmvel_24m.H exp="1/file1" > j1.H; < j1.H Window3d min2=0 max2=9000 | \
	Smooth rect1=48 rect2=16 > j2.H
	Math file1=j2.H exp="1/file1" | Transp plane=12 reshape=1,3 > 3000marm_vel_smooth2.H
	Math file1=3000marm_vel_smooth1.H exp="1/@ABS(file1)" | Window3d squeeze=n min1=0 max1=9000 |\
	../Tese/bin/OW_editvel_mut.x vvel=1 vsub=3000marm_vel_smooth2.H hor1=marmv0.orig > j1.H
	< j1.H ../Tese/bin/OW_editvel_mut.x vper=1 vperc=.9 hor1=marmv0.orig | Pad beg1=833 2000 end1=793 2000 extend=1 |\
	Window3d|Transp|Mute tmute=24 vmute=0 tramp=0 | Clip clip=1500 chop=less to=1500 | Transp plane=12 reshape=1,3> j.H
	Math file1=j.H exp="1/@ABS(file1)" > 3000marm_vel_smooth.ed.H

3000marmod_velsmoo_ffd:
	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H;echo o1=-1.9 >> j2.H
	<j2.H Transf f_min=2 f_min1=4 f_max1=42 f_max=48 wei=y is2d=y > j1.H; <j1.H Window3d | Cabs > j2.H
	Math file1=j2.H exp="file1*0">j1.H;Cmplx j2.H j1.H|Transp plane=13 > 11111.H
	Math file1=3000marm_vel_smooth1.H exp="1/file1" | Window3d | Transp > 3000marm_vel_smooth1.tr.H
	../ShtPSPI/bin/OWmod2d_par.x sou=11111.H vel=3000marm_vel_smooth1.tr.H \
	vreflect=../2Wpar/8000marmvel_24m.H shots=3000marmod_velsmoo_ffd.H \
	extrapolator=ffd traces_in_taper=41 padtraces=101 xmin=-9024 xmax=18400 \
	light=1 illum=3000marmod_velsmoo2_illumshot.H \
	nrec=267 orec=-3192 drec=24 nsht=376 osht=0 dsht=24 zmin=0 zmax=3000 node=16 > /dev/null

marm.comb.%:
	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H;echo o1=-1.9 >> j2.H
	<j2.H Transf f_min=2 f_min1=4 f_max1=42 f_max=48 wei=y is2d=y > j1.H; <j1.H Window3d | Cabs > j2.H
	Math file1=j2.H exp="file1*0">j1.H;Cmplx j2.H j1.H|Transp plane=13 > 11111.H
	Window3d < 3000marmod_velsmoo_ffd.H min1=0 n1=136 squeeze=n > j0.H
	./bin/OWconv_areal.x nsht=$* rec=j0.H sou=11111.H sou_pl=j1.H rec_pl=j2.H 7000marm.comb.rec.$*.H > /dev/null
	Pad beg1=200 end1=200 < j1.H > 7000marm.comb.sou.$*.H ; echo n5=1 >> 7000marm.comb.sou.$*.H
	Pad beg1=200 end1=200 < j2.H > 7000marm.comb.rec.$*.H ; echo n5=1 >> 7000marm.comb.rec.$*.H

marmig.comb.%:
	../Tese/bin/OWmig2d_areal.x sou=7000marm.comb.sou.$*.H rec=7000marm.comb.rec.$*.H vel=3000marm_vel_smooth1.H \
	bkgimg=7000marm.bkim.comb$*.H extrapolator=ffd zmin=0 zmax=3000 nh=31 oh=-360 jh=1 migration=1 areal=1 \
	padtraces=0 traces_in_taper=25 node=14

marmig.samp.%:
	Window3d < 3000marmod_velsmoo_ffd.H j4=$* min1=0 n1=136 squeeze=n > j0.H 
	../Tese/bin/OWmig2d_areal.x sou=11111.H rec=j0.H vel=3000marm_vel_smooth1.H \
	bkgimg=7000marm.bkim.samp$*.H extrapolator=ffd zmin=0 zmax=3000 nh=31 oh=-360 jh=1 migration=1 areal=0 \

##########################
#
# flat reflector
plane.crec:
	Wavelet n1=1001 d1=0.004 wavelet=ricker2 phase=0 fund=15 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=30 f_max=34 wei=y is2d=y > j1.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| Transp plane=13 > csou.H
	Spike n1=401 o1=0 d1=5 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Math file1=vel.H exp="file1*0+0.2" | Mute vmute=0 tramp=0 tmute=1200 > j.H
	Math file1=j.H exp="file1+1" |Transp plane=23 > reflect.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou.H vel=vel.H nrefvel=1 vsal=4000 \
	vreflect=reflect.H shots=s.H extrapolator=pspi \
	traces_in_taper=50 padtraces=150 xmin=-9000 xmax=9000 \
	nrec=151 orec=-750 drec=10 nsht=1 osht=-2000 dsht=10 zmin=0 zmax=1300 node=14 > /dev/null
	Cat axis=4 s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H s.H> s1.H
	Cat axis=4 s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s1.H s.H > plane.crec.H

plane.mig:
	echo o6=0 >> plane.crec.H
	Scale dscale=1 0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou.H rec=plane.crec.H \
	vel=slow.H bkgimg=plane.bslo.H \
	zmin=0 zmax=1400 nh=81 oh=-400 migration=1 areal=0 \
	padtraces=100 traces_in_taper=25 node=14 extrapolator=pspi nrefvel=1 vsal=4000

plane_perm.single:
	Wavelet n1=1001 d1=0.004 wavelet=ricker2 phase=0 fund=15 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=30 f_max=34 wei=y is2d=y > j1.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| Transp plane=13 > csou.H
	Spike n1=401 o1=0 d1=5 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	Window3d < plane.bslo.H n1=1 min1=0 squeeze=n | Pad beg1=600 end1=600 > s1.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=s1.H sou_cig=s1.H sou=csou.H vel=slow.H \
	rec_out=plane.crec.single.perm.H sou_out=plane.csou.single.perm.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=1 zmin=0 zmax=1400 node=14 shape=1 \
	> /dev/null 

plane11_perm.single:
	Spike n1=401 o1=0 d1=5 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	Window3d < plane.bslo.H min1=-2000 max1=2010 squeeze=n > s1.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=s1.H sou_cig=s1.H sou=csou.H vel=slow.H \
	rec_out=plane11.crec.single.perm.H sou_out=plane11.csou.single.perm.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=10 zmin=0 zmax=1400 node=14 \
	> /dev/null 

plane_mig.perm.single:
	echo o6=0 n5=1 >> plane.crec.single.perm.H
	echo o6=0 n5=1 >> plane.csou.single.perm.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=plane.csou.single.perm.H rec=plane.crec.single.perm.H \
	vel=slow.H bkgimg=plane.bslo.single.perm.H \
	zmin=0 zmax=1400 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

plane.perm.163:
	Wavelet n1=1001 d1=0.004 wavelet=ricker2 phase=0 fund=15 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=30 f_max=34 wei=y is2d=y > j1.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| Transp plane=13 > csou.H
	Spike n1=401 o1=0 d1=5 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	Window3d < plane.bslo.H n1=163 min1=-810 squeeze=n | Pad beg1=519 end1=519 > s1.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=s1.H sou_cig=s1.H sou=csou.H vel=slow.H \
	rec_out=plane.crec.perm.163.H sou_out=plane.csou.perm.163.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=163 zmin=0 zmax=1400 node=14 \
	> /dev/null 

plane_mig.perm.163:
	echo o6=0 n5=1 >> plane.crec.perm.163.H
	echo o6=0 n5=1 >> plane.csou.perm.163.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=plane.csou.perm.163.H rec=plane.crec.perm.163.H \
	vel=slow.H bkgimg=plane.bslo.perm.163.H \
	zmin=0 zmax=1400 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

plane_mig.perm.163.vtrue:
	echo o6=0 n5=1 >> plane.crec.perm.163.H
	echo o6=0 n5=1 >> plane.csou.perm.163.H
	< vel.H Gpow gpow=-1 | Transp plane=12 reshape=1,3 > tslow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=plane.csou.perm.163.H rec=plane.crec.perm.163.H \
	vel=tslow.H bkgimg=plane.tslo.perm.163.H \
	zmin=0 zmax=1400 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

plane.perm.single%:
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=plane.bslo.H sou_cig=plane.bslo.H sou=csou.H vel=slow.H \
	rec_out=plane.crec.single.perm$*.H sou_out=plane.csou.single.perm$*.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=1400 node=14 \
	> /dev/null 

plane.mig.perm.single%:
	echo o6=0 n5=1 >> plane.crec.single.perm$*.H
	echo o6=0 n5=1 >> plane.csou.single.perm$*.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=plane.csou.single.perm$*.H rec=plane.crec.single.perm$*.H \
	vel=slow.H bkgimg=plane.bslo.single.perm$*.H \
	zmin=0 zmax=1400 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

plane.ang:
	< plane.bslo.H Window3d min1=0 n1=1 | Transp | Pad beg2=100 end2=100 | OFF2ANG amax=40 eps=10 > j.H
	< j.H Window3d > plane.ang.H

plane_ang.perm:
	< plane.bslo.single.perm.H Window3d min1=0 n1=1 | Transp | Pad beg2=100 end2=100 | OFF2ANG amax=40 eps=10 > j.H
	< j.H Window3d > plane.ang.single.perm.H

plane.ang.perm%:
	< plane.bslo.perm.$*.H Window3d min1=0 n1=1 | Transp | Pad beg2=100 end2=100 | OFF2ANG amax=40 eps=10 > j.H
	< j.H Window3d > plane.ang.single.perm$*.H


#######################################
dip.crec:
	Wavelet n1=1001 d1=0.008 wavelet=ricker2 phase=0 fund=10 order=0.2 tdelay=4 domain=time > j2.H;echo o1=-4 >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=20 f_max=24 wei=y is2d=y > j1.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| Transp plane=13 > csou.H
	Spike n1=401 o1=0 d1=10 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Vel n1=401 o1=0 d1=10 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 vc=1000 z1=50 alfa1=20 vr1=1200 const1=1 z2=2500 alfa2=0 vr2=1400 const2=1 | \
	Pad beg2=700 end2=700 extend=1 | Transp plane=23 > dip_reflect.H
	${Prst_ExpRefl}/ShtPSPI/bin/OWmod2d_par.x sou=csou.H vel=vel.H nrefvel=1 vsal=4000 \
	vreflect=dip_reflect.H shots=dip.crec.H extrapolator=pspi \
	traces_in_taper=50 padtraces=250 xmin=-10000 xmax=10000 \
	nrec=151 orec=-750 drec=10 nsht=801 osht=-4000 dsht=10 zmin=0 zmax=2700 node=14 > /dev/null

dip.mig:
	echo o6=0 >> dip.crec.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=csou.H rec=dip.crec.H \
	vel=slow.H bkgimg=dip.bslo.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=0 \
	padtraces=100 traces_in_taper=25 node=14 extrapolator=pspi nrefvel=1 vsal=4000

dip_perm.single:
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	Window3d < dip.bslo.H n1=1 min1=0 squeeze=n | Pad beg1=600 end1=600> j0.H
	< j0.H Transp plane=13 | Mute vmute=0 tmute=2010 tramp=200 | Transp plane=13 > j1.H
	Math file1=j0.H file2=j1.H exp=file1-file2 > j2.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j1.H sou_cig=j1.H sou=csou.H vel=slow.H \
	rec_out=j0r.single.perm.H sou_out=j0s.single.perm.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=1 zmin=0 zmax=2700 node=14 \
	> /dev/null 
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j2.H sou_cig=j2.H sou=csou.H vel=slow.H \
	rec_out=j2r.single.perm.H sou_out=j2s.single.perm.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=1 zmin=0 zmax=2700 node=14 \
	> /dev/null 
	Cat j0r.single.perm.H j2r.single.perm.H axis=4 > dip.crec.single.perm.H
	Cat j0s.single.perm.H j2s.single.perm.H axis=4 > dip.csou.single.perm.H

dip_mig.perm.single:
	echo o6=0 n5=1 >> dip.crec.single.perm.H
	echo o6=0 n5=1 >> dip.csou.single.perm.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.single.perm.H rec=dip.crec.single.perm.H \
	vel=slow.H bkgimg=dip.bslo.single.perm.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

dip_mig.perm.single.vtrue:
	echo o6=0 n5=1 >> dip.crec.single.perm.H
	echo o6=0 n5=1 >> dip.csou.single.perm.H
	< vel.H Gpow gpow=-1 | Transp plane=12 reshape=1,3 > tslow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.single.perm.H rec=dip.crec.single.perm.H \
	vel=tslow.H bkgimg=dip.tslo.single.perm.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

dip.perm.163:
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	Window3d < dip.bslo.H n1=163 min1=-810 squeeze=n | Pad beg1=250 end1=250 > j0.H
	< j0.H Transp plane=13 | Mute vmute=0 tmute=1600 tramp=400 | Transp plane=13 > j1.H
	Math file1=j0.H file2=j1.H exp=file1-file2 > j2.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j1.H sou_cig=j1.H sou=csou.H vel=slow.H \
	rec_out=j0r.single.perm.H sou_out=j0s.single.perm.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=163 zmin=0 zmax=2700 node=14 \
	> /dev/null 
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j2.H sou_cig=j2.H sou=csou.H vel=slow.H \
	rec_out=j2r.single.perm.H sou_out=j2s.single.perm.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=163 zmin=0 zmax=2700 node=14 \
	> /dev/null 
	Cat j0r.single.perm.H j2r.single.perm.H axis=4 > dip.crec.perm.163.H
	Cat j0s.single.perm.H j2s.single.perm.H axis=4 > dip.csou.perm.163.H

dip_mig.perm.163:
	echo o6=0 n5=1 >> dip.crec.perm.163.H
	echo o6=0 n5=1 >> dip.csou.perm.163.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.perm.163.H rec=dip.crec.perm.163.H \
	vel=slow.H bkgimg=dip.bslo.perm.163.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

dip_mig.perm.163.vtrue:
	echo o6=0 n5=1 >> dip.crec.perm.163.H
	echo o6=0 n5=1 >> dip.csou.perm.163.H
	< vel.H Gpow gpow=-1 | Transp plane=12 reshape=1,3 > tslow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.perm.163.H rec=dip.crec.perm.163.H \
	vel=tslow.H bkgimg=dip.tslo.perm.163.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

dip.perm.single.rot:
	Spike n1=401 o1=0 d1=10 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
#	< dip.bslo.H Window3d min1=-1000 max1=1010 | Transp plane=13 | ${Prst_ExpRefl}/Tese/bin/OW_3dslant.x nax=61 nah=81 oax=-30 oah=-40 dax=1 dah=1 nxw=41 rot=1 upshft=0 nodes=14 nxchunk=1 > j2.sou.H
#	< j2.sou.H Reverse which=2 opt=ignore > j2.rec.H
	< j2.sou.H Transp plane=13 | Window3d n1=1 min1=0 squeeze=n | Pad beg1=250 end1=250 > j0s.H
	< j0s.H Transp plane=13 | Mute vmute=0 tmute=1700 tramp=100 | Transp plane=13 > j1s.H
	Math file1=j0s.H file2=j1s.H exp=file1-file2 > j2s.H
	< j2.rec.H Transp plane=13 | Window3d n1=1 min1=0 squeeze=n | Pad beg1=250 end1=250 > j0r.H
	< j0r.H Transp plane=13 | Mute vmute=0 tmute=1700 tramp=100 | Transp plane=13 > j1r.H
	Math file1=j0r.H file2=j1r.H exp=file1-file2 > j2r.H
#
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j1r.H sou_cig=j1s.H sou=csou.H vel=slow.H \
	rec_out=j0r.single.perm.rot.H sou_out=j0s.single.perm.rot.H extrapolator=pspi nrefvel=1 vsal=4000 lloyd=0 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=1 zmin=0 zmax=2700 node=14 > /dev/null 
#
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j2r.H sou_cig=j2s.H sou=csou.H vel=slow.H \
	rec_out=j2r.single.perm.rot.H sou_out=j2s.single.perm.rot.H extrapolator=pspi nrefvel=1 vsal=4000 lloyd=0 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=1 zmin=0 zmax=2700 node=14 \
	> /dev/null 
	Cat j0r.single.perm.rot.H j2r.single.perm.rot.H axis=4 > dip.crec.single.perm.rot.H
	Cat j0s.single.perm.rot.H j2s.single.perm.rot.H axis=4 > dip.csou.single.perm.rot.H

dip_mig.single.perm.vtrue.rot:
	echo o6=0 n5=1 >> dip.crec.single.perm.rot.H
	echo o6=0 n5=1 >> dip.csou.single.perm.rot.H
	< vel.H Gpow gpow=-1 | Transp plane=12 reshape=1,3 > tslow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.single.perm.rot.H rec=dip.crec.single.perm.rot.H \
	vel=tslow.H bkgimg=dip.tslo.single.perm.rot.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

dip.perm.163.rot:
	< j2.sou.H Transp plane=13 | Window3d n1=163 min1=-810 squeeze=n | Pad beg1=250 end1=250 > j0s.H
	< j0s.H Transp plane=13 | Mute vmute=0 tmute=1700 tramp=100 | Transp plane=13 > j1s.H
	Math file1=j0s.H file2=j1s.H exp=file1-file2 > j2s.H
	< j2.rec.H Transp plane=13 | Window3d n1=163 min1=-810 squeeze=n | Pad beg1=250 end1=250 > j0r.H
	< j0r.H Transp plane=13 | Mute vmute=0 tmute=1700 tramp=100 | Transp plane=13 > j1r.H
	Math file1=j0r.H file2=j1r.H exp=file1-file2 > j2r.H
#
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j1r.H sou_cig=j1s.H sou=csou.H vel=slow.H \
	rec_out=j0r.perm.163.rot.H sou_out=j0s.perm.163.rot.H extrapolator=pspi nrefvel=1 vsal=4000 lloyd=0 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=163 zmin=0 zmax=2700 \
	node=14 > /dev/null 
#
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j2r.H sou_cig=j2s.H sou=csou.H vel=slow.H \
	rec_out=j2r.perm.163.rot.H sou_out=j2s.perm.163.rot.H extrapolator=pspi nrefvel=1 vsal=4000 lloyd=0 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=163 zmin=0 zmax=2700 \
	node=14 > /dev/null 
	Cat j0r.perm.163.rot.H j2r.perm.163.rot.H axis=4 > dip.crec.perm.163.rot.H
	Cat j0s.perm.163.rot.H j2s.perm.163.rot.H axis=4 > dip.csou.perm.163.rot.H

dip_mig.perm.163.vtrue.rot:
	echo o6=0 n5=1 >> dip.crec.perm.163.rot.H
	echo o6=0 n5=1 >> dip.csou.perm.163.rot.H
	< vel.H Gpow gpow=-1 | Transp plane=12 reshape=1,3 > tslow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.perm.163.rot.H rec=dip.crec.perm.163.rot.H \
	vel=tslow.H bkgimg=dip.tslo.perm.163.rot.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

dip.perm.single%:
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=dip.bslo.H sou_cig=dip.bslo.H sou=csou.H vel=slow.H \
	rec_out=dip.crec.single.perm$*.H sou_out=dip.csou.single.perm$*.H extrapolator=pspi nrefvel=1 vsal=4000 \
	padtraces=25 traces_in_taper=50 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=1400 node=14 \
	> /dev/null 

dip.mig.perm.single%:
	echo o6=0 n5=1 >> dip.crec.single.perm$*.H
	echo o6=0 n5=1 >> dip.csou.single.perm$*.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=dip.csou.single.perm$*.H rec=dip.crec.single.perm$*.H \
	vel=slow.H bkgimg=dip.bslo.single.perm$*.H \
	zmin=0 zmax=1400 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd
##########################
#
# Combination of modeling experiments
RotK=/net/server/claudio/Research/Others/Biondo/rotation/v3/RotCig_v3.x

rot.xhzspace:
	< dip.bslo.H Window3d min1=-4000 max1=4010|Transp plane=13| ${Prst_ExpRefl}/Tese/bin/OW_3dslant.x nax=41 oax=-10 dax=1 \
	nah=81 oah=-40 dah=1 nxw=41 rot=1 upshft=0 nodes=14 nxchunk=1 > rot.sou.H
	< rot.sou.H Reverse which=2 opt=ignore > rot.rec.H

rot.kspace:
	< dip.bslo.H Window3d min1=-4000 max1=4010 | Transp plane=12 reshape=2,3 > cig.H
	${RotK} Cig_hx=cig.H Cig_tilt=comb.sou.rot.H par=comb-rot.P positive_rot=0
	< comb.sou.rot.H Reverse which=4 opt=ignore > comb.rec.rot.H

comb.perm.%.rot:
	Spike n1=401 o1=0 d1=10 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	Wavelet n1=1001 d1=0.008 wavelet=ricker2 phase=0 fund=10 order=0.2 tdelay=4 domain=time > j2.H;echo o1=-4 >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=20 f_max=24 wei=y is2d=y > j1.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| Transp plane=13 > csou.H
##
#	< rot.sou.H Transp plane=13 > j0s.H
#	< j0s.H ${Prst_ExpRefl}/Tese/bin/OW_windowing.x wavz=16 dip=0 hor1=flat1 nhorz=1 taperon=0> j1s.H
#	Math file1=j0s.H file2=j1s.H exp=file1-file2 > j2s.H
#	< j1s.H Transp plane=13 | Mute vmute=0 tmute=2200 tramp=0 | Transp plane=13 > j0s.H
#	< rot.rec.H Transp plane=13 > j0r.H
#	< j0r.H ${Prst_ExpRefl}/Tese/bin/OW_windowing.x wavz=21 dip=0 hor1=flat1 nhorz=1 taperon=0 > j1r.H
#	Math file1=j0r.H file2=j1r.H exp=file1-file2 > j2r.H
#	< j1r.H Transp plane=13 | Mute vmute=0 tmute=2200 tramp=0 | Transp plane=13 > j0r.H
#
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j0r.H sou_cig=j0s.H sou=csou.H vel=slow.H \
	rec_out=j0r.perm.$*.rot.H sou_out=j0s.perm.$*.rot.H extrapolator=pspi nrefvel=1 vsal=4000 lloyd=0 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=2700 \
	node=14 > /dev/null 
#
	${Prst_ExpRefl}/Tese/bin/OW_arealsht.x rec_cig=j2r.H sou_cig=j2s.H sou=csou.H vel=slow.H \
	rec_out=j2r.perm.$*.rot.H sou_out=j2s.perm.$*.rot.H extrapolator=pspi nrefvel=1 vsal=4000 lloyd=0 \
	padtraces=0 traces_in_taper=25 encode=1 encz=1 eps=0 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=2700 \
	node=14 > /dev/null 
	Cat j0r.perm.$*.rot.H j2r.perm.$*.rot.H axis=4 > comb.crec.perm.$*.rot.H
	Cat j0s.perm.$*.rot.H j2s.perm.$*.rot.H axis=4 > comb.csou.perm.$*.rot.H

comb_mig.perm.%.vslow:
	echo o6=0 n5=1 >> comb.crec.perm.$*.rot.H
	echo o6=0 n5=1 >> comb.csou.perm.$*.rot.H
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=comb.csou.perm.$*.rot.H rec=comb.crec.perm.$*.rot.H \
	vel=slow.H bkgimg=comb.bslo.perm.$*.rot.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd

comb_green.perm.icwind%:
	echo o6=0 n5=2 n4=163 >> comb.crec.perm.163.rot.H
	echo o6=0 n5=2 n4=163 >> comb.csou.perm.163.rot.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	< comb.csou.perm.163.rot.H Window3d n4=1 f4=81 squeeze=n | Transp plane=25|Stack3d|Transp plane=23 > s.H
	< comb.crec.perm.163.rot.H Window3d n4=1 f4=81 squeeze=n | Transp plane=25|Stack3d|Transp plane=23 > r.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=s.H rec=r.H \
	vel=slow.H bkgimg=comb_mig.perm.icwind.$*.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd icwind=1 deltat=$* dt=0.008 \
	green_S= green_S.H green_R= green_R.H 

green_SR.H:
	Math file1=green_S.H file2=green_R.H exp=file1+file2| Transf maxsize=1000 | Transp plane=13 > $@

comb_mig.perm.icwind%:
	echo o6=0 n5=2 n4=163 >> comb.crec.perm.163.rot.H
	echo o6=0 n5=2 n4=163 >> comb.csou.perm.163.rot.H
	Spike n1=401 o1=0 d1=10 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	< comb.csou.perm.163.rot.H Transp plane=25|Stack3d|Transp plane=23 reshape=1,3,4 > s.H
	< comb.crec.perm.163.rot.H Transp plane=25|Stack3d|Transp plane=23 reshape=1,3,4 > r.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=s.H rec=r.H \
	vel=slow.H bkgimg=comb_migfull.perm.icwind.$*.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd icwind=1 deltat=$* dt=0.008 \
	green_S= green_S.H green_R= green_R.H 

comb.mig:
	echo o6=0 >> dip.crec.H
	Scale dscale=0.98 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=csou.H rec=dip.crec.H \
	vel=slow.H bkgimg=comb.bslo.98.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=0 \
	padtraces=100 traces_in_taper=25 node=14 extrapolator=pspi nrefvel=1 vsal=4000


comb_mig.perm81.icwind%:
	Cp comb.crec.perm.81.rot.H cigr.H
	Cp comb.csou.perm.81.rot.H cigs.H
	echo o6=0 n5=2 n4=81 >> cigs.H
	echo o6=0 n5=2 n4=81 >> cigr.H
	Spike n1=401 o1=0 d1=10 n2=601 o2=-3000 d2=10 n3=1 o3=0 d3=1 nsp=1 k1=1 | Pad beg2=700 end2=700 > j.H
	Math file1=j.H exp="file1*0+1000" > vel.H
	Scale dscale=0.9 < vel.H | Gpow gpow=-1 | Transp plane=12 reshape=1,3 > slow.H
	< cigs.H Transp plane=25|Stack3d|Transp plane=23 reshape=1,3,4 > s.H
	< cigr.H Transp plane=25|Stack3d|Transp plane=23 reshape=1,3,4 > r.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=s.H rec=r.H \
	vel=slow.H bkgimg=comb_migfull.perm81.icwind.$*.H \
	zmin=0 zmax=2700 nh=81 oh=-400 migration=1 areal=1 \
	padtraces=25 traces_in_taper=50 node=14 extrapolator=ffd icwind=1 deltat=$* dt=0.008


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


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
