up [pdf]
from rsf.proj import *

Flow('lag.asc',None,
     'echo 99 102 201 n1=3 n=100,100 data_format=ascii_int in=$TARGET')
Flow('lag','lag.asc','dd form=native')
Flow('waves.asc','lag',
     '''
     echo -0.5 -0.9 0.4 n1=3 data_format=ascii_float in=$TARGET
     lag=$SOURCE
     ''',stdin=0)
Flow('waves','waves.asc','dd form=native')

g = 'grey gainpanel=every pclip=100 wantaxis=n crowd=.88 gpow=.7 title="%s" '

Flow('spik',None,'spike n1=10 n2=10 k1=5 k2=5 d1=1 d2=1')
Flow('filt','spik waves','helicon filt=${SOURCES[1]}')
Plot('filt',g % 'filter')

Plot('auto','filt waves',
     'helicon filt=${SOURCES[1]} adj=y | ' + g % 'autocorrelation')
Flow('auto slag','waves','autocorr lagout=${TARGETS[1]}')
Flow('fact alag','auto lag','wilson lagin=${SOURCES[1]} lagout=${TARGETS[1]}')
Plot('fact','spik fact','helicon filt=${SOURCES[1]} | ' + g % 'Wilson factor')
Plot('invs','filt fact','helicon filt=${SOURCES[1]} div=y | ' + g % 'Wilson inversion')

Result('autowaves','filt auto fact invs','TwoRows')

End()

sfdd
sfspike
sfhelicon
sfgrey
sfautocorr
sfwilson