from rsf.proj import *
t = "titles=\"in:in/A:A*in/A:(in/A)/A':AA'(in/A)/A'\""
g = 'grey gainpanel=every pclip=100 wantaxis=n crowd=.88 gpow=.7 title="%s" '
filters = {'horz': {'lag': (100,200,300,398,399,400),
'flt': (1, 1, 1, 1, 1, 1),
'a0': 1},
'diag': {'lag': (501,602,703),
'flt': (0.4,-0.3,0.9),
'a0': -1},
'four': {'lag': (1,99,100,101),
'flt': (1, 1, 1, 1),
'a0': -4},
'lapfac': {'lag': (1,2,3,97,98,99,100),
'flt': (-.36,-.024,-.013,-.024,-.05,-.11,-.31),
'a0': 1},
'dip': {'lag': (99,100,199,298,299,398),
'flt': ( 1, 1, 2, 1, 1, 2),
'a0': -8},
'waves': {'lag': (99,102,201),
'flt': (-0.5,-0.9,0.4),
'a0': 1},
'damp':{'lag': (100,101,201,301,302,402),
'flt': (1,1,2,1,1,2),
'a0': -9},
'two':{'lag': (1,2,98,99,100,101,102,198,199,200,201,202),
'flt': (1,1,1,1,1,1,1,1,1,1,1,1),
'a0':-12},
'wide':{'lag': (1,2,3,97,98,99,100),
'flt': (3,2,1,1,2,3,4),
'a0':-17},
}
for filt in filters.keys():
flag = filt + '_lag'
filter = filters[filt]
lag = filter['lag']
flt = filter['flt']
a0 = filter['a0']
n1 = len(lag)
Flow(flag+'0.asc',None,
"echo %s n1=%d n=100,100 data_format=ascii_int in=$TARGET" %
(string.join(map (str, lag),' '),n1))
Flow(flag,flag+'0.asc','dd form=native')
Flow(filt+'0.asc',flag,
'''echo %s a0=%g n1=%d data_format=ascii_float in=$TARGET
lag=$SOURCE''' % (string.join(map (str, flt),' '),a0,n1),
stdin=0)
Flow(filt,filt+'0.asc','dd form=native')
Flow('spike',None,
'spike n1=20 k1=10 n2=20 k2=4 label1=" " label2=" " d1=1 d2=2')
def helicon(adj=0,div=0):
return 'helicon filt=${SOURCES[1]} adj=%d div=%d' % (adj,div)
Flow('shorz',['spike','horz'],helicon())
Flow('sdiag',['spike','diag'],helicon())
Flow('sdiam',['shorz','diag'],helicon())
Plot('horz','shorz',g % 'A')
Plot('diag','sdiag',g % 'B')
Plot('diam','sdiam',g % 'A (convolve) B')
Result('diamond','horz diag diam','SideBySideAniso',vppen='txscale=2.4')
Flow('spike2',None,
'spike n1=20 n2=20 nsp=2 k1=3,7 k2=7,3 mag=1,-1')
Flow('inp2',None,
'spike n1=20 n2=20 nsp=2 k1=19,15 k2=13,6 mag=1,-1')
for filt in ('four','waves'):
inp = 'inp-' + filt
div = 'div-' + filt
div2 = 'div2-' + filt
div4 = 'div4-' + filt
Flow(inp,['spike2','inp2',filt],
'helicon filt=${SOURCES[2]} | add ${SOURCES[1]}')
Flow(div,[inp,filt],helicon(div=1))
Plot(inp,g % 'input')
Plot(div,g % 'input/filter')
Result('wrap-' + filt,[inp,div],'SideBySideAniso',vppen='txscale=1.4')
Flow(div2,[div,filt],helicon(1,1))
Flow(div4,[div2,filt],helicon(1) + ' | ' + helicon(0))
Plot(div2,g % '(input/filter)/filter\'')
Plot(div4,g % '((input/filter)/filter\')filter\'filter')
Result('back-' + filt,[div2,div4],'SideBySideAniso',vppen='txscale=1.4')
Flow('spike3',None,'spike n1=30 n2=30 nsp=2 k1=4,10 k2=10,4 mag=1,-1')
Flow('inp3',None,'spike n1=30 n2=30 nsp=2 k1=29,25 k2=20,10 mag=1,-1')
for filt in ('lapfac','dip'):
inp = 'inp-' + filt
div = 'div-' + filt
div2 = 'div2-' + filt
Flow(inp,['spike3','inp3',filt],
'helicon filt=${SOURCES[2]} | add ${SOURCES[1]}')
Flow(div,[inp, filt],helicon(0,1))
Flow(div2,[div,filt],helicon(1,1))
Plot(inp, g % 'input')
Plot(div, g % 'input/filter')
Plot(div2, g % '(input/filter)/filter\'')
Result(filt,[inp,div,div2],'SideBySideAniso',vppen='txscale=2.4')
Flow('spik',None,'spike n1=30 n2=30 k1=15 k2=15 d1=1 d2=1')
for filt in ['damp','lapfac','two','wide','four','dip','waves']:
auto = 'auto'+filt
slag = 'slag'+filt
alag = 'alag'+filt
fact = 'fact'+filt
same = 'filt'+filt
invs = 'invs'+filt
Flow(same,['spik',filt],helicon())
Plot(same,g % 'filter')
Plot(auto,[same,filt],helicon(1) + ' | ' + g % 'autocorrelation')
Flow([auto,slag],filt,'autocorr lagout=${TARGETS[1]}')
Flow([fact,alag],[auto,filt+'_lag'],
'wilson lagin=${SOURCES[1]} lagout=${TARGETS[1]}')
Plot(fact,['spik',fact],helicon(0,0) + ' | ' + g % 'Wilson factor')
Plot(invs,[same,fact],helicon(0,1) + ' | ' + g % 'Wilson inversion')
Result(auto,[same,auto,fact,invs],'SideBySideAniso',vppen='txscale=2.4')
End() |