up [pdf]
from rsf.proj import *

Fetch('vesuvio.H','vesuvio')

Flow('vesuvio','vesuvio.H','dd form=native')

Flow('amp','vesuvio','math output="sqrt(sqrt(abs(input)))" | real')
Flow('phz','vesuvio','math output="log(input)" | imag')

Plot('amp','grey title=Amplitude allpos=y')
Plot('phz','grey title=Phase')

Result('vesuvio','amp phz','SideBySideAniso')

for box in (4,8):
    wind = 'wind%d' % box
    real = 'real%d' % box
    imag = 'imag%d' % box
    sque = 'sque%d' % box
    box2 = (box,box)

    Flow(wind,'vesuvio','window j1=%d j2=%d' % box2)
    Flow(real,'vesuvio','real | boxsmooth rect1=%d rect2=%d' % box2)
    Flow(imag,'vesuvio','imag | boxsmooth rect1=%d rect2=%d' % box2)
    Flow(sque,[real,imag],'cmplx ${SOURCES[1]} | window j1=%d j2=%d' % box2)

    Plot(wind,'math output="log(input)" | imag | grey title=Decimated')
    Plot(sque,'math output="log(input)" | imag | grey title=Smoothed')

    bad = 'bad%d' % box
    Flow(bad,sque,'ungrad badness=$TARGET niter=0',stdout=0)

Result('squeeze','wind8 sque8','SideBySideAniso')

Flow('altitude','sque8','ungrad niter=100')
Plot('altitude','grey title="Altitude as density," mean=y')
Plot('contour','altitude','contour title="as contours." allpos=n')
Result('veshigh','altitude contour','SideBySideAniso')

Plot('bad4','grey title="Fine badness" ')
Plot('bad8','grey title="Coarse badness" ')
Result('screw','bad8 bad4','SideBySideAniso')

Flow('z',None,
     '''
     math n1=101 n2=51 o1=-50 d1=1 o2=-25 d2=1
     output="10*exp(-(x1*x1+x2*x2)/100)"
     ''')
Flow('x','z','math output="x1+(input-5)*1.5" ')

Flow('mount','z x',
     '''
     iwarp warp=${SOURCES[1]} n1=51 d1=1 o1=-25 eps=1
     ''')
Plot('grey','mount','grey yreverse=n allpos=y crowd=1  wanttitle=n')
Plot('cont','mount','contour yreverse=n crowd=1  wanttitle=n')
Plot('wigl','mount','wiggle fastplot=20 transp=y zplot=1.5 crowd=1  wanttitle=n')
Plot('data','mount',
     '''
     rtoc | math output="exp(I*2*input)" |   
     math output="log(input)" | imag |
     grey pclip=100 yreverse=n crowd=1 wanttitle=n
     ''')
Result('synmod','grey cont wigl data','SideBySideAniso')

End()

sfdd
sfmath
sfreal
sfimag
sfgrey
sfwindow
sfboxsmooth
sfcmplx
sfungrad
sfcontour
sfiwarp
sfwiggle
sfrtoc

data/vesuvio/vesuvio.H