up [pdf]
from rsf.proj import *

# Download data
Fetch('simple.su','cwp')

# Convert to RSF
Flow('simple','simple.su',
     '''
     suread what=d suxdr=y |
     put o2=0 d2=40 label2=Distance unit2=m
     ''')

##################################################################

# Compute traveltime table
##########################

# Velocity
Flow('vel',None,
     '''
     spike mag=2000 n3=1
     O1=0 n1=501 d1=4 
     o2=0 n2=80  d2=40 
     ''')
# Shot locations
Flow('shots','vel',
     'window n1=1 squeeze=n | math output=x2 | pad beg1=1 end1=1')
# Time
Flow('time','vel shots',
     '''
     eikonal shotfile=${SOURCES[1]} |
     window | put o3=0 d3=40
     ''')
Plot('time','grey color=j title=Traveltime allpos=y',view=1)

# dT/dx
Flow('timex','time',
     '''
     transp plane=13 | deriv |
     transp plane=13 | scale dscale=0.025
     ''')

# Kirchhoff migration
Flow('kdmig','simple time timex',
     'kirmig0 type=linear table=${SOURCES[1]} deriv=${SOURCES[2]}')
Result('kdmig','grey title="Kirchhoff migration" ')

####################################################################

# Interpolation
Flow('slope','simple','dip rect1=10 rect2=10 order=4')
Flow('interp','simple slope','dealias dip=${SOURCES[1]} order=4')

# Filtering
Flow('filter','simple','erf flo=2.5 fhi=22.5 rect=60')

cases = {
    'simple': 'simple data',
    'filter': 'filtered',
    'interp': 'interpolated'
    }

for case in cases.keys():
    Result(case,'wiggle transp=y yreverse=y poly=y title=%s' % case)
    mig=case[0]+'mig'
    Flow(mig,case,
         '''
         cosft sign2=1 | stolt vel=2000 | cosft sign2=-1 |
         put d1=4 label1=Depth unit1=m
         ''')
    Result(mig,'wiggle pclip=99 transp=y yreverse=y poly=y title=%s' % cases[case])

End()

sfsuread
sfput
sfspike
sfwindow
sfmath
sfpad
sfeikonal
sfgrey
sftransp
sfderiv
sfscale
sfkirmig0
sfdip
sfdealias
sferf
sfwiggle
sfcosft
sfstolt

data/cwp/simple.su