up [pdf]
from rsf.proj import *

Flow('vel',None,'spike n1=256 d1=5 | math output="1000+x1"')
Result('vel','graph title=Velocity')
Flow('fft','vel','cosft sign1=1')

dt=0.004
nt=500
Flow('sig',None,'spike n1=256 k1=128 d1=5 label1= unit1= | sfmath output="exp(-(32*(x1/(256.0*5)-0.5))*32*(x1/(256.0*5)-0.5))" ')
Result('sig','graph  title="Source Wavelet" ')

Flow('G Mexact Mlr Mapp Mfd10','vel',
     '''sfsglfdcx1 dt=0.001 eps=0.0001 npk=20 seed=2010
     size=8
     Mexact=${TARGETS[1]}
     Mlr=${TARGETS[2]}
     Mapp=${TARGETS[3]}
     Mfd=${TARGETS[4]}
     ''')
Result('Mexact','window max2=0.035 | grey  mean=y  color=j bias=0 transp=n scalebar=y parallel2=y label2=Wavenumber unit2=1/m label1=Distance unit1=m pclip=100 title="Exact Matrix" ')
Result('Mlr','window max2=0.035 | grey mean=y color=j bias=0 transp=n scalebar=y parallel2=y label2=Wavenumber unit2=1/m label1=Distance unit1=m pclip=100 title="Matrix approximated by Lowrank"  ')
Result('Mapp','window max2=0.035 |grey mean=y color=j bias=0 transp=n scalebar=y parallel2=y label2=Wavenumber unit2=1/m label1=Distance unit1=m pclip=100 title="Matrix approximated by 8th-order SG lowrank FD" ')
Result('Mfd10','window max2=0.035|grey mean=y color=j bias=0 transp=n scalebar=y parallel2=y label2=Wavenumber unit2=1/m label1=Distance unit1=m pclip=100 title="Matrix approximated by 8th-order SGFD" ')

Flow('Mlrerr','Mlr Mexact','add ${SOURCES[1]} scale=1,-1')
Flow('Mapperr','Mapp Mexact','add ${SOURCES[1]} scale=1,-1')
Flow('Mfd10err','Mfd10 Mexact','add ${SOURCES[1]} scale=1,-1')

Result('Mlrerr','''window max2=0.035  | scale dscale=1000 | 
                   grey color=j transp=n scalebar=y bias=0.0 clip=0.02 maxval=0.02 minval=-0.02
                   label2=Wavenumber unit2=1/m label1=Distance unit1=m
                   title="Error by SGL X 1000"  ''')

Result('Mapperr','''window max2=0.035 | scale dscale=1000 |
                  grey color=j transp=n bias=0.0 scalebar=y clip=0.02 maxval=0.02 minval=-0.02
                  label2=Wavenumber unit2=1/m label1=Distance unit1=m title="Error by 8th-order SGLFD X 1000"      ''')

Result('Mfd10err','''window max2=0.035 | 
                  grey color=j transp=n bias=0.0 scalebar=y clip=0.02 maxval=0.02 minval=-0.02
                  label2=Wavenumber unit2=1/m label1=Distance unit1=m 
                  title="Error by 8th-order SGFD" 
                  ''')

Result('slicel',' Mlrerr Mapperr Mfd10err','cat ${SOURCES[1]} ${SOURCES[2]}| window max2=0.035 n1=1 f1=128 | graph dash=2,1,0 plotfat=7 plotcol=6,3,5 label1=Wavenumber unit1=1/m label2=Error title=')

Result('err','Fig/Mexact Fig/Mlrerr Fig/Mapperr Fig/Mfd10err','TwoRows')


End()

sfspike
sfmath
sfgraph
sfcosft
sfsglfdcx1
sfwindow
sfgrey
sfadd
sfscale
sfcat