up [pdf]
from rsf.proj import *

inp = (1,1,1,7,8,3,2,1)
n = len(inp)

Flow('inp.asc',None,
     '''
     echo %s n1=%d data_format=ascii_float in=$TARGET
     ''' %  (string.join(map(str,inp),' '),n))
Flow('inp0','inp.asc','dd form=native')
Flow('zero','inp0','math output=0')
Flow('inp','zero inp0',
     'interleave axis=1 %s ${SOURCES[1]}' % ('${SOURCES[0]} ' * 9))

tension = (1,0.75,0.5,0.25,0.01)
nt = len(tension)

imps = []
ints = []
for t in range(nt):
    t0 = tension[t]
    s0 = 3*(12-7*t0)
    s = (16*(2*t0-3),12-11*t0)

    tens = 'tens%d' % t
    Flow(tens+'.asc',None,
         '''
         echo %s a0=%g n1=2 data_format=ascii_float in=$TARGET
         ''' % (string.join(map(str,s),' '),s0))
    Flow(tens,tens+'.asc','dd form=native | wilson niter=100')
    Flow('o'+tens,tens,
         '''
         spike n1=10 k1=5 label1= |
         helicon filt=$SOURCE |
         window f1=4 n1=3
         ''')
    imps.append('o'+tens)

    int = 'int%d' % t
    Flow(int,['inp',tens],'miss filt=${SOURCES[1]}')
    ints.append(int)

Result('otens',imps,
       '''
       cat axis=2 ${SOURCES[1:%d]} |
       dots labels=%s dots=2 connect=0 gaineach=0 
       ''' % (nt,string.join(map(lambda x: 'tension=%g' % x,tension),':')))

Result('int',ints+['inp'],
       '''
       cat axis=2 ${SOURCES[1:%d]} |
       dots labels=%s dots=2 connect=0 gaineach=0 
       ''' % (nt+1,
              string.join(map(lambda x: 'tension=%g' % x,tension),':')+':given'))

End()

sfdd
sfmath
sfinterleave
sfwilson
sfspike
sfhelicon
sfwindow
sfmiss
sfcat
sfdots