from rsf.proj import *
import math
plotparam = ' d2num=0.5 n2tic=4 o2num=0.0 labelsz=14.0 '
Flow('plane',None,'spike n1=200 n2=200 d1=0.01 d2=0.01 o1=0.0 o2=0.0 | put label1=x label2=y unit1=km unit2=km')
Flow('zigzag1','plane',
'''
mutter x0=1.0 v0=2.0 |
mutter x0=1.0 v0=-2.0 t0=1.0 inner=n
''')
Flow('zigzag2','zigzag1',
'''
window n1=160 | pad beg1=40 | put o1=0.0
''')
Flow('zigzag0','zigzag1 zigzag2',
'''
math K=${SOURCES[1]} output="input - K" |
mask min=0.01 | dd type=float
''')
Flow('zigzag','zigzag0','noise var=5e-02 seed=2017')
Flow('zigzag-thr','zigzag','thr thr=0.7')
Flow('smooth','zigzag','smooth rect1=20 rect2=20')
Flow('anisod','zigzag','impl2 rect1=50 rect2=50 tau=1')
niter = 60
rep = 3
eps = 5
Flow('diffuse','zigzag',
'diffuse2 niter=%d repeat=%d eps=%g'%(niter,rep,eps))
Flow('delx','zigzag','smoothder | scale axis=2')
Flow('dely','zigzag','transp | smoothder | transp | scale axis=2')
Flow('delx-delx','delx','math output="input*input" | smooth rect1=5 rect2=5')
Flow('dely-dely','dely','math output="input*input" | smooth rect1=5 rect2=5')
Flow('delx-dely','delx dely','math K=${SOURCES[1]} output="K*input" | smooth rect1=5 rect2=5')
Flow('dely-delx','dely delx','math K=${SOURCES[1]} output="K*input" | smooth rect1=5 rect2=5')
Flow('eig1 ux uy eig2 vx vy','delx-delx delx-dely dely-dely',
'''
pwdtensorh in2=${SOURCES[1]} in3=${SOURCES[2]} eps=0.0
ux=${TARGETS[1]} uy=${TARGETS[2]} out2=${TARGETS[3]}
vx=${TARGETS[4]} vy=${TARGETS[5]} normalize=n
''')
Flow('vxC','vx','math output="1/sqrt(2)"')
Flow('vyCdown','vy','math output="-1/sqrt(2)" | cut min2=0.5 max2=1.0 | cut min2=1.5')
Flow('vyCup','vy','math output="1/sqrt(2)" | cut min2=0.0 max2=0.5 | cut min2=1.0 max2=1.5')
Flow('zigzagMask','zigzag0','mask min=1.0 | dd type=float')
Flow('vyCsig','vyCdown vyCup zigzagMask','add ${SOURCES[1]} | math K=${SOURCES[2]} output="input*K"')
Flow('noiseVY','vy zigzagMask','math M=${SOURCES[1]} output="input*(1-M)"')
Flow('vyC','vyCdown vyCup','add ${SOURCES[1]} | smooth rect1=10')
Flow('anisodiffuse','zigzag vxC vyC',
'anisodiffuse2 niter=%d repeat=%d eps=%g vx=${SOURCES[1]} vy=${SOURCES[2]}'%(niter,rep,eps))
Flow('anisodiffuse-thr','zigzag-thr vxC vyC',
'anisodiffuse2 niter=%d repeat=%d eps=%g vx=${SOURCES[1]} vy=${SOURCES[2]}'%(niter,rep,eps))
Flow('az','vx',
'''
smooth rect1=5 rect2=5 |
math output="(180/%g)*asin(input)" |
smooth rect1=5 rect2=5 |
math output="input"'''%(math.pi))
for horizon in ('zigzag0','smooth','anisodiffuse','anisodiffuse-thr','diffuse'):
Plot(horizon,
'''
grey yreverse=n wanttitle=y title="%s"
'''%(horizon))
Result(horizon+'SEG',horizon,'''
bandpass fhi=40 |
transp |
bandpass fhi=40 |
transp |
grey
yreverse=n
wanttitle=n %s
'''%plotparam)
Result('zigzagSEG','zigzag','grey yreverse=n wanttitle=n %s'%plotparam)
Result('zigzag-thrSEG','zigzag-thr','grey yreverse=n wanttitle=n %s'%plotparam)
"""
for horizon in ('zigzag0','zigzag','smooth','anisod','diffuse'):
Plot(horizon,
'''
grey yreverse=n wanttitle=y title="%s"
'''%(horizon))
edge = 'edge-'+horizon
Flow(edge,horizon,'canny max=98 | dd type=float')
Plot(edge,'grey allpos=y yreverse=n wanttitle=n')
Result(horizon,[horizon,edge],'SideBySideIso')
"""
End() |