up [pdf]
from rsf.proj import *
from math import pi

n=64

# Spectrum 
Flow('spectrum',None,'math output="exp(-abs(6*x1))" o1=%g d1=%g n1=%d' % (-pi/2,pi/n,n+1))

# Autocorrelation - FT of the spectrum
Flow('auto','spectrum','window n1=%d | spectra' % n)
Flow('auto2','auto','window f1=1 | reverse which=1 | cat axis=1 $SOURCE | window n1=%d' % n)

# Spectral factorization
Flow('factor','spectrum','mul $SOURCE | window f1=%d | kolmog spec=y shift=%d' % (n/2,n/2))

Result('futterman','spectrum auto2 factor',
       '''
       window n1=%d |
       cat ${SOURCES[1:3]} axis=2 | 
       dots labels="spectrum(omega):autocorrelation(t):factor(t)" yreverse=y
       ''' % n)


End()

sfmath
sfwindow
sfspectra
sfreverse
sfcat
sfmul
sfkolmog
sfdots