up [pdf]
from rsf.proj import *

def plot(title):
    return 'grey crowd=.85  wantaxis=0 title="%s" ' % title

Flow('make',None,'make  n1=75 n2=25 t1=2')
Plot('make',plot('GEE'))
Plot('make2','make',plot('Spitz'))
Plot('plane','make',plot('signal+noise'))

Flow('noiz','make',
     'noise rep=y type=n seed=1993 range=0.145 | smooth rect1=3')
Flow('data','make noiz','add ${SOURCES[1]}')
Plot('noiz','data',plot('signal+noise'))

Flow('npef nlag','data','pef a=4,1 lag=${TARGETS[1]}')
Flow('spef slag','data','pef a=7,3 lag=${TARGETS[1]}')

def signoi(eps):
    return 'signoi epsilon=%g sfilt=${SOURCES[1]} nfilt=${SOURCES[2]}' % eps

def splot(f3):
    return 'window n3=1 f3=%d |' % f3 + plot('est. signal')

def nplot(f3):
    return 'window n3=1 f3=%d |' % f3 + plot('est. noise')

Flow('sign','data spef npef',signoi(1))
Plot('ss','sign',splot(0))
Plot('nn','sign',nplot(1))

Result('signoi90','make noiz ss nn','SideBySideAniso',vppen='txscale=3')

Flow('npef2 nlag2','npef','hconv other=$SOURCE lag=${TARGETS[1]}')

Flow('sign2','data spef npef2',signoi(1))
Plot('ss2','sign2',splot(0))
Plot('nn2','sign2',nplot(1))

Result('signoi','make2 noiz ss2 nn2','SideBySideAniso',vppen='txscale=3')

Flow('sign1','data spef npef',signoi(1) + ' spitz=y niter=100')
Plot('ss1','sign1',splot(0))
Plot('nn1','sign1',nplot(1))

Result('signoi1','make2 noiz ss1 nn1','SideBySideAniso',vppen='txscale=3')

Flow('plane1',None,'make second=n n1=75 n2=25 t1=2')
Plot('plane1',plot('GEE'))
Plot('plane2','plane1',plot('Spitz'))

Flow('nppef nplag','make','pef a=2,2 lag=${TARGETS[1]}')
Flow('sppef splag','make','pef a=5,3 lag=${TARGETS[1]}')

Flow('psign','make sppef nppef',signoi(4))
Plot('pss','psign',splot(1))
Plot('pnn','psign',nplot(0))

Result('planes90','plane1 plane pss pnn','SideBySideAniso',vppen='txscale=3')

Flow('nppef2 nplag2','nppef','hconv other=$SOURCE lag=${TARGETS[1]}')

Flow('psign2','make sppef nppef2',signoi(4))
Plot('pss2','psign2',splot(1))
Plot('pnn2','psign2',nplot(0))

Result('planes','plane2 plane pss2 pnn2','SideBySideAniso',vppen='txscale=3')

End()

sfmake
sfgrey
sfnoise
sfsmooth
sfadd
sfpef
sfsignoi
sfwindow
sfhconv