up [pdf]
from rsf.proj import *


#### sythetic data
Flow('spike1',None,'spike n1=100 nsp=1 mag=1 d1=0.004 o1=0 k1=43 | ricker1 freq=0.1')

Flow('spike2',None,'spike n1=100 nsp=1 mag=1 d1=0.004 o1=0 k1=50 | ricker1 freq=0.1')

Flow('spike3',None,'spike n1=100 nsp=1 mag=1 d1=0.004 o1=0 k1=50 | ricker1 freq=0.1')

Flow('spike4',None,'spike n1=100 nsp=1 mag=1 d1=0.004 o1=0 k1=50 | ricker1 freq=0.1')

Flow('spike5',None,'spike n1=100 nsp=1 mag=1 d1=0.004 o1=0 k1=50 | ricker1 freq=0.1')

Flow('syn','spike1 spike2 spike3 spike4 spike5',
     '''
     cat axis=2 ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} | 
     put o2=1 | noise seed=1 type=y mean=0 var=0.00011
     ''')
Plot('syn','syn','wiggle  transp=y yreverse=y poly=y label2=Trace labelsz=12 title="a)" screenratio=0.8')

### initial stack

Flow('stack','syn','stack')
Plot('stack','stack','put o2=0 | wiggle  transp=y yreverse=y poly=y label2=Amplitude labelsz=12 title="c)" screenratio=0.8')

## SNR stack
Flow('snrstack','syn','snrstack  w=45 eps=5000')
Plot('snrstack','snrstack','wiggle  transp=y yreverse=y poly=y label2=Amplitude labelsz=12 title="e)" screenratio=0.8')

## 
Flow('stacks','stack','spray axis=2 n=5')
## similarity
Flow('weights', 'syn stacks',
     '''similarity other=${SOURCES[1]} niter=30 rect1=11 rect2=1
     ''')
Flow('tweights','weights','threshold pclip=100')
Plot('weights','tweights','wiggle  transp=y yreverse=y poly=y label2=Trace labelsz=12 title="b)" screenratio=0.8')
Flow('smstack','syn','smstack s=7 ifwt=y ee=5000 esp=0.1')
Plot('smstack','smstack','wiggle  transp=y yreverse=y poly=y label2=Amplitude labelsz=12 title="d)" screenratio=0.8')

Flow('simistack','tweights syn',
     '''
     sfmath y=${SOURCES[1]} output=input*y | stack  
     ''')
Plot('simistack','simistack','put o2=0| wiggle  transp=y yreverse=y poly=y label2=Amplitude labelsz=12 title="f)" screenratio=0.8')

Flow('norweights','tweights','stack')
Flow('norsimistack','simistack norweights','sfmath y=${SOURCES[1]} output=input/y')
Plot('norsimistack','norsimistack','wiggle  transp=y yreverse=y poly=y label2=Trace labelsz=12 title="e)" screenratio=0.8')
Result('compare','syn weights stack smstack snrstack simistack ', 'SideBySideAniso',vppen='txscale=2.4')




End()

sfspike
sfricker1
sfcat
sfput
sfnoise
sfwiggle
sfstack
sfsnrstack
sfspray
sfsimilarity
sfthreshold
sfsmstack
sfmath