#define FIGDIR ./Fig
#include <SEP.defs>
#define FIGLIST  Isos Anisxsz IsosAnisxsz two-logs logs-vs-veloc SP-Ani errors devine-rays
#define HEADERVX "n1=120 n2=2 n3=1 ein=0 in='/scr/reinaldo/vx.plot'"
#define HEADERVZ "n1=120 n2=2 n3=1 ein=0 in='/scr/reinaldo/vz.plot'"
#define H8106 "n1=1721 n2=2 n3=1 ein=0 in='/scr/reinaldo/well.plot'"
#define H8106AVE "n1=120 n2=2 n3=1 ein=0 in='/scr/reinaldo/well.plot'"
#define HDIVIDE "n1=119 n2=2 n3=1 ein=0 in='divide.plot'"
#define H8135 "n1=1526 n2=2 n3=1 ein=0 in='/scr/reinaldo/well.plot'"
#define H8106AVE1 "n1=60 n2=1 n3=1 ein=0 in='w8106ave.out'"
#define H8135AVE1 "n1=60 n2=1 n3=1 ein=0 in='w8135ave.out'"
#define HEADERSP "n1=120 n2=2 n3=1 ein=0 in=./Data/sp.average"

default& : tube

FIGDIR/Isos.v:  Src/congra.x Src/do_model.x Src/update_flat.x Src/update_flat_iso.x Src/rays_dev_link.x Src/perturlay_flat.x Src/perturlay_flat_iso.x Src/only_deviation.x Src/window.x Src/plot_dif_new.x
	echo 'Data/my_picks.hastings' >! infile
	Src/only_deviation.x < infile > out
	echo '9000' >! in
	echo '2439 4165.64 251.4581' >> in
	echo '80' >> in
	Src/do_model.x < in > out
	cp model.in.save1 model.in
	echo 'model.in' >! raysin
	Src/rays_dev_link.x < raysin > out
	Src/perturlay_flat_iso.x < ntimes > out
	echo '4932 80' >! congrain
	echo 'perturlay.times' >> congrain
	echo '25' >> congrain
	echo '/scr/reinaldo/perturlay.matrix' >> congrain
	Src/congra.x < congrain > out
	echo '1' >! updatein
	Src/update_flat_iso.x < updatein > out
	cp model.out model.in
	Src/rays_dev_link.x < raysin > out
	Src/perturlay_flat_iso.x < ntimes > out
	Src/congra.x < congrain > out
	Src/update_flat_iso.x < updatein
	echo '/scr/reinaldo/vx.plot' >! windowin
	echo '2705 4000' >> windowin
	Src/window.x < windowin > out
	mv -f window.vel /scr/reinaldo/viso.plot1
	echo HEADERVX >! junkin.H
	Dd < junkin.H esize=4 > sx1_dev_isoC.H 
	Graph title=' ' wherexlabel=t n1=120 n2=1 n3=1 esize=8 plotfat=5 yreverse=y label1='depth (ft)' label2='velocity (ft/sec)' labelsz=6 out=junk.A plotcol=4,3 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y dash=0,0  min1=2705 max1=4000 min2=7000 max2=10000 < sx1_dev_isoC.H
        vppen junk.A erase=once align=lb scale=0.5 > FIGDIR/Isos.v

FIGDIR/Anisxsz.v:  Src/congra.x Src/do_model.x Src/update_flat_iso.x Src/rays_dev_link.x Src/perturlay_flat_iso.x Src/only_deviation.x Src/window.x Src/plot_dif_new.x fortoc.x
	echo 'Data/my_picks.hastings' >! infile
	Src/only_deviation.x < infile > out
	echo '9000' >! in
	echo '2439 4165.64 251.4581' >> in
	echo '80' >> in
	Src/do_model.x < in > out
	cp model.in.save1 model.in
	echo 'model.in' >! raysin
	Src/rays_dev_link.x < raysin > out
	echo '1000' >> ntimes
	Src/perturlay_flat.x < ntimes > out
	echo '4932 160' >! congrain
	echo 'perturlay.times' >> congrain
	echo '25' >> congrain
	echo '/scr/reinaldo/perturlay.matrix' >> congrain
	Src/congra.x < congrain > out
	echo '1000' >! updatein
	echo '1' >> updatein
	Src/update_flat.x < updatein > out
	cp model.out model.in
	Src/rays_dev_link.x < raysin > out
	Src/perturlay_flat.x < ntimes > out
	Src/congra.x < congrain > out
	Src/update_flat.x < updatein > out
	echo '/scr/reinaldo/vx.plot' >! windowin
	echo '2705 4000' >> windowin
	Src/window.x < windowin  > out
	mv -f window.vel /scr/reinaldo/vx.plot1
	echo HEADERVX >! junkin.H
	Dd < junkin.H esize=4 > sx1_devC.H
	echo '/scr/reinaldo/vz.plot' >! windowin
	echo '2705 4000' >> windowin
	Src/window.x < windowin > out
	mv -f window.vel /scr/reinaldo/vz.plot1
	echo HEADERVZ >! junkin.H
	Dd < junkin.H esize=4 > sz1_devC.H
	echo '/scr/reinaldo/vx.plot1' >! plotdifin
	echo '/scr/reinaldo/vz.plot1' >> plotdifin
	echo '2705 4000' >> plotdifin
	echo '7000 10000' >> plotdifin
	echo '500' >> plotdifin
	Src/plot_dif_new.x < plotdifin
	echo 'n1=500 n2=60 n3=1 esize=4 in=/scr/reinaldo/plot_dif.out' >! junkin
	fortoc.x < junkin > plot_dif.H
	Transp < plot_dif.H > plot_difT.H	
	Taplot pclip=100 o2=7000 d2=6.012 o1=2730 d1=21.58 < plot_difT.H> plot_difT.M
	Ta2vplot wantaxis1=n wantaxis2=n title=' ' min2=7000 min1=2709 max2=10000 max1=4004 out=junk.C color=I xll=0.0 yll=0.0 yur=6.0 xur=4.0 < plot_difT.M
	Cat sx1_devC.H sz1_devC.H > Anisxsz.H
	Graph title=' ' wherexlabel=t n1=120,120 n2=2 n3=1 esize=8 plotfat=10,2 yreverse=y label1='depth (ft)' label2='velocity (ft/sec)' labelsz=6  out=junk.D plotcol=4,3 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y dash=0,0 min1=2705 max1=4000 min2=7000 max2=10000 < Anisxsz.H
	cat junk.C junk.D > junk.A
	vppen junk.A erase=once align=lb scale=0.5 > FIGDIR/Anisxsz.v
$	rm -f *in* *out* *times* *fort*;

FIGDIR/IsosAnisxsz.v:  
	echo '/scr/reinaldo/vx.plot1' >! plotdifin
	echo '/scr/reinaldo/viso.plot1' >> plotdifin
	echo '2705 4000' >> plotdifin
	echo '7000 10000' >> plotdifin
	echo '500' >> plotdifin
	Src/plot_dif_new.x < plotdifin > out
	echo 'n1=500 n2=60 n3=1 esize=4 in=/scr/reinaldo/plot_dif.out' >! junkin
	fortoc.x < junkin > plot_dif.H
	echo '/scr/reinaldo/vz.plot1' >! plotdifin
	echo '/scr/reinaldo/viso.plot1' >> plotdifin
	echo '2705 4000' >> plotdifin
	echo '7000 10000' >> plotdifin
	echo '500' >> plotdifin
	Src/plot_dif_new.x < plotdifin > out
	fortoc.x < junkin > plot_dif1.H
	Transp < plot_dif.H > plot_difT.H	
	Taplot pclip=100 o2=7000 d2=6.012 o1=2730 d1=21.58 < plot_difT.H> plot_difT.M 
	Ta2vplot wantaxis1=n wantaxis2=n title=' ' min2=7000 min1=2709 max2=10000 max1=4004 out=junk.C color=I xll=0.0 yll=0.0 yur=6.0 xur=4.0 < plot_difT.M
	Cat sx1_devC.H sx1_dev_isoC.H > IsosAnisx.H
	Graph title=' ' wherexlabel=t n1=120,120 n2=2 n3=1 esize=8 plotfat=10,6 yreverse=y label1='depth (ft)' label2='velocity (ft/sec)' labelsz=6  out=junk.D plotcol=4,3 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y dash=0,0 min1=2705 max1=4000 min2=7000 max2=10000 < IsosAnisx.H
        Transp < plot_dif1.H > plot_dif1T.H
	Taplot pclip=100 o2=7000 d2=6.012 o1=2730 d1=21.58 <plot_dif1T.H> plot_dif1T.M
        Ta2vplot wantaxis1=n wantaxis2=n title=' ' min2=7000 min1=2709 max2=10000 max1=4004 out=junk.E color=I xll=5.5 yll=0.0 yur=6.0 xur=9.5 < plot_dif1T.M
	Cat sz1_devC.H sx1_dev_isoC.H > IsosAnisz.H
	Graph title=' ' wherexlabel=t n1=120,120 n2=2 n3=1 esize=8 plotfat=2,6 yreverse=y label1='depth (ft)' label2='velocity (ft/sec)' labelsz=6  out=junk.F plotcol=4,3 xll=5.5 yll=0.0 yur=6.0 xur=9.5 transp=y dash=0,0 min1=2705 max1=4000 min2=7000 max2=10000 < IsosAnisz.H
	cat junk.C junk.D junk.E junk.F >junk.A
	vppen junk.A erase=once align=lb scale=0.5 > FIGDIR/IsosAnisxsz.v

FIGDIR/two-logs.v:  Src/well-log.x 
	echo 'Data/l8106.dtcnew' >! login
	echo '2705 4000' >> login
	echo 'n' >> login
	Src/well-log.x < login
	echo H8106 >! junk.h
	Dd < junk.h esize=4 > junk.B
	Graph wherexlabel=t n1=1721 n2=1 n3=1 esize=8 plotfat=1 yreverse=y label1=' ' label2=' ' labelsz=6  out=junk.D plotcol=2 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y min1=2705 max1=4000 min2=7000 max2=10000 title=' ' o2num=7000 < junk.B
	echo 'Data/l8106.dtcnew' >! login
	echo '2705 4000' >> login
	echo 'y' >> login
	echo '21.583' >> login
	Src/well-log.x < login
	echo H8106AVE >! junk.ave8106
	cp well.out w8106ave.out
	cp well.plot1 w8106ave.plot1
	Dd < junk.ave8106 esize=4 > junk.ave8106C
	Graph wherexlabel=t n1=120 n2=1 n3=1 esize=8 plotfat=10 yreverse=y label1='depth (ft)' label2='velocity (ft/sec)' labelsz=6  out=junk.F plotcol=1 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y min1=2705 max1=4000 min2=7000 max2=10000 title=' ' o2num=7000 < junk.ave8106C
	echo 'Data/l8135.dtcnew' >! login
	echo '2705 4000' >> login
	echo 'n' >> login
	Src/well-log.x < login
	echo H8135 >! junk.h
	Dd < junk.h esize=4 > junk.B
	Graph wherexlabel=t n1=1526 n2=1 n3=1 esize=8 plotfat=1 yreverse=y label1='depth (ft)' label2='velocity (ft/sec)' labelsz=6  out=junk.E plotcol=2 xll=5.5 yll=0.0 yur=6.0 xur=9.5 transp=y min1=2705 max1=4000 min2=7000 max2=10000 title=' ' o2num=7000 < junk.B
	echo 'Data/l8135.dtcnew' >! login
	echo '2705 4000' >> login
	echo 'y' >> login
	echo '21.583' >> login
	Src/well-log.x < login
	echo H8106AVE >! junk.ave8135
	cp well.out w8135ave.out
	cp well.plot1 w8135ave.plot1
	Dd < junk.ave8135 esize=4 > junk.ave8135C
	Graph wherexlabel=t n1=120 n2=1 n3=1 esize=8 plotfat=10 yreverse=y label1=' ' label2=' ' labelsz=6  out=junk.G plotcol=1 xll=5.5 yll=0.0 yur=6.0 xur=9.5 transp=y min1=2705 max1=4000 min2=7000 max2=10000 title=' ' o2num=7000 < junk.ave8135C
	cat junk.D junk.F junk.E junk.G  > junk.A
	vppen junk.A erase=once align=lb scale=0.5 > FIGDIR/two-logs.v

FIGDIR/logs-vs-veloc.v:  
	Add junk.ave8135C junk.ave8106C scale=0.5,0.5 mode=sum > logs_ave.H
	Cat sx1_dev_isoC.H logs_ave.H > Isoslogs_ave.H
	Graph title=' ' wherexlabel=t n1=120,120 n2=2 n3=1 esize=8 plotfat=7,1 yreverse=y label1='depth (ft)' label2=' ' labelsz=5  wantaxis2=n out=junk.C plotcol=4,3 xll=0.0 yll=0.0 yur=6.0 xur=3.0 transp=y dash=0,0 min1=2705 max1=4000 min2=7000 max2=10000 < Isoslogs_ave.H
	Cat sx1_devC.H logs_ave.H > Anisxlogs_ave.H
	Graph title=' ' wherexlabel=t n1=120,120 n2=2 n3=1 esize=8 plotfat=10,1 yreverse=y label1=' ' label2='velocity (ft/sec)' labelsz=5 wantaxis1=n out=junk.E plotcol=4,3 xll=4 yll=0.0 yur=6.0 xur=7 transp=y dash=0,0 min1=2705 max1=4000 min2=7000 max2=10000 < Anisxlogs_ave.H
	Cat sz1_devC.H logs_ave.H > Aniszlogs_ave.H
	Graph title=' ' whereylabel=r n1=120,120 n2=2 n3=1 esize=8 plotfat=4,1 yreverse=y label1='depth (ft)' label2='' wantaxis2=n labelsz=5 out=junk.G plotcol=4,3 xll=8 yll=0.0 yur=6.0 xur=11 transp=y dash=0,0 min1=2705 max1=4000 min2=7000 max2=10000 wantaxis1=y <  Aniszlogs_ave.H
	cat junk.C junk.E junk.G > junk.A
	vppen junk.A erase=once align=lb scale=0.5 > FIGDIR/logs-vs-veloc.v

FIGDIR/SP-Ani.v: Src/divide.x
	echo '/scr/reinaldo/vx.plot' >! dividein
	echo '/scr/reinaldo/vz.plot' >> dividein
	Src/divide.x < dividein
	echo HDIVIDE >! junk
	Dd < junk esize=4 > szosx_hast_1d.H
	echo HEADERSP >! junk
	Dd < junk esize=4 > SP_ave_hast.H
	Graph title=' ' wherexlabel=b n1=120 n2=1 n3=1 esize=8 plotfat=1 yreverse=y label1='depth (ft)' label2='SP (millivolts)' labelsz=6  out=junk.C plotcol=4 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y dash=0,0 min1=2705 max1=4000 min2=100 max2=163 <  SP_ave_hast.H 
	Graph title=' ' wherexlabel=t n1=119 n2=1 n3=1 esize=8 plotfat=8 yreverse=y label1='depth (ft)' label2='Vx/Vznmo' labelsz=6  out=junk.D plotcol=6 xll=0.0 yll=0.0 yur=6.0 xur=4.0 transp=y dash=0,0 min1=2705 max1=4000 min2=0.85 max2=1.15 < szosx_hast_1d.H 
	cat junk.C junk.D > junk.A
	vppen junk.A erase=once align=lb scale=0.5 > FIGDIR/SP-Ani.v

FIGDIR/errors.v: 
	echo 'n1=1 n2=2 n3=1 ein=0 in=junk.out' > junk.H
	echo '0 1.04' > junk.out
	Dd < junk.H esize=4 > error_1C.H
	echo '0.3 0.94' > junk.out
	Dd < junk.H esize=4 > error_2C.H
	echo '1.78 0.67' > junk.out
	Dd < junk.H esize=4 > error_60C.H
	echo '2.08 0.59' > junk.out
	Dd < junk.H esize=4 > error_120C.H
	echo '3.53 0.54' > junk.out
	Dd < junk.H esize=4 > error_3406C.H
	echo '3.83 0.45' > junk.out
	Dd < junk.H esize=4 > error_6812C.H
	Graph title=' ' wherexlabel=b  n1=1 n2=1 esize=8 plotfat=4 yreverse=n label1=' ' wantaxis2=n label2='' labelsz=6  out=junk.A xll=1.0 yll=1.0 yur=5.0 xur=5.0 transp=n min1=-0.2 max1=4 min2=0. max2=1.4 wantframe=y symbol='A' symbolsz=8<  error_1C.H
	Graph title=' ' wherexlabel=b  n1=1 n2=1 esize=8 plotfat=4 yreverse=n label1=' ' wantaxis2=n label2='' labelsz=6  out=junk.B xll=1.0 yll=1.0 yur=5.0 xur=5.0 transp=n min1=-0.2 max1=4 min2=0. max2=1.4 wantframe=y symbol='B' symbolsz=8<  error_2C.H
	Graph title=' ' wherexlabel=b  n1=1 n2=1 esize=8 plotfat=4 yreverse=n label1=' ' wantaxis2=n label2='' labelsz=6  out=junk.C xll=1.0 yll=1.0 yur=5.0 xur=5.0 transp=n min1=-0.2 max1=4 min2=0. max2=1.4 wantframe=y symbol='C' symbolsz=8<  error_60C.H
	Graph title=' ' wherexlabel=b  n1=1 n2=1 esize=8 plotfat=4 yreverse=n label1=' ' wantaxis2=n label2='' labelsz=6  out=junk.D xll=1.0 yll=1.0 yur=5.0 xur=5.0 transp=n min1=-0.2 max1=4 min2=0. max2=1.4 wantframe=y symbol='D' symbolsz=8<  error_120C.H
	Graph title=' ' wherexlabel=b  n1=1 n2=1 esize=8 plotfat=4 yreverse=n label1=' ' wantaxis2=n label2='' labelsz=6  out=junk.E xll=1.0 yll=1.0 yur=5.0 xur=5.0 transp=n min1=-0.2 max1=4 min2=0. max2=1.4 wantframe=y symbol='E' symbolsz=8<  error_3406C.H
	Graph title=' ' wherexlabel=b  n1=1 n2=1 esize=8 plotfat=4 yreverse=n label1='log # of parameters' wantaxis2=y label2='error (ms)' labelsz=6 out=junk.F xll=1.0 yll=1.0 yur=5.0 xur=5.0 transp=n min1=-0.2 max1=4 min2=0. max2=1.4 wantframe=y symbol='F' symbolsz=8<  error_6812C.H
	cat junk.A junk.B junk.C junk.D junk.E junk.F > junk.G
	vppen erase=once align=lb junk.G > FIGDIR/errors.v

FIGDIR/devine-rays.v: 
	Dd < Data/devine-rays.H esize=4 > devine-raysC.H
	Graph title=' ' wherexlabel=b  n1=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 n2=136 esize=8 plotfat=3 yreverse=y label1='distance (ft)' wantaxis2=y label2='depth (ft)' labelsz=6 wherexlabel=t labelrot=y plotfat=0 axisfat=1 out=junk.A transp=n plotcol=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 xll=3.1 yll=0. yur=4.05 xur=5.1 o1num=0 d1num=345 o2num=2200  d2num=200 wantframe=y min2=2120 max2=2820 min1=0 max1=345.82 <  devine-raysC.H
      vppen align=lb junk.A  > FIGDIR/devine-rays.v

clean&: jclean
	! rm -f *in* *out* *plot* *time* *20* *.aux *.f
	! cd Src; rm -f *.x *.o *.trace

#include <SEP.idoc.rules> 
#include <SEP.obj.rules> 
#include <SEP.prog.rules>    
