from rsf.proj import *
filts = (
(-0.5,-0.5),
(.0625,-.5625,-.5625,.0625),
(-0.01171875, 0.09765625, -0.5859375,
-0.5859375, 0.09765625, -0.01171875),
(.01755442098, -.06075384095, 0.165212482, -0.619616151,
-0.619616151, 0.165212482, -.06075384095, .01755442098)
)
Flow('noise',None,'math n1=64 n2=64 output=1 | noise seed=2015 var=2 rep=y')
for case in range(4):
nf = (case+1)*2
filt = 'filt%d' % nf
Flow(filt+'.asc',None,
'echo %s n1=%d data_format=ascii_float in=$TARGET' % (' '.join(map(str,filts[case])),nf))
Flow(filt,filt+'.asc','dd form=native')
lag = 'lag%d' % nf
Flow(lag,None,'math n1=%d output="%d+x1" | dd type=int | put n=50,50' % (nf,49-case))
data = 'data%d' % nf
Flow(data,['noise',filt,lag],
'''
helicon filt=${SOURCES[1]} lag=${SOURCES[2]} div=1 |
window n1=40 f1=12 n2=32 f2=16
''')
Plot(data,
'''
grey crowd=0.83 title="%d-point %s"
''' % (nf,('Linear','Cubic','Lagrange','Sinc')[case]))
Result('model','data8','grey crowd=0.8 wanttitle=n')
Result('interp-comp','data2 data4 data6 data8','TwoRows')
Flow('well',None,'math n1=64 n2=64 output=1 | spike k2=32 label1= unit1= label2= unit2=')
Flow('mask','well',
'''
noise rep=y seed=2015 type=n mean=0.5 | mask max=0.0468 | dd type=float | add $SOURCE |
window n1=40 f1=12 n2=32 f2=16
''')
Plot('mask','grey crowd=0.8 wanttitle=n')
Flow('data','data8 mask','mul ${SOURCES[1]}')
Plot('data','grey crowd=0.8 wanttitle=n')
Result('data','data mask','SideBySideIso')
def plot(title):
return '''
window n1=32 f1=4 | grey crowd=0.83 title="%s" clip=16
''' % title
Plot('known','data',plot('Known data'))
Plot('true','data8',plot('True model'))
Flow('fill','data mask filt8 lag8',
'miss mask=${SOURCES[1]} filt=${SOURCES[2]} lag=${SOURCES[3]} padin=100 padout=100 prec=0 niter=200')
Flow('diff','fill data8','add scale=1,-1 ${SOURCES[1]}')
Plot('fill',plot('Filled w/Correct PEF'))
Plot('diff',plot('Difference'))
Result('correct','known fill true diff','TwoRows')
End() |