#############################################################
#
#sep136
###############################################################
0000vel2.0.H:
	Spike n1=600 n2=4000 o1=0 o2=-8 d1=0.004 d2=0.02 nsp=1 > x.H
	Math file1=x.H exp="file1*0+2." > $@

0000vel1.9.H:
	Spike n1=600 n2=4000 o1=0 o2=-8 d1=0.004 d2=0.02 nsp=1 > x.H
	Math file1=x.H exp="file1*0+1.9" > $@

0000vel2.1.H:
	Spike n1=600 n2=4000 o1=0 o2=-8 d1=0.004 d2=0.02 nsp=1 > x.H
	Math file1=x.H exp="file1*0+2.1" > $@

0001data.H:
	susynlv ref="1:0,0.5;8.,3.0" nt=2001 dt=0.002 dxs=0.02 nxs=401 fpeak=20 fxs=0 dxo=0.02 nxo=601 fxo=-6 v00=2 > junk1.su
	< junk1.su Su2sep > junk1.H
	<junk1.H Infill3d |Window3d j1=2 > $@; echo n2=601 o2=-6 d2=0.02 n3=401 o3=0 d3=0.02 >> $@
	Rm junk1.* junk2.*
	rm -f junk1.* junk2.*
#	susynlv ref="1:0,3.0;8.,3.0" nt=2001 dt=0.002 dxs=0.02 nxs=401 fpeak=20 fxs=0 dxo=0.02 nxo=601 fxo=-6 v00=2 > junk1.su
#	< junk1.su Su2sep > junk2.H
#	Math file1=junk1.H file2=junk2.H exp="file1+file2" | Infill3d |Window3d j1=2 > $@; echo n2=601 o2=-6 d2=0.02 n3=401 o3=0 d3=0.02 >> $@
#	<junk1.H Infill3d |Window3d j1=2 > $@; echo n2=601 o2=-6 d2=0.02 n3=401 o3=0 d3=0.02 >> $@
#	Rm junk1.* junk2.*
#	rm -f junk1.* junk2.*

#0001data.H:
#	susynlv ref="1:0,0.5;10.,1.5" nt=1501 dt=0.002 dxs=0.02 nxs=401 fpeak=20 fxs=0 dxo=0.02 nxo=201 fxo=-2 v00=2 > junk1.su
#	< junk1.su Su2sep > junk1.H
#	susynlv ref="1:0,1.5;10.,1.5" nt=1501 dt=0.002 dxs=0.02 nxs=401 fpeak=20 fxs=0 dxo=0.02 nxo=201 fxo=-2 v00=2 > junk1.su
#	< junk1.su Su2sep > junk2.H
#	Math file1=junk1.H file2=junk2.H exp="file1+file2" | Infill3d |Window3d j1=2 > $@; echo n2=201 o2=-2 d2=0.02 n3=401 o3=0 d3=0.02 >> $@

0002prep.H:
	< 0001data.H Pad n1out=1383 | /net/koko/bob/SEP_BOB/bin/Transf shotmig=y \
	is2d=y wei=y f_min=2 f_min1=6 f_max1=40 f_max=48 maxsize=1000 > j2.H
	< j2.H Transp reshape=1,3,5 plane=23 | Pad beg1=100 end1=100 > $@

0002prep1.H:
	< 0001data1.H Window3d min2=-5 n2=501 | Pad n1out=1383 | /net/koko/bob/SEP_BOB/bin/Transf shotmig=y \
	is2d=y wei=y f_min=2 f_min1=6 f_max1=40 f_max=48 maxsize=1000 > j2.H
	< j2.H Transp reshape=1,3,5 plane=23 | Pad beg1=200 end1=200 > $@

0003source.H:
	< 0001data.H Window3d min1=1.4 max1=1.6 n3=1 f3=96 n2=1 min2=0 > x.H; echo o1=-0.1 >> x.H
	< x.H Pad n1out=1383 | /net/koko/bob/SEP_BOB/bin/Transf shotmig=y \
	is2d=y wei=y f_min=2 f_min1=6 f_max1=40 f_max=48 maxsize=1000 > j2.H
	< j2.H Transp plane=12 reshape=4,5 | Cabs | Stack | Window3d > 0003spec.H;
	Math file1=0003spec.H exp="file1*0" > 0003phse.H; Cmplx 0003spec.H 0003phse.H |\
	Transp reshape=1,3,5 plane=23| Transp reshape=1,3,5 plane=12 > $@

0004mig_vlo.H:
	Window3d < 0002prep1.H min4=2 max4=6 squeeze=n > xxx.H
	< xxx.H ../ShtPSPI/bin/OWmig2d_par.x sou=0003source.H vel=0000vel1.9.H image=$@ \
	nrefvel=1 xmin=-4 xmax=12 noencode=0 node=14 eps=1 zmin=0 zmax=1.7 vsal=5 \
	nh=21 oh=-.2 dh=.02 wbott=0 > /dev/null
	
0005rot_vlow: 
	< 0004mig_vlo.H Window3d min1=2 max1=6.02 max3=1.3 | Transp plane=12 reshape=2,3 > 0005temp.H
	~claudio/research.ln/Others/Biondo/rotation/v3/RotCig_v3.x Cig_hx=0005temp.H Cig_tilt=0005rot_sou.H par=0005Cig_rot.P positive_rot=0
	~claudio/research.ln/Others/Biondo/rotation/v3/RotCig_v3.x Cig_hx=0005temp.H Cig_tilt=0005rot_rec.H par=0005Cig_rot.P positive_rot=1

1006gencw:
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H \
	vel=0000vel1.9.H rec_out=1008rec_goldz_vel1.9.H sou_out=1008sou_goldz_vel1.9.H OutCode= 0008Random_gold.H \
	ngap=10 nrefvel=1 node= 8 vsal=5 padtraces=41 encode=1 gold=1 encz=1 perfect=1 eps=1 injection=1 nreal=1 jshift=1 > /dev/null 

1008mig_goldz_vel1.9.H: # migration of 0006enc0 with correct velocity
	< 1008rec_goldz_vel1.9.H Transp plane=13 > 1008rec_temp.H
	< 1008sou_goldz_vel1.9.H Transp plane=13 > 1008sou_temp.H
	< 1008rec_temp.H InvVel/bin/OWmig2d_areal.x sou=1008sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.3 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node=8 > $@ 
	Rm 1008*temp.H

0006enc0: # modeling with no encoding one experiment per areal shot
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H \
	vel=0000vel1.9.H rec_out=0006rec_enc0_vel1.9.H sou_out=0006sou_enc0_vel1.9.H \
	ngap=101 nrefvel=1 vsal=6 padtraces=41 encode=0 node=12 > /dev/null 

0006mig_enc0_vel1.9.H: # migration of 0006enc0 with low velocity
	< 0006rec_enc0_vel1.9.H Transp plane=13 > 0006rec_temp.H
	< 0006sou_enc0_vel1.9.H Transp plane=13 > 0006sou_temp.H
	< 0006rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0006sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 ymin=0 ymax=0 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 every=0 encode=1 migration=1 node=12 > $@ 
	Rm 0006*temp.H

0006mig_enc0_vel2.0.H: # migration of 0006enc0 with correct velocity
	< 0006rec_enc0_vel1.9.H Transp plane=13 > 0006rec_temp.H
	< 0006sou_enc0_vel1.9.H Transp plane=13 > 0006sou_temp.H
	< 0006rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0006sou_temp.H \
	vel=0000vel2.0.H nrefvel=1 xmin=-1.22 xmax=5.2 ymin=0 ymax=0 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 every=0 encode=1 migration=1 node=12 > $@ 
	Rm 0006*temp.H

0007encz: # areal shot random encode in x,z,w
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H \
	vel=0000vel1.9.H rec_out=0007rec_encz_vel1.9.H sou_out=0007sou_encz_vel1.9.H OutCode=0007Random_conventional.H \
	ngap=10 nrefvel=1 node= 12 vsal=5 padtraces=41 encode=1 random=1 encz=1 eps=1 injection=1 nreal=4 > /dev/null 

0007mig_encz_vel1.9.H: # migration of 0006enc0 with correct velocity
	< 0007rec_encz_vel1.9.H Transp plane=13 > 0007rec_temp.H
	< 0007sou_encz_vel1.9.H Transp plane=13 > 0007sou_temp.H
	< 0007rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0007sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 12 > $@ 
	Rm 0007*temp.H

0007mig_encz_vel2.0.H: # migration of 0006enc0 with correct velocity
	< 0007rec_encz_vel1.9.H Transp plane=13 | Window3d squeeze=n n4=1 > 0007rec_temp.H
	< 0007sou_encz_vel1.9.H Transp plane=13 | Window3d squeeze=n n4=1 > 0007sou_temp.H
	< 0007rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0007sou_temp.H \
	vel=0000vel2.0.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 12 > $@ 
	Rm 0007*temp.H

0007mig_encz_vel2.1.H: # migration of 0006enc0 with correct velocity
	< 0007rec_encz_vel1.9.H Transp plane=13 | Window3d squeeze=n n4=1 > 0007rec_temp.H
	< 0007sou_encz_vel1.9.H Transp plane=13 | Window3d squeeze=n n4=1 > 0007sou_temp.H
	< 0007rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0007sou_temp.H \
	vel=0000vel2.1.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 12 > $@ 
	Rm 0007*temp.H

0008goldz: # areal shot random encode in x,z,w jgap at maximum equispaced intervals
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H \
	vel=0000vel1.9.H rec_out=0008rec_goldz_vel1.9.H sou_out=0008sou_goldz_vel1.9.H OutCode=0008Random_gold.H \
	ngap=10 nrefvel=1 node=8 vsal=5 padtraces=41 encode=1 gold=1 encz=1 perfect=1 eps=1 injection=1 nreal=4 jshift=1 > /dev/null 

0008mig_goldz_vel1.9.H: # migration of 0006enc0 with correct velocity
	< 0008rec_goldz_vel1.9.H Transp plane=13 > 0008rec_temp.H
	< 0008sou_goldz_vel1.9.H Transp plane=13 > 0008sou_temp.H
	< 0008rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0008sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node=8 > $@ 
	Rm 0007*temp.H

0008goldza: # areal shot random encode in x,z,w jgap at small equispaced intervals
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H OutCode=0008Random_golda.H \
	vel=0000vel1.9.H rec_out=0008rec_goldza_vel1.9.H sou_out=0008sou_goldza_vel1.9.H \
	ngap=10 nrefvel=1 node= 14 vsal=5 padtraces=41 encode=1 gold=1 encz=1 perfect=1 eps=1 injection=1 nreal=2 jshift=2 > /dev/null 

0008mig_goldza_vel1.9.H: # migration of 0006enc0 with correct velocity
	< 0008rec_goldza_vel1.9.H Transp plane=13 > 0008rec_temp.H
	< 0008sou_goldza_vel1.9.H Transp plane=13 > 0008sou_temp.H
	< 0008rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0008sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 14 > $@ 
	Rm 0007*temp.H

#####
0008goldza%: # areal shot random encode in x,z,w jgap at small equispaced intervals
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H OutCode=0008Random_golda.H \
	vel=0000vel1.9.H rec_out=0008rec_goldza_vel1.9.$*.H sou_out=0008sou_goldza_vel1.9.$*.H \
	ngap=10 nrefvel=1 node=12 vsal=5 padtraces=41 encode=1 gold=1 encz=1 perfect=1 fac=$* eps=1 injection=1 nreal=1 jshift=2 correlations=CORR$*.H > /dev/null 

0008mig_goldza_vel1.9.%.H: # migration of 0006enc0 with correct velocity
	< 0008rec_goldza_vel1.9.$*.H Transp plane=13 > 0008rec_temp.H
	< 0008sou_goldza_vel1.9.$*.H Transp plane=13 > 0008sou_temp.H
	< 0008rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0008sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.2 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 14 > $@ 
	Rm 0008*temp.H
#####
0008goldzb%: # areal shot random encode in x,z,w jgap chosen randomly
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H \
	vel=0000vel1.9.H rec_out=0008rec_goldzb_vel1.9.$*.H sou_out=0008sou_goldzb_vel1.9.$*.H OutCode=0008Random_goldb.H \
	ngap=10 nrefvel=1 node= 14 vsal=5 padtraces=41 encode=1 gold=1 encz=1 perfect=1 eps=1 injection=1 nreal=$* jshift=3 > /dev/null 

0008mig_goldzb_vel1.9.%.H: # migration of 0006enc0 with correct velocity
	< 0008rec_goldzb_vel1.9.$*.H Transp plane=13 > 0008rec_temp.H
	< 0008sou_goldzb_vel1.9.$*.H Transp plane=13 > 0008sou_temp.H
	< 0008rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0008sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 14 > $@ 
	Rm 0007*temp.H

0009opti: # correct velocity areal shot random encode in w
	< 0005rot_sou.H Window3d n2=100 | Transp plane=23 > 0005rot_souT.H
	< 0005rot_rec.H Window3d n2=100 | Transp plane=23 > 0005rot_recT.H
	./bin/OW_arealsht.x rec_cig=0005rot_recT.H sou_cig=0005rot_souT.H sou=0003source.H InCode=Anneal_Corr_indfreq_wide.H \
	vel=0000vel1.9.H rec_out=0009rec_optiz_vel1.9.H sou_out=0009sou_optiz_vel1.9.H \
	ngap=10 nrefvel=1 node= 14 vsal=5 padtraces=41 encode=1 encz=1 eps=1 injection=1 nreal=2 5 > /dev/null 

0009mig_opti_vel1.9.H: # correct velocity areal shot random encode in w
	< 0009rec_optiz_vel1.9.H Transp plane=13 > 0009rec_temp.H
	< 0009sou_optiz_vel1.9.H Transp plane=13 > 0009sou_temp.H
	< 0009rec_temp.H InvVel/bin/OWmig2d_areal.x sou=0009sou_temp.H \
	vel=0000vel1.9.H nrefvel=1 xmin=-1.22 xmax=5.2 zmin=0 zmax=1.7 nh=21 oh=-.20 dh=0.02 wbott=0 vsal=5 \
	traces_in_taper=41 encode=1 migration=1 node= 14 > $@ 
	Rm 0009*temp.H


#########################
# Measuring differences #
#########################

#Mute < 0006mig_enc0_vel1.9.H vmute=0 tmute=0.95 tramp=0.1 | Window3d min3=2 max3=4 > 1.H
#Mute < 0006mig_enc0_vel1.9.H vmute=0 tmute=1.22 tramp=0. | Window3d min3=2 max3=4 > 2.H
#< 0006mig_enc0_vel1.9.H Window3d min3=2 max3=4 > 3.H
#Math file1=3.H file2=1.H exp=file1-file2 > 4.H
#Math file1=2.H file2=4.H exp=file1+file2 > 5.H

0007diff_encz_vel1.9.H:
	Window3d min3=2 max3=4 < 0007mig_encz_vel1.9.H > x.H; Attr < x.H
	Attr < 5.H
	Math file1=x.H file2=5.H exp="file1/1.20551e+11*6.12106e+10-file2" > $@; Attr < $@ # peak normalization 
#	Math file1=x.H file2=y.H exp="file1/6.01487e+11*1.53473e+11-file2" > $@; Attr < $@ # rms normalization 

0008diff_goldz_vel1.9.H:
	Window3d min3=2 max3=4 < 0008mig_goldz_vel1.9.H > x.H; Attr < x.H
	Attr < 5.H
	Math file1=x.H file2=5.H exp="file1/1.23302e+11*6.12106e+10-file2" > $@; Attr < $@ # peak normalization 
#	Math file1=x.H file2=y.H exp="file1/6.01487e+11*1.53473e+11-file2" > $@; Attr < $@ # rms normalization 

0009diff_opti_vel1.9.H:
	Window3d min3=2 max3=4 < 0009mig_opti_vel1.9.H > x.H; Attr < x.H
	Attr < 5.H
	Math file1=x.H file2=5.H exp="file1/1.20204e+11*6.12106e+10-file2" > $@; Attr < $@ # peak normalization 
#	Math file1=x.H file2=y.H exp="file1/6.01487e+11*1.53473e+11-file2" > $@; Attr < $@ # rms normalization 

#
#end sep136
###############################################################
