up [pdf]
from rsf.proj import *
from rsf.recipes.uncert import uncert

Fetch('beinew.HH','midpts')
Flow('bei','beinew.HH','dd form=native | transp plane=23 | transp plane=34')

uncert('bei',
       nv=100,      # continuation steps
       v0=1.5,      # initial velocity
       dv=0.01,     # velocity step
       nx=250,      # lateral dimension
       nh=48,       # number of offsets
       padt=1024,   # time padding
       padt2=2048,  # extra time padding
#       vslope=0.67, #
#       vx0=1.5,     #
       padx=521,    # lateral padding
       n1=876,      # vertical extent
       v1=1.8,      # other velocity
       dx=0.0335,   # lateral sampling
       x0=7.705,    # lateral origin
       rect1=15,    # vertical smoothing
       rect2=5)     # lateral  smoothing

Flow('left0','bei-unc','math output=x1-0.5*input')
Flow('rite0','bei-unc','math output=x1+0.5*input')
Flow('left1','bei-unc2','math output=x2-0.5*input')
Flow('rite1','bei-unc2','math output=x2+0.5*input')
Flow('left','left0 left1','cmplx ${SOURCES[:2]}',stdin=0)
Flow('rite','rite0 rite1','cmplx ${SOURCES[:2]}',stdin=0)

Flow('arr','left rite',
     'cat axis=3 ${SOURCES[1]} | transp plane=13')
Result('arr',
       '''
       window j2=4 j3=10 | put n3=1 n2=4788 |
       graph title="Structural Uncertainty"
       min1=0 max1=3 min2=7.705 max2=16.0465 pad=n
       transp=y yreverse=y
       wheretitle=b wherexlabel=t
       label1=Time unit1=s label2=Lateral unit2=km       
       ''')

Flow('scan','bei-sem','window n3=1 min3=10 | mutter half=n v0=0.67 x0=1.5')
Plot('scan','grey color=j allpos=y title="Semblance Scan" label1=Time unit1=s label2=Velocity unit2=km/s')

Flow('pick','scan','pick rect1=15')

def graph(col,fat):
    return '''
    graph transp=y yreverse=y min2=1.51 max2=2.5 pad=n plotcol=%d plotfat=%d
    wantaxis=n wanttitle=n
    ''' % (col,fat)

Plot('pick0','pick',graph(0,10))
Plot('pick1','pick',graph(7,1))

Result('scan','scan pick0 pick1','Overlay')

Flow('slice','bei-vlf','window n3=1 min3=10 | mutter half=n v0=0.67 x0=1.5')
Plot('slice','grey title="Velocity Continuation" label1=Time unit1=s label2=Velocity unit2=km/s ')

Result('slice','slice pick0 pick1','Overlay')

Flow('ddv','bei-ddv','window n2=1 min2=10')
Flow('ppick','pick ddv','add ${SOURCES[1]} scale=1,0.25')
Flow('mpick','pick ddv','add ${SOURCES[1]} scale=1,-0.25')

Plot('ppick0','ppick',graph(0,10))
Plot('ppick1','ppick',graph(7,1))

Plot('mpick0','mpick',graph(0,10))
Plot('mpick1','mpick',graph(7,1))

Result('scan2','scan ppick0 mpick0 ppick1 mpick1','Overlay')

Result('slice2','slice ppick0 mpick0 ppick1 mpick1','Overlay')

Flow('smb','bei-sem','window n3=1 | mutter half=n v0=0.67 x0=1.5 | put unit2=km/s')
Plot('smb','grey title=Semblance wheretitle=t allpos=y wherexlabel=b')

eps = (10,50)
for rect in eps:
    pick = 'vpick%d' % rect
    Flow(pick,'smb','pick rect1=%d' % rect)
    Plot(pick,'graph pad=n transp=y yreverse=y min2=1.325 max2=2.5 title="epsilon=%g" ' % (0.01*rect))

Result('velpick','smb vpick%d vpick%d' % eps,
       'SideBySideAniso',vppen='txscale=1.5')

End()

sfdd
sftransp
sfwindow
sfpreconstkirch
sfcat
sfhalfint
sfpad
sfcosft
sfput
sffourvc
sfmath
sfclip2
sfmul
sfdivn
sfstack
sfgrey
sfscale
sfpick
sfslice
sfagc
sfrefer
sfdip
sfadd
sfpwd
sfspray
sffourvc2
sffocus
sfcmplx
sfgraph
sfmutter

data/midpts/beinew.HH