up [pdf]
from rsf.proj import *
import math

def spike(mag):
    return '''
    spike n1=201 n2=201 n3=1 d1=0.05 d2=0.05 d3=0.05 mag=%g
    label1=Z label2=X unit1=km unit2=km
    ''' % mag

vm = math.sqrt(math.sqrt(14.47*9.57))

Flow('vm',None,spike(vm))
Flow('vx',None,spike(3.80395))
Flow('vz',None,spike(3.09354))
Flow('et',None,spike(0.340859))

def contour(title):
    return '''
    contour screenratio=1 nc=24 c0=0 dc=0.1 
    title="%s"
    ''' % title

Flow('ciso','vm','eikonalvti order=1 zshot=5 yshot=5')
Plot('ciso',contour('Isotropic'))

def rgraph(title):
    return '''
    window j1=25 | transp |
    graph screenratio=1 title="%s"
    min1=0 min2=0 max1=10 max2=10
    transp=y yreverse=y
    label1=Z label2=X unit1=km unit2=km
    ''' % title

Flow('iray','vm','rays2a zshot=5 yshot=5 nr=361 nt=600 dt=0.004')
Plot('iray',rgraph('Isotropic'))

da = math.pi/180
graph = '''
graph wanttitle=n wantaxis=n dash=1
min1=-5 max1=5 min2=-5 max2=5 screenratio=1
'''

Flow('tiso',None,
     '''
     spike n1=361 d1=%g o1=0 n2=24 d2=0.1 o2=0 |
     rtoc |
     math output="%g*x2*exp(I*x1)"
     ''' % (da,vm))
Plot('tiso',graph)

Plot('iso','ciso tiso','Overlay')
Plot('isor','iray tiso','Overlay')

Flow('cane','vz vx et',
     'eikonalvti vx=${SOURCES[1]} eta=${SOURCES[2]} order=1 zshot=5 yshot=5')
Plot('cane',contour('VTI Anelliptic'))

Flow('aray','vz vx et',
     '''
     rays2a vx=${SOURCES[1]} eta=${SOURCES[2]}
     zshot=5 yshot=5 nr=361 nt=600 dt=0.004
     ''')
Plot('aray',rgraph('VTI Anelliptic'))

Flow('tane',None,
     '''
     exgr - |
     spray axis=2 n=24 d=0.1 o=0 |
     math output="input*x2"
     ''')
Plot('tane',graph)

Plot('ane','cane tane','Overlay')
Plot('aner','aray tane','Overlay')

Result('const','iso ane','SideBySideIso')
Result('constr','isor aner','SideBySideIso')

End()

sfspike
sfeikonalvti
sfcontour
sfrays2a
sfwindow
sftransp
sfgraph
sfrtoc
sfmath
sfexgr
sfspray