up [pdf]
from rsf.proj import *

# pdf figures produced by
# $ vpconvert fat=4 color=y format=pdf *.vpl

# sfgraph
Flow('y1',None,'math n1=41 o1=-4 d1=.2 output=".5*x1"')
Flow('y2','y1','math output="sin(x1)"')
Flow('y3','y1 y2','math sin=${SOURCES[1]} output="input-sin"')

Result('fig1','y3','graph title="0.5x-sin(x)"')
Result('fig2','y3','graph title="0.5x-sin(x)" symbol=o symbolsz=12 grid=y min1=-4 max1=4')
Plot('line','y3','graph wanttitle=n wantaxis=n')
Plot('dots','y3','graph title="0.5x-sin(x)" symbol=o symbolsz=12')
Result('fig3','line dots','Overlay')

Flow('y4','y1 y2 y3','cat ${SOURCES[1]} ${SOURCES[2]} axis=2')
Result('fig4','y4','graph title="0.5x,sin(x),0.5x-sin(x)" label1=x label2=y')

# sfgrey
# Flow('f',None,'math n1=101 o1=-.5 d1=.01 n2=201 o2=-1 d2=.01 output="x2+sin(2*3.14159*x1)"')
# Result('fig5','f','grey title="y+sin(2*pi*x)" color=j scalebar=y')
# Result('fig6','f','contour title="y+sin(2*pi*x)" c0=-4 nc=60 allpos=n')

# sfgrey
Flow('vb',None,'math n1=101 d1=2 n2=201 d2=2 output="1500+5*x1"')
Flow('v1','vb','math output="-exp(-.002*((x1-100)*(x1-100)+(x2-200)*(x2-200)))*450"')
Flow('v','vb v1','add scale=1,1 ${SOURCES[1]}')
Result('fig5','v','grey title=Velocity color=j bias=1500 scalebar=y barreverse=y')

Flow('eik','v','eikonal yshot=200')
Result('fig6','eik','contour nc=45 title=Traveltime plotfat=5')

Plot('v','v','grey bias=1500 min1=0 max1=200 min2=0 max2=400 wanttitle=n wantaxis=n')
Plot('eik','eik','contour title=Overlay nc=45 plotfat=5 min1=0 max1=200 min2=0 max2=400')
Result('fig7','v eik','Overlay')

# sfgrey3
Fetch('shots.hh','shots')
# top=os.path.join(os.environ['SWAGM'],'data'),
#      server='local')

Flow('shots','shots.hh','''
    dd form=native type=float | 
    window n1=480 n2=24 | transp plane=23 |
    put label1=Time unit1=sec label3=Offset unit3=m label2=Shot unit2=m
    ''')

Result('fig8','shots','''byte |
    grey3 frame1=0 frame2=24 frame3=0 point1=.75 point2=.65
    wanttitle=n flat=n title="Data"
    ''')

# sfwiggle
Flow('spike',None,
     'spike n1=500 n2=50 k1=100,300 nsp=2 o2=1 d2=1 | ricker1 frequency=5')
Flow('offset','spike','window n1=1 | noise type=n rep=y seed=2005 range=3')
Flow('offset2','offset','transp | headersort head=$SOURCE')
Flow('velocity','spike','window n2=1 | math output="3+0.5*x1" ')

Flow('data','spike offset2 velocity',
     'inmo offset=${SOURCES[1]} velocity=${SOURCES[2]} half=n')
Result('fig9','data',
    '''
    wiggle title= label2="Trace Number" unit2= 
    yreverse=y transp=y poly=y
    ''')

End()

sfmath
sfgraph
sfcat
sfadd
sfgrey
sfeikonal
sfcontour
sfdd
sfwindow
sftransp
sfput
sfbyte
sfgrey3
sfspike
sfricker1
sfnoise
sfheadersort
sfinmo
sfwiggle

data/shots/shots.hh