# SMOOTHDRTMVEL1akefile
# Decomposed RTM imaging for velocity model 1 with smooth-cut FK filter
# for vel1.H file
# SMOOTH means using smooth-cut FK filter for decomposition

# Figures
SMOOTHDRTMVEL1RESULTSER = 
SMOOTHDRTMVEL1RESULTSCR = smoothdrtm1.vel1.mult smoothdrtm1.vel1.mult.lowcut \
		    smoothdrtm1.vel1.mult.lowcut.spectrum smoothdrtm1.vel1.mult.lowcut.spectrum \
		    smoothdrtm0.vel1.mult smoothdrtm0.vel1.mult.lowcut \
		    smoothdrtm0.vel1.mult.lowcut.spectrum smoothdrtm0.vel1.mult.lowcut.spectrum \
		    smoothdrtm1.vel1.mult.FKSdown smoothdrtm1.vel1.mult.FKSup smoothdrtm1.vel1.mult.FKRdown smoothdrtm1.vel1.mult.FKRup \
		    real.smoothdrtm1.vel1.mult.vert.sumall imag.smoothdrtm1.vel1.mult.vertsum.all \
		    real.smoothdrtm1.vel1.mult.SdownRdown real.smoothdrtm1.vel1.mult.SupRup \
		    real.smoothdrtm1.vel1.mult.SdownRup real.smoothdrtm1.vel1.mult.SupRdown \
		    real.smoothdrtm1.vel1.mult.SdownRdown-plus-SupRup real.smoothdrtm1.vel1.mult.SdownRup-plus-SupRdown \
		    real.smoothdrtm1.vel1.mult.SdownRup-minus-SupRdown \
		    real.smoothdrtm1.vel1.mult.SdownRdown.lowcut real.smoothdrtm1.vel1.mult.SupRup.lowcut \
		    real.smoothdrtm1.vel1.mult.SdownRup.lowcut real.smoothdrtm1.vel1.mult.SupRdown.lowcut \
		    real.smoothdrtm1.vel1.mult.SdownRdown-plus-SupRup.lowcut real.smoothdrtm1.vel1.mult.SdownRup-plus-SupRdown.lowcut \
		    real.smoothdrtm1.vel1.mult.SdownRup-minus-SupRdown.lowcut \
		    smoothdrtm0.vel1.mult.FKSdown smoothdrtm0.vel1.mult.FKSup smoothdrtm0.vel1.mult.FKRdown smoothdrtm0.vel1.mult.FKRup \
		    real.smoothdrtm0.vel1.mult.vert.sumall imag.smoothdrtm0.vel1.mult.vert.sumall \
		    real.smoothdrtm0.vel1.mult.SdownRdown real.smoothdrtm0.vel1.mult.SupRup \
		    real.smoothdrtm0.vel1.mult.SdownRup real.smoothdrtm0.vel1.mult.SupRdown \
		    real.smoothdrtm0.vel1.mult.SdownRdown-plus-SupRup real.smoothdrtm0.vel1.mult.SdownRup-plus-SupRdown \
		    real.smoothdrtm0.vel1.mult.SdownRup-minus-SupRdown \
		    real.smoothdrtm0.vel1.mult.SdownRdown.lowcut real.smoothdrtm0.vel1.mult.SupRup.lowcut \
		    real.smoothdrtm0.vel1.mult.SdownRup.lowcut real.smoothdrtm0.vel1.mult.SupRdown.lowcut \
		    real.smoothdrtm0.vel1.mult.SdownRdown-plus-SupRup.lowcut real.smoothdrtm0.vel1.mult.SdownRup-plus-SupRdown.lowcut \
		    real.smoothdrtm0.vel1.mult.SdownRup-minus-SupRdown.lowcut \
		    smoothdrtm1.vel1.mult.FKSright smoothdrtm1.vel1.mult.FKSleft smoothdrtm1.vel1.mult.FKRright smoothdrtm1.vel1.mult.FKRleft \
		    real.smoothdrtm1.vel1.mult.horiz.sumall imag.smoothdrtm1.vel1.mult.horiz.sumall \
		    real.smoothdrtm1.vel1.mult.SrightRright real.smoothdrtm1.vel1.mult.SleftRleft \
		    real.smoothdrtm1.vel1.mult.SrightRleft real.smoothdrtm1.vel1.mult.SleftRright \
		    real.smoothdrtm1.vel1.mult.SrightRright-plus-SleftRleft real.smoothdrtm1.vel1.mult.SrightRleft-plus-SleftRright \
		    real.smoothdrtm1.vel1.mult.SrightRleft-minus-SleftRright \
		    real.smoothdrtm1.vel1.mult.SrightRright.lowcut real.smoothdrtm1.vel1.mult.SleftRleft.lowcut \
		    real.smoothdrtm1.vel1.mult.SrightRleft.lowcut real.smoothdrtm1.vel1.mult.SleftRright.lowcut \
		    real.smoothdrtm1.vel1.mult.SrightRright-plus-SleftRleft.lowcut real.smoothdrtm1.vel1.mult.SrightRleft-plus-SleftRright.lowcut \
		    real.smoothdrtm1.vel1.mult.SrightRleft-minus-SleftRright.lowcut \
		    smoothdrtm0.vel1.mult.FKSright smoothdrtm0.vel1.mult.FKSleft smoothdrtm0.vel1.mult.FKRright smoothdrtm0.vel1.mult.FKRleft \
		    real.smoothdrtm0.vel1.mult.horiz.sumall imag.smoothdrtm0.vel1.mult.horiz.sumall \
		    real.smoothdrtm0.vel1.mult.SrightRright real.smoothdrtm0.vel1.mult.SleftRleft \
		    real.smoothdrtm0.vel1.mult.SrightRleft real.smoothdrtm0.vel1.mult.SleftRright \
		    real.smoothdrtm0.vel1.mult.SrightRright-plus-SleftRleft real.smoothdrtm0.vel1.mult.SrightRleft-plus-SleftRright \
		    real.smoothdrtm0.vel1.mult.SrightRleft-minus-SleftRright \
		    real.smoothdrtm0.vel1.mult.SrightRright.lowcut real.smoothdrtm0.vel1.mult.SleftRleft.lowcut \
		    real.smoothdrtm0.vel1.mult.SrightRleft.lowcut real.smoothdrtm0.vel1.mult.SleftRright.lowcut \
		    real.smoothdrtm0.vel1.mult.SrightRright-plus-SleftRleft.lowcut real.smoothdrtm0.vel1.mult.SrightRleft-plus-SleftRright.lowcut \
		    real.smoothdrtm0.vel1.mult.SrightRleft-minus-SleftRright.lowcut
SMOOTHDRTMVEL1RESULTSNR = 
SMOOTHDRTMVEL1FIG_pdf = 


##################################
### vertical SMOOTHDRTM imaging program
##################################
# drtmout$(m).H drtmout$(m).SdownRdown.H drtmout$(m).SupRup.H drtmout$(m).SdownRup.H drtmout$(m).SupRdown.H: inputdata$(m).H velfile.H soufile.H Par/drtm0.vel.P ./Bin/crtm2d_program.x ./Bin/Fkdecomp2D_program.x ./Bin/Padntape_program.x
#       sh drtm2d-vert.sh '$(m)' 'inputdata$(m).H' 'drtmout$(m).H' 'drtmout$(m).SdownRdown.H' 'drtmout$(m).SupRup.H' 'drtmout$(m).SdownRup.H' 'drtmout$(m).SupRdown.H' 'conventional_rtm2d_program.x' 'Fkdecomp2d_program.x' 'Padntape_beforeFFT.x' 'vel.mig.H' 'soufile' 'parfile' 'jsx=4' 'tmpdir=.' 'FKSdownOUT.H' 'FKSupOUT.H' 'FKRdownOUT.H' 'FKRupOUT.H' 'getonlyrealpart' 'decompicon'
##################################
# For selecting types of decomposed RTM output:
#              getonlyrealpart = 1, default    # the output is real-valued (only real part of complex-valued output)
#              getonlyrealpart = 0             # the output is complex-valued
#
# For selecting imaging condition for decomposed RTM (must be declared):
#              decompicon = 1          # Real part is the correlation of real parts, where Imag part is the correlation of imag parts
#              decompicon = 2          # taking complex conjugate for dsouwvfld in correlation, so the Imaginary part involves the image formation
###############################
smoothdrtm%.vel1.mult.H smoothdrtm%.vel1.mult.SdownRdown.H smoothdrtm%.vel1.mult.SupRup.H smoothdrtm%.vel1.mult.SdownRup.H smoothdrtm%.vel1.mult.SupRdown.H smoothdrtm%.vel1.mult.FKSdown.H smoothdrtm%.vel1.mult.FKSup.H smoothdrtm%.vel1.mult.FKRdown.H smoothdrtm%.vel1.mult.FKRup.H: data%-vel1-mult.H vel1.mig.H sou.H $(P)/smoothdrtm.vert.vel1.P $(B)/crtm2d_program.x $(B)/Fkdecomp2d_program.x $(B)/Padntape_program.x $(SH)/drtm2d-vert.sh
	<$< Interp d2out=10 maxsize=1000 > data$*.vel1.mult.smoothvert.interp.H
	sh $(SH)/drtm2d-vert.sh '$*.vel1.mult.smoothvert' 'data$*.vel1.mult.smoothvert.interp.H' 'smoothdrtm$*.vel1.mult.H' 'smoothdrtm$*.vel1.mult.SdownRdown.H' 'smoothdrtm$*.vel1.mult.SupRup.H' 'smoothdrtm$*.vel1.mult.SdownRup.H' 'smoothdrtm$*.vel1.mult.SupRdown.H' '$(B)/crtm2d_program.x' '$(B)/Fkdecomp2d_program.x' '$(B)/Padntape_program.x' 'vel1.mig.H' 'sou.H' '$(P)/smoothdrtm.vert.vel1.P' '4' './temp' 'smoothdrtm$*.vel1.mult.FKSdown.H' 'smoothdrtm$*.vel1.mult.FKSup.H' 'smoothdrtm$*.vel1.mult.FKRdown.H' 'smoothdrtm$*.vel1.mult.FKRup.H' '0' '1'
	Rm data$*.vel1.mult.smoothvert.interp.H

#####################################
## vertically filtered wavefields in FK domain
#####################################
smoothdrtm%.vel1.mult.FKSdown.v: smoothdrtm%.vel1.mult.FKSdown.H
	<$< Window j3=50 | Grey title="Spectrum of a downgoing source wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Vertical wavenumber (/m)" $(dn) out=$(R)/$@
smoothdrtm%.vel1.mult.FKSup.v: smoothdrtm%.vel1.mult.FKSup.H
	<$< Window j3=50 | Grey title="Spectrum of an upgoing source wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Vertical wavenumber (/m)" $(dn) out=$(R)/$@
smoothdrtm%.vel1.mult.FKRdown.v: smoothdrtm%.vel1.mult.FKRdown.H
	<$< Window j3=50 | Grey title="Spectrum of a downgoing receiver wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Vertical wavenumber (/m)" $(dn) out=$(R)/$@
smoothdrtm%.vel1.mult.FKRup.v: smoothdrtm%.vel1.mult.FKRup.H
	<$< Window j3=50 | Grey title="Spectrum of an upgoing receiver wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Vertical wavenumber (/m)" $(dn) out=$(R)/$@

#####################################
## Conventional RTM images
#####################################
smoothdrtm%.vel1.mult.v: smoothdrtm%.vel1.mult.H
	<$< Grey title="A conventional RTM image from data with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

# spectrum of conventional RTM images
smoothdrtm%.vel1.mult.spectrum.v: smoothdrtm%.vel1.mult.H $B/Fftw2D_program.x
	<$< Rtoc | $B/Fftw2D_program.x flag=1 dim=2 axis1=1 axis2=1 | Cabs | Grey title="The spectrum of a conventional RTM image from data with SRM" $(Axis) label1="Kz (/m)" label2="Kx (/m)" $(dn) out=$R/$@

#####################################
## Combine all vertical SMOOTHDRTM images to be compared with the conventional RTM images
#####################################
smoothdrtm%.vel1.mult.vert.sumall.H: smoothdrtm%.vel1.mult.SdownRdown.H smoothdrtm%.vel1.mult.SupRup.H smoothdrtm%.vel1.mult.SdownRup.H smoothdrtm%.vel1.mult.SupRdown.H
	Math file1=smoothdrtm$*.vel1.mult.SdownRdown.H file2=smoothdrtm$*.vel1.mult.SupRup.H file3=smoothdrtm$*.vel1.mult.SdownRup.H file4=smoothdrtm$*.vel1.mult.SupRdown.H exp_real='file1.re+file2.re+file3.re+file4.re' exp_imag='file1.im+file2.im+file3.im+file4.im' >$@

real.smoothdrtm%.vel1.mult.vert.sumall.v: smoothdrtm%.vel1.mult.vert.sumall.H
	<$< Real | Grey title="A sum of real vertical SMOOTHDRTM images with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.vert.sumall.v: smoothdrtm%.vel1.mult.vert.sumall.H
	<$< Imag | Grey title="A sum of imag vertical SMOOTHDRTM images with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

conj.smoothdrtm%.vel1.mult.vert.sumall.v: smoothdrtm%.vel1.mult.vert.sumall.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A sum of conj vertical SMOOTHDRTM images with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H

#####################################
## vertical SMOOTHDRTM images from Re{S}*Re{R}
## i.e. using only real part
#####################################
real.smoothdrtm%.vel1.mult.SdownRdown.v: smoothdrtm%.vel1.mult.SdownRdown.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SdownRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SupRup.v: smoothdrtm%.vel1.mult.SupRup.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SupRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRup.v: smoothdrtm%.vel1.mult.SdownRup.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SdownRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SupRdown.v: smoothdrtm%.vel1.mult.SupRdown.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

#####################################
## vertical SMOOTHDRTM images from Im{S}*Im{R}
#####################################
imag.smoothdrtm%.vel1.mult.SdownRdown.v: smoothdrtm%.vel1.mult.SdownRdown.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SdownRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.SupRup.v: smoothdrtm%.vel1.mult.SupRup.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SupRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.SdownRup.v: smoothdrtm%.vel1.mult.SdownRup.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SdownRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.SupRdown.v: smoothdrtm%.vel1.mult.SupRdown.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@


########################################################################
## vertical SMOOTHDRTM images from correlation of complex-valued wavefields conj{S}*{R}
## i.e. Re{S}*Re{R} + Im{S}*Im{R}
########################################################################
conj.smoothdrtm%.vel1.mult.SdownRdown.v: smoothdrtm%.vel1.mult.SdownRdown.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SdownRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H
conj.smoothdrtm%.vel1.mult.SupRup.v: smoothdrtm%.vel1.mult.SupRup.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SupRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H
conj.smoothdrtm%.vel1.mult.SdownRup.v: smoothdrtm%.vel1.mult.SdownRup.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SdownRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H
conj.smoothdrtm%.vel1.mult.SupRdown.v: smoothdrtm%.vel1.mult.SupRdown.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H

#########################################
### vertical SMOOTHDRTM images from some combinations
#########################################
real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.H: smoothdrtm%.vel1.mult.SdownRdown.H smoothdrtm%.vel1.mult.SupRup.H
	<smoothdrtm$*.vel1.mult.SdownRdown.H Real >temp1.real$*.H
	<smoothdrtm$*.vel1.mult.SupRup.H Real >temp2.real$*.H
	Math file1=temp1.real$*.H file2=temp2.real$*.H exp='file1+file2' >$@
	Rm temp1.real$*.H temp2.real$*.H
real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.v: real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.H
	<$< Grey title="A real SMOOTHDRTM image from SdownRdown + SupRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.H: smoothdrtm%.vel1.mult.SdownRup.H smoothdrtm%.vel1.mult.SupRdown.H
	<smoothdrtm$*.vel1.mult.SdownRup.H Real >temp1.real$*.H
	<smoothdrtm$*.vel1.mult.SupRdown.H Real >temp2.real$*.H
	Math file1=temp1.real$*.H file2=temp2.real$*.H exp='file1+file2' >$@ 
	Rm temp1.real$*.H temp2.real$*.H
real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.v: real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.H
	<$< Grey title="A real SMOOTHDRTM image from SdownRup + SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.H: smoothdrtm%.vel1.mult.SdownRup.H smoothdrtm%.vel1.mult.SupRdown.H
	<smoothdrtm$*.vel1.mult.SdownRup.H Real >temp1.real$*.H
	<smoothdrtm$*.vel1.mult.SupRdown.H Real >temp2.real$*.H
	Math file1=temp1.real$*.H file2=temp2.real$*.H exp='file1-file2' >$@ 
	Rm temp1.real$*.H temp2.real$*.H
real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.v: real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.H
	<$< Grey title="A real SMOOTHDRTM image from SdownRup - SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

##################################################
##	#################################	##
##	### RTM after lowcut filtered		##
##	#################################	##
##################################################
## Conventional RTM images from data with SRM
smoothdrtm%.vel1.mult.lowcut.H: smoothdrtm%.vel1.mult.H $B/Light1.x
	<$< $B/Light1.x >$@
smoothdrtm%.vel1.mult.lowcut.v: smoothdrtm%.vel1.mult.lowcut.H
	<$< Window n3=1 f3=0 | Grey title="An lowcut-filtered RTM image from data with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

# spectrum of conventional RTM images after locut filtered
smoothdrtm%.vel1.mult.lowcut.spectrum.v: smoothdrtm%.vel1.mult.lowcut.H $B/Fftw2D_program.x
	<$< Rtoc | $B/Fftw2D_program.x flag=1 dim=2 axis1=1 axis2=1 | Cabs | Grey title="The spectrum of a lowcut-filtered RTM image from data with SRM" $(Axis) label1="Kz (/m)" label2="Kx (/m)" $(dn) out=$R/$@

#####################################
## vertical SMOOTHDRTM images from Re{S}*Re{R}
## i.e. using only real part
#####################################
real.smoothdrtm%.vel1.mult.SdownRdown.lowcut.v: smoothdrtm%.vel1.mult.SdownRdown.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SdownRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SupRup.lowcut.v: smoothdrtm%.vel1.mult.SupRup.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SupRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRup.lowcut.v: smoothdrtm%.vel1.mult.SdownRup.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SdownRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SupRdown.lowcut.v: smoothdrtm%.vel1.mult.SupRdown.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.lowcut.v: real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.H $B/Light1.x
	<$< $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SdownRdown + SupRup with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.lowcut.v: real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.H $B/Light1.x
	<$< $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SdownRup + SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.lowcut.v: real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.H $B/Light1.x
	<$< $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SdownRup - SupRdown with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

##******** Compare vertical SMOOTHDRTM here***********#

##################################################
### compare vertical SMOOTHDRTM images
##################################################
### from only real part: Re{S}*Re{R}
compare.real.smoothdrtm%.vel1.mult.vert: vel1.v smoothdrtm%.vel1.mult.v real.smoothdrtm%.vel1.mult.SdownRdown.v real.smoothdrtm%.vel1.mult.SupRup.v real.smoothdrtm%.vel1.mult.SdownRup.v real.smoothdrtm%.vel1.mult.SupRdown.v real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.v real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.v real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/real.smoothdrtm$*.vel1.mult.SdownRdown.v $R/real.smoothdrtm$*.vel1.mult.SupRup.v $R/real.smoothdrtm$*.vel1.mult.SdownRup.v $R/real.smoothdrtm$*.vel1.mult.SupRdown.v $R/real.smoothdrtm$*.vel1.mult.SdownRdown-plus-SupRup.v $R/real.smoothdrtm$*.vel1.mult.SdownRup-plus-SupRdown.v $R/real.smoothdrtm$*.vel1.mult.SdownRup-minus-SupRdown.v &

### from correlation of complex-valued wavefields: conj{S}*{R}
compare.conj.smoothdrtm%.vel1.mult.vert: vel1.v smoothdrtm%.vel1.mult.v conj.smoothdrtm%.vel1.mult.SdownRdown.v conj.smoothdrtm%.vel1.mult.SupRup.v conj.smoothdrtm%.vel1.mult.SdownRup.v conj.smoothdrtm%.vel1.mult.SupRdown.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/conj.smoothdrtm$*.vel1.mult.SdownRdown.v $R/conj.smoothdrtm$*.vel1.mult.SupRup.v $R/conj.smoothdrtm$*.vel1.mult.SdownRup.v $R/conj.smoothdrtm$*.vel1.mult.SupRdown.v &

### compare the conventional RTM image with the summing results of all DRTM images
compare.sumall.smoothdrtm%.vel1.mult.vert: vel1.v smoothdrtm%.vel1.mult.v real.smoothdrtm%.vel1.mult.vert.sumall.v imag.smoothdrtm%.vel1.mult.vert.sumall.v conj.smoothdrtm%.vel1.mult.vert.sumall.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/real.smoothdrtm$*.vel1.mult.vert.sumall.v $R/imag.smoothdrtm$*.vel1.mult.vert.sumall.v $R/conj.smoothdrtm$*.vel1.mult.vert.sumall.v &


##################################################
### compare vertical SMOOTHDRTM images after lowcut filtered
##################################################
### from only real part: Re{S}*Re{R}
compare.real.smoothdrtm%.vel1.mult.vert.lowcut: vel1.v smoothdrtm%.vel1.mult.lowcut.v real.smoothdrtm%.vel1.mult.SdownRdown.lowcut.v real.smoothdrtm%.vel1.mult.SupRup.lowcut.v real.smoothdrtm%.vel1.mult.SdownRup.lowcut.v real.smoothdrtm%.vel1.mult.SupRdown.lowcut.v real.smoothdrtm%.vel1.mult.SdownRdown-plus-SupRup.lowcut.v real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.lowcut.v real.smoothdrtm%.vel1.mult.SdownRup-minus-SupRdown.lowcut.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SdownRdown.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SupRup.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SdownRup.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SupRdown.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SdownRdown-plus-SupRup.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SdownRup-plus-SupRdown.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SdownRup-minus-SupRdown.lowcut.v &

### compare before and after applying lowcut filter to conventional RTM images
compare.spectrum.smoothdrtm%.vel1.mult.lowcut: smoothdrtm%.vel1.mult.spectrum.v smoothdrtm%.vel1.mult.lowcut.spectrum.v
	tube $R/smoothdrtm$*.vel1.mult.spectrum.v $R/smoothdrtm$*.vel1.mult.lowcut.spectrum.v &


###########################################################################################
##***************************************************************************************##
## Below is commands for HORIZONTAL SMOOTHDRTM images
##***************************************************************************************##
###########################################################################################

##################################
### Horizontal SMOOTHDRTM imaging program
##################################
# drtmout$(m).H drtmout$(m).SrightRright.H drtmout$(m).SleftRleft.H drtmout$(m).SrightRleft.H drtmout$(m).SleftRright.H: inputdata$(m).H velfile.H soufile.H Par/drtm0.vel.P ./Bin/crtm2d_program.x ./Bin/Fkdecomp2D_program.x ./Bin/Padntape_program.x
#       sh drtm2d-horiz.sh '$(m)' 'inputdata$(m).H' 'drtmout$(m).H' 'drtmout$(m).SrightRright.H' 'drtmout$(m).SleftRleft.H' 'drtmout$(m).SrightRleft.H' 'drtmout$(m).SleftRright.H' 'conventional_rtm2d_program.x' 'Fkdecomp2d_program.x' 'Padntape_beforeFFT.x' 'vel.mig.H' 'soufile' 'parfile' 'jsx=4' 'tmpdir=.' 'FKSrightOUT.H' 'FKSleftOUT.H' 'FKRrightOUT.H' 'FKRleftOUT.H' 'getonlyrealpart' 'decompicon'
##################################
# For selecting types of decomposed RTM output:
#              getonlyrealpart = 1, default    # the output is real-valued (only real part of complex-valued output)
#              getonlyrealpart = 0             # the output is complex-valued
#
# For selecting imaging condition for decomposed RTM (must be declared):
#              decompicon = 1          # Real part is the correlation of real parts, where Imag part is the correlation of imag parts
#              decompicon = 2          # taking complex conjugate for dsouwvfld in correlation, so the Imaginary part involves the image formation
###############################
smoothdrtm%.vel1.mult.SrightRright.H smoothdrtm%.vel1.mult.SleftRleft.H smoothdrtm%.vel1.mult.SrightRleft.H smoothdrtm%.vel1.mult.SleftRright.H smoothdrtm%.vel1.mult.FKSright.H smoothdrtm%.vel1.mult.FKSleft.H smoothdrtm%.vel1.mult.FKRright.H smoothdrtm%.vel1.mult.FKRleft.H: data%-vel1-mult.H vel1.mig.H sou.H $(P)/smoothdrtm.horiz.vel1.P $(B)/crtm2d_program.x $(B)/Fkdecomp2d_program.x $(B)/Padntape_program.x $(SH)/drtm2d-horiz.sh
	<$< Interp d2out=10 maxsize=1000 > data$*.vel1.mult.smoothhoriz.interp.H
	sh $(SH)/drtm2d-horiz.sh '$*.vel1.mult.smoothhoriz' 'data$*.vel1.mult.smoothhoriz.interp.H' '/dev/null' 'smoothdrtm$*.vel1.mult.SrightRright.H' 'smoothdrtm$*.vel1.mult.SleftRleft.H' 'smoothdrtm$*.vel1.mult.SrightRleft.H' 'smoothdrtm$*.vel1.mult.SleftRright.H' '$(B)/crtm2d_program.x' '$(B)/Fkdecomp2d_program.x' '$(B)/Padntape_program.x' 'vel1.mig.H' 'sou.H' '$(P)/smoothdrtm.horiz.vel1.P' '4' './temp' 'smoothdrtm$*.vel1.mult.FKSright.H' 'smoothdrtm$*.vel1.mult.FKSleft.H' 'smoothdrtm$*.vel1.mult.FKRright.H' 'smoothdrtm$*.vel1.mult.FKRleft.H' '0' '1'
	Rm data$*.vel1.mult.smoothhoriz.interp.H

#####################################
## horizontally filtered wavefields in FK domain
#####################################
smoothdrtm%.vel1.mult.FKSright.v: smoothdrtm%.vel1.mult.FKSright.H
	<$< Window j3=50 | Grey title="Spectrum of a rightgoing source wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Horizontal wavenumber (/m)" $(dn) out=$(R)/$@
smoothdrtm%.vel1.mult.FKSleft.v: smoothdrtm%.vel1.mult.FKSleft.H
	<$< Window j3=50 | Grey title="Spectrum of an leftgoing source wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Horizontal wavenumber (/m)" $(dn) out=$(R)/$@
smoothdrtm%.vel1.mult.FKRright.v: smoothdrtm%.vel1.mult.FKRright.H
	<$< Window j3=50 | Grey title="Spectrum of a rightgoing receiver wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Horizontal wavenumber (/m)" $(dn) out=$(R)/$@
smoothdrtm%.vel1.mult.FKRleft.v: smoothdrtm%.vel1.mult.FKRleft.H
	<$< Window j3=50 | Grey title="Spectrum of an leftgoing receiver wavefield" $(Axis) yreverse=n label1="Frequency (Hz)" label2="Horizontal wavenumber (/m)" $(dn) out=$(R)/$@

#####################################
## Combine all horizontal SMOOTHDRTM images to be compared with the conventional RTM images
#####################################
smoothdrtm%.vel1.mult.horiz.sumall.H: smoothdrtm%.vel1.mult.SrightRright.H smoothdrtm%.vel1.mult.SleftRleft.H smoothdrtm%.vel1.mult.SrightRleft.H smoothdrtm%.vel1.mult.SleftRright.H
	Math file1=smoothdrtm$*.vel1.mult.SrightRright.H file2=smoothdrtm$*.vel1.mult.SleftRleft.H file3=smoothdrtm$*.vel1.mult.SrightRleft.H file4=smoothdrtm$*.vel1.mult.SleftRright.H exp_real='file1.re+file2.re+file3.re+file4.re' exp_imag='file1.im+file2.im+file3.im+file4.im' >$@

real.smoothdrtm%.vel1.mult.horiz.sumall.v: smoothdrtm%.vel1.mult.horiz.sumall.H
	<$< Real | Grey title="A sum of real horizontal SMOOTHDRTM images with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.horiz.sumall.v: smoothdrtm%.vel1.mult.horiz.sumall.H
	<$< Imag | Grey title="A sum of imag horizontal SMOOTHDRTM images with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

conj.smoothdrtm%.vel1.mult.horiz.sumall.v: smoothdrtm%.vel1.mult.horiz.sumall.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A sum of conj horizontal SMOOTHDRTM images with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H

#####################################
## horizontal SMOOTHDRTM images from Re{S}*Re{R}
## i.e. using only real part
#####################################
real.smoothdrtm%.vel1.mult.SrightRright.v: smoothdrtm%.vel1.mult.SrightRright.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SrightRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SleftRleft.v: smoothdrtm%.vel1.mult.SleftRleft.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SleftRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRleft.v: smoothdrtm%.vel1.mult.SrightRleft.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SrightRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SleftRright.v: smoothdrtm%.vel1.mult.SleftRright.H
	<$< Real | Grey title="A real SMOOTHDRTM image from SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

#####################################
## horizontal SMOOTHDRTM images from Im{S}*Im{R}
#####################################
imag.smoothdrtm%.vel1.mult.SrightRright.v: smoothdrtm%.vel1.mult.SrightRright.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SrightRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.SleftRleft.v: smoothdrtm%.vel1.mult.SleftRleft.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SleftRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.SrightRleft.v: smoothdrtm%.vel1.mult.SrightRleft.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SrightRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

imag.smoothdrtm%.vel1.mult.SleftRright.v: smoothdrtm%.vel1.mult.SleftRright.H
	<$< Imag | Grey title="An imag SMOOTHDRTM image from SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@


########################################################################
## horizontal SMOOTHDRTM images from correlation of complex-valued wavefields conj{S}*{R}
## i.e. Re{S}*Re{R} + Im{S}*Im{R}
########################################################################
conj.smoothdrtm%.vel1.mult.SrightRright.v: smoothdrtm%.vel1.mult.SrightRright.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SrightRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H
conj.smoothdrtm%.vel1.mult.SleftRleft.v: smoothdrtm%.vel1.mult.SleftRleft.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SleftRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H
conj.smoothdrtm%.vel1.mult.SrightRleft.v: smoothdrtm%.vel1.mult.SrightRleft.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SrightRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H
conj.smoothdrtm%.vel1.mult.SleftRright.v: smoothdrtm%.vel1.mult.SleftRright.H
	<$< Real >temp.real$*.H
	<$< Imag >temp.imag$*.H
	Math file1=temp.real$*.H file2=temp.imag$*.H exp='file1+file2' | Grey title="A conj SMOOTHDRTM image from SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@
	Rm temp.real$*.H temp.imag$*.H

#########################################
### horizontal SMOOTHDRTM images from some combinations
#########################################
real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.H: smoothdrtm%.vel1.mult.SrightRright.H smoothdrtm%.vel1.mult.SleftRleft.H
	<smoothdrtm$*.vel1.mult.SrightRright.H Real >temp1.real$*.H
	<smoothdrtm$*.vel1.mult.SleftRleft.H Real >temp2.real$*.H
	Math file1=temp1.real$*.H file2=temp2.real$*.H exp='file1+file2' >$@
	Rm temp1.real$*.H temp2.real$*.H
real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.v: real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.H
	<$< Grey title="A real SMOOTHDRTM image from SrightRright + SleftRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.H: smoothdrtm%.vel1.mult.SrightRleft.H smoothdrtm%.vel1.mult.SleftRright.H
	<smoothdrtm$*.vel1.mult.SrightRleft.H Real >temp1.real$*.H
	<smoothdrtm$*.vel1.mult.SleftRright.H Real >temp2.real$*.H
	Math file1=temp1.real$*.H file2=temp2.real$*.H exp='file1+file2' >$@ 
	Rm temp1.real$*.H temp2.real$*.H
real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.v: real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.H
	<$< Grey title="A real SMOOTHDRTM image from SrightRleft + SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.H: smoothdrtm%.vel1.mult.SrightRleft.H smoothdrtm%.vel1.mult.SleftRright.H
	<smoothdrtm$*.vel1.mult.SrightRleft.H Real >temp1.real$*.H
	<smoothdrtm$*.vel1.mult.SleftRright.H Real >temp2.real$*.H
	Math file1=temp1.real$*.H file2=temp2.real$*.H exp='file1-file2' >$@ 
	Rm temp1.real$*.H temp2.real$*.H
real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.v: real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.H
	<$< Grey title="A real SMOOTHDRTM image from SrightRleft - SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@


##################################################
##	#################################	##
##	### RTM after lowcut filtered		##
##	#################################	##
##################################################
## Conventional RTM images from data with SRM
smoothdrtm%.vel1.mult.lowcut.H: smoothdrtm%.vel1.mult.H $B/Light1.x
	<$< $B/Light1.x >$@
smoothdrtm%.vel1.mult.lowcut.v: smoothdrtm%.vel1.mult.lowcut.H
	<$< Window n3=1 f3=0 | Grey title="An lowcut-filtered RTM image from data with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

#####################################
## horizontal SMOOTHDRTM images from Re{S}*Re{R}
## i.e. using only real part
#####################################
real.smoothdrtm%.vel1.mult.SrightRright.lowcut.v: smoothdrtm%.vel1.mult.SrightRright.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SrightRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SleftRleft.lowcut.v: smoothdrtm%.vel1.mult.SleftRleft.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SleftRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRleft.lowcut.v: smoothdrtm%.vel1.mult.SrightRleft.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SrightRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SleftRright.lowcut.v: smoothdrtm%.vel1.mult.SleftRright.H $B/Light1.x
	<$< Real | $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.lowcut.v: real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.H $B/Light1.x
	<$< $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SrightRright + SleftRleft with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.lowcut.v: real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.H $B/Light1.x
	<$< $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SrightRleft + SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.lowcut.v: real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.H $B/Light1.x
	<$< $B/Light1.x | Window n3=1 f3=0 | Grey title="A lowcut real SMOOTHDRTM image from SrightRleft - SleftRright with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@


##******** Compare horizontal SMOOTHDRTM here***********#
##################################################
### compare horizontal SMOOTHDRTM images
##################################################
### from only real part: Re{S}*Re{R}
compare.real.smoothdrtm%.vel1.mult.horiz: vel1.v smoothdrtm%.vel1.mult.v real.smoothdrtm%.vel1.mult.SrightRright.v real.smoothdrtm%.vel1.mult.SleftRleft.v real.smoothdrtm%.vel1.mult.SrightRleft.v real.smoothdrtm%.vel1.mult.SleftRright.v real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.v real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.v real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/real.smoothdrtm$*.vel1.mult.SrightRright.v $R/real.smoothdrtm$*.vel1.mult.SleftRleft.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft.v $R/real.smoothdrtm$*.vel1.mult.SleftRright.v $R/real.smoothdrtm$*.vel1.mult.SrightRright-plus-SleftRleft.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft-plus-SleftRright.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft-minus-SleftRright.v &

### from correlation of complex-valued wavefields: conj{S}*{R}
compare.conj.smoothdrtm%.vel1.mult.horiz: vel1.v smoothdrtm%.vel1.mult.v conj.smoothdrtm%.vel1.mult.SrightRright.v conj.smoothdrtm%.vel1.mult.SleftRleft.v conj.smoothdrtm%.vel1.mult.SrightRleft.v conj.smoothdrtm%.vel1.mult.SleftRright.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/conj.smoothdrtm$*.vel1.mult.SrightRright.v $R/conj.smoothdrtm$*.vel1.mult.SleftRleft.v $R/conj.smoothdrtm$*.vel1.mult.SrightRleft.v $R/conj.smoothdrtm$*.vel1.mult.SleftRright.v &

### compare the conventional RTM image with the summing results of all DRTM images
compare.sumall.smoothdrtm%.vel1.mult.horiz: vel1.v smoothdrtm%.vel1.mult.v real.smoothdrtm%.vel1.mult.horiz.sumall.v imag.smoothdrtm%.vel1.mult.horiz.sumall.v conj.smoothdrtm%.vel1.mult.horiz.sumall.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/real.smoothdrtm$*.vel1.mult.horiz.sumall.v $R/imag.smoothdrtm$*.vel1.mult.horiz.sumall.v $R/conj.smoothdrtm$*.vel1.mult.horiz.sumall.v &

##################################################
### compare horizontal SMOOTHDRTM images after lowcut filtered
##################################################
### from only real part: Re{S}*Re{R}
compare.real.smoothdrtm%.vel1.mult.horiz.lowcut: vel1.v smoothdrtm%.vel1.mult.lowcut.v real.smoothdrtm%.vel1.mult.SrightRright.lowcut.v real.smoothdrtm%.vel1.mult.SleftRleft.lowcut.v real.smoothdrtm%.vel1.mult.SrightRleft.lowcut.v real.smoothdrtm%.vel1.mult.SleftRright.lowcut.v real.smoothdrtm%.vel1.mult.SrightRright-plus-SleftRleft.lowcut.v real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.lowcut.v real.smoothdrtm%.vel1.mult.SrightRleft-minus-SleftRright.lowcut.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SrightRright.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SleftRleft.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SleftRright.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SrightRright-plus-SleftRleft.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft-plus-SleftRright.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft-minus-SleftRright.lowcut.v &






#########################################
### combination of vertical and horizontal SMOOTHDRTM images
#########################################
#########
## for data with SRM
real.smoothdrtm%.vel1.mult.vert-plus-horiz.H: real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.H real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.H
	Math file1=real.smoothdrtm$*.vel1.mult.SdownRup-plus-SupRdown.H file2=real.smoothdrtm$*.vel1.mult.SrightRleft-plus-SleftRright.H exp='file1+file2' >$@
real.smoothdrtm%.vel1.mult.vert-plus-horiz.v: real.smoothdrtm%.vel1.mult.vert-plus-horiz.H
	<$< Grey title="A real SMOOTHDRTM image from vert-plus-horiz with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.mult.vert-minus-horiz.H: real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.H real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.H
	Math file1=real.smoothdrtm$*.vel1.mult.SdownRup-plus-SupRdown.H file2=real.smoothdrtm$*.vel1.mult.SrightRleft-plus-SleftRright.H exp='file1-file2' >$@
real.smoothdrtm%.vel1.mult.vert-minus-horiz.v: real.smoothdrtm%.vel1.mult.vert-minus-horiz.H
	<$< Grey title="A real SMOOTHDRTM image from vert-minus-horiz with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

compare.real.smoothdrtm%.vel1.mult.vert-plus-horiz: vel1.v smoothdrtm%.vel1.mult.v smoothdrtm%.vel1.mult.lowcut.v real.smoothdrtm%.vel1.mult.SdownRup-plus-SupRdown.v real.smoothdrtm%.vel1.mult.SrightRleft-plus-SleftRright.v real.smoothdrtm%.vel1.mult.vert-plus-horiz.v real.smoothdrtm%.vel1.mult.vert-minus-horiz.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.mult.v $R/smoothdrtm$*.vel1.mult.lowcut.v $R/real.smoothdrtm$*.vel1.mult.SdownRup-plus-SupRdown.v $R/real.smoothdrtm$*.vel1.mult.SrightRleft-plus-SleftRright.v $R/real.smoothdrtm$*.vel1.mult.vert-plus-horiz.v $R/real.smoothdrtm$*.vel1.mult.vert-minus-horiz.v &

#########
## for data without SRM
real.smoothdrtm%.vel1.nomult.vert-plus-horiz.H: real.smoothdrtm%.vel1.nomult.SdownRup-plus-SupRdown.H real.smoothdrtm%.vel1.nomult.SrightRleft-plus-SleftRright.H
	Math file1=real.smoothdrtm$*.vel1.nomult.SdownRup-plus-SupRdown.H file2=real.smoothdrtm$*.vel1.nomult.SrightRleft-plus-SleftRright.H exp='file1+file2' >$@
real.smoothdrtm%.vel1.nomult.vert-plus-horiz.v: real.smoothdrtm%.vel1.nomult.vert-plus-horiz.H
	<$< Grey title="A real SMOOTHDRTM image from vert-plus-horiz with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

real.smoothdrtm%.vel1.nomult.vert-minus-horiz.H: real.smoothdrtm%.vel1.nomult.SdownRup-plus-SupRdown.H real.smoothdrtm%.vel1.nomult.SrightRleft-plus-SleftRright.H
	Math file1=real.smoothdrtm$*.vel1.nomult.SdownRup-plus-SupRdown.H file2=real.smoothdrtm$*.vel1.nomult.SrightRleft-plus-SleftRright.H exp='file1-file2' >$@
real.smoothdrtm%.vel1.nomult.vert-minus-horiz.v: real.smoothdrtm%.vel1.nomult.vert-minus-horiz.H
	<$< Grey title="A real SMOOTHDRTM image from vert-minus-horiz with SRM" $(Axis) screenratio=$(vel1screenratio) | Vppen vpstyle=n scale=$(vel1screenratio) $(dn) out=$R/$@

compare.real.smoothdrtm%.vel1.nomult.vert-plus-horiz: vel1.v smoothdrtm%.vel1.nomult.v smoothdrtm%.vel1.nomult.lowcut.v real.smoothdrtm%.vel1.nomult.SdownRup-plus-SupRdown.v real.smoothdrtm%.vel1.nomult.SrightRleft-plus-SleftRright.v real.smoothdrtm%.vel1.nomult.vert-plus-horiz.v real.smoothdrtm%.vel1.nomult.vert-minus-horiz.v
	tube $R/vel1.v $R/smoothdrtm$*.vel1.nomult.v $R/smoothdrtm$*.vel1.nomult.lowcut.v $R/real.smoothdrtm$*.vel1.nomult.SdownRup-plus-SupRdown.v $R/real.smoothdrtm$*.vel1.nomult.SrightRleft-plus-SleftRright.v $R/real.smoothdrtm$*.vel1.nomult.vert-plus-horiz.v $R/real.smoothdrtm$*.vel1.nomult.vert-minus-horiz.v &


######################################
### Ignore everything below
######################################
test test2: test1.sh
	sh $< '$(B)'
	echo $@ > tmtext.txt
all: test test2
