from rsf.proj import *
top = project.get('RSFROOT')
libdir = os.path.join(top,'lib')
path = {'exe':WhereIs('matlab')}
for key in ('MATLAB','LD_LIBRARY_'):
oldpath = os.environ.get(key+'PATH')
if oldpath:
paths = oldpath.split(':')
if libdir not in paths:
paths.append(libdir)
path[key] = ':'.join(paths)
else:
path[key] = libdir
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.001
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',
'''
lfdc1 dt=0.001 eps=0.0001 npk=20 seed=2010
Mexact=${TARGETS[1]}
Mlr=${TARGETS[2]}
Mapp=${TARGETS[3]}
Mfd=${TARGETS[4]}
''')
cases = dict(Mexact='Exact Matrix',
Mlr='Matrix approximated by Lowrank',
Mapp='Matrix approximated by Lowrank',
Mfd10='Matrix approximated by 10th-order FD',
Mlrerr='Error by Lowrank',
Mapperr='Error by 10th-order lowrank FD',
Mfd10err='Error by 10th-order conventional FD')
for key in cases.keys():
Result(key,'window max2=0.035 | grey color=j transp=n scalebar=y parallel2=n label2=Wavenumber unit2=1/m label1=Distance unit1=m pclip=100 title="%s" ' % cases[key])
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('slicel','Mapperr Mfd10err ','cat ${SOURCES[1]} | window max2=0.035 n1=1 f1=128 | graph dash=0,2 plotfat=7 label1=Wavenumber unit1=1/m label2=Error title=')
End() |