up [pdf]
from rsf.proj import *

Fetch('cmp807_raw.HH','rad')

Flow('cmp','cmp807_raw.HH','dd form=native | pow pow1=2 | mutter v0=1.3 tp=0.2 half=n | scale dscale=.0016565')

Flow('vscan','cmp','vscan semblance=y v0=1.2 dv=0.01 nv=180 half=n')

Flow('pick','vscan','mutter inner=y half=n x0=1.2 v0=0.35 | scale axis=2 | pick rect1=10')

Flow('nmo','cmp pick','nmo velocity=${SOURCES[1]} half=n')

Flow('mo','nmo','window min1=1.5 max1=3.5 n2=30')
Plot('mo','grey title="Input CMP" clip=0.3')

# randomization
Flow('off','mo','window n1=1 | noise rep=y seed=2015')
Flow('rand','mo off','headersort head=${SOURCES[1]}')

Flow('mo3','mo','spray axis=3 n=50 o=0 d=1 label=Sample')
Flow('off3','mo3','window n1=1 | noise rep=y seed=2015')
Flow('rand3','mo3 off3','headersort head=${SOURCES[1]}')

Flow('tx3','rand3','smooth rect2=4 rect3=4')

# Sort back
Flow('inv3','off3','put d1=1 o1=0 | math output="x1+30*x2" | spray axis=1 n=1 | headersort head=$SOURCE')
Flow('back','tx3 inv3','headersort head=${SOURCES[1]} | stack axis=3')

Flow('dif','mo back','add scale=1,-1 ${SOURCES[1]}')

Plot('back','grey title="CMP (3-D)" clip=0.3')

Plot('dif','grey title="Difference (3-D)" clip=0.3')

Result('mo-nmo-tx','mo back dif','SideBySideAniso')

Fetch('mo_supp.HH','haskell')

Flow('hm','mo_supp.HH','dd form=native | window min1=1.5 max1=3.5 n2=30')

for case in ('mo','back','hm'):
    Plot(case+'-trace',case,
         '''
         bandpass fhi=50 | 
         window min1=2 max1=3 n2=3 | 
         wiggle poly=y clip=0.4 labelsz=12 labelfat=1 titlesz=12 titlefat=1 title="%s" label2= unit2=
         ''' % {'mo':'Input','back':'PEF (3-D)','hm': 'Velocity Stack'}[case])

Result('mo-near-offset-tx','mo-trace back-trace hm-trace','SideBySideAniso')


End()

sfdd
sfpow
sfmutter
sfscale
sfvscan
sfpick
sfnmo
sfwindow
sfgrey
sfnoise
sfheadersort
sfspray
sfsmooth
sfput
sfmath
sfstack
sfadd
sfbandpass
sfwiggle

data/rad/cmp807_raw.HH
data/haskell/mo_supp.HH