up [pdf]
from rsf.proj import *

Fetch('data.sgy','cwp')

# data.sgy contains 3 traces
Flow('data','data.sgy','segyread read=d')

# pull off 3 traces named (a,b,c)

for trace in range(1,4):
    Flow('xxabc'[trace],'data','window n2=1 f2=%d' % trace)

# shape a.rsf to look like b.rsf
# result is a2b.rsf 

Flow('filt0','a','window n1=100')
Flow('filt','b a filt0','conjgrad convf niter=100 nf=100 other=${SOURCES[1]} mod=${SOURCES[2]}')
Flow('a2b','filt a','convf other=${SOURCES[1]}')

Result('a2b','a b a2b',
       '''
       cat axis=2 ${SOURCES[1:3]} | 
       dots labels="a:b:a -> b" yreverse=y gaineach=n
       ''')

Result('fig2','b a2b',
       '''
       cat axis=2 ${SOURCES[1]} |
       graph dash=0,1 label2=Amplitude
       title="TRb (solid) TRa2b (dash)" 
       ''')

End()

sfsegyread
sfwindow
sfconjgrad
sfconvf
sfcat
sfdots
sfgraph

data/cwp/data.sgy