from rsf.proj import *
Fetch('horizon.asc','hall')
Flow('data','horizon.asc',
'''
echo in=$SOURCE data_format=ascii_float n1=3 n2=57036 |
dd form=native | window n1=1 f1=-1 | add add=-65 |
put
n2=291 o2=35.031 d2=0.01 label2=y unit2=km
n1=196 o1=33.139 d1=0.01 label1=x unit1=km |
costaper nw1=25 nw2=25
''')
def plot(title):
return '''
grey color=j title="%s"
transp=y yreverse=n clip=14
''' % title
Result('data',plot('Horizon'))
cut = '''
cut n1=20 n2=20 f1=125 f2=150 |
cut n1=20 n2=20 f1=150 f2=50
'''
Flow('hole','data',cut)
Flow('mask','data',
'math output=1 | %s | math output=1-input' % cut)
Plot('hole',plot('Input'))
Result('hole','Overlay')
forw = 'rtoc | fft3 axis=1 pad=1 | fft3 axis=2 pad=1'
back = ''
for data in ('data','hole'):
fft = 'fft-'+data
Flow(fft,data,forw)
Result(fft,
'''
math output="abs(input)" | real |
grey allpos=y title="Fourier Transform (%s)"
screenratio=1
''' % data.capitalize())
Flow('fft-mask','fft-hole',
'''
real | math output="x1*x1+x2*x2" | mask min=250 |
dd type=float | math output=1-input |
smooth rect1=5 rect2=5 repeat=3 | rtoc
''')
Result('fft-mask',
'''
real |
grey allpos=y title="Fourier Mask" screenratio=1
''')
niter=0
data = 'hole'
plots = ['hole']
for iter in range(niter):
old = data
data = 'data%d' % iter
Flow(data,[old,'fft-mask','mask','hole'],
'''
%s | mul ${SOURCES[1]} |
%s | mul ${SOURCES[2]} |
add ${SOURCES[3]}
''' % (forw,back))
Plot(data,plot('Iteration %d' % (iter+1)))
plots.append(data)
Plot('pocs',plots,'Movie',view=1)
Result('pocs',data,
plot('POCS interpolation (%d iterations)' % niter))
End() |