up [pdf]
from rsf.proj import *
from rsf.recipes.beg import server as private
import rsf.recipes.warp as warp

trace=300

Flow('line.asc',None,
     'echo %d 0 %d 4 n1=4 data_format=ascii_float in=$TARGET' %
     (trace,trace))
Plot('line','line.asc',
     '''
     dd form=native | dd type=complex |
     graph min2=0 max2=4 min1=-0.5 max1=471.5 pad=n wantaxis=n wanttitle=n
     ''')

for mode in ['pp','ss']:
    data = 'bend_l1_%cmig_enhanc.sgy' % mode[1]
    Fetch(data,'vecta',private)
    Flow(mode,data,
         'segyread tape=$SOURCE read=data | window n2=471 | scale axis=2 | put label2=Trace',
         stdin=0)
    Result(mode,mode,'Overlay')
    Result('v'+mode,[mode,'line'],'Overlay')

nails = Split('''
0.32 0.72
0.57 1.22
0.97 1.97
''')

Flow('nails0.asc',None,
     'echo %s n1=2 n2=%d in=$TARGET data_format=ascii_float' %
     (string.join(nails,' '),len(nails)/2))
Flow('nails','nails0.asc','dd form=native')
Flow('nreal','nails','window n1=1')
Flow('nimag','nails','window f1=1')
Plot('nails','nreal nimag',
     '''
     cmplx ${SOURCES[:2]} |
     graph min1=0 max1=2 min2=0 max2=4 symbol='o' wanttitle=n
     label1="PP time (s)" label2="SS time (s)" plotcol=5
     symbolsz=15
     ''',stdin=0)

Flow('fit','nails pp1','linefit pattern=${SOURCES[1]}')
Plot('fit','graph min1=0 max1=2 min2=0 max2=4 title="Line Fit" ')
Result('vnails','fit nails','Overlay')

Flow('fit0','fit','math output=input-x1 | spray o=0 d=1 n=471')

warp.warp2('vec','pp','ss','fit0',
           nx=471,
           inter=5,
           tmax=1.5,
           ss=1,
           trace=trace,
           gmax=2.3,
           gmin=1.5,
           dt=0.002,
           g0=0.9,
           ng=41,
           rect1=50,
           rect2=50,
           fmax=70,
           fmin=20,
           frect=25,
           frame1=285,
           iter=2,
           clip=0.39)

Result('pi','ppi','Overlay')
Result('si','vec-si-0','Overlay')

End()

sfdd
sfgraph
sfsegyread
sfwindow
sfscale
sfput
sfcmplx
sflinefit
sfmath
sfspray
sfsmoothder
sfwarp1
sfadd
sfcat
sfdots
sfltft
sftransp
sfreal
sfgrey
sfricker
sffreshape
sfwarpscan
sfpick
sfwarpadd
sfrm
sfiphase
sfspectra
sfmask
sfnsmooth1
sfabalance
sfpad
sfstack
sfinterleave
sfwiggle
sfsimilarity
sfbyte
sfgrey3
sfspline
sfdeblur