up [pdf]
from rsf.proj import *
import sys
sys.path.append('Python')
import fdmod,stiffness,pot,fdd,pot,spk,fdm,stiff,pplot

# ------------------------------------------------------------
par = {
    'nx':240, 'ox':0, 'dx':0.002,  'lx':'x', 'ux':'km',
    'ny':240, 'oy':0, 'dy':0.002,  'ly':'y', 'uy':'km',
    'nz':240, 'oz':0, 'dz':0.002,  'lz':'z', 'uz':'km',
    'nt':401, 'ot':0, 'dt':0.0002, 'lt':'t', 'ut':'s',
    'kt':100,
    'jsnap':100,
    'height':10,
    'nb':40,
    'frq':100,
    'nbell':1
    }
fdm.param(par)
par['nframe']=4
par['dabc']='y'
par['labelattr']=par['labelattr']+'''parallel2=n o2num=20 d2num=10 n2tic=3
titlesz=12 labelsz=12 labelfat=0  o4num=30 d4num=10 n4tic=2
'''

xformat='''pclip=100  frame1=12 frame2=12 frame3=12 
                      label1=sample# unit1= 
                      label2=sample# unit2= 
                      label3=sample# unit3= yll=2 xll=2.5
           '''

iframe=4
# ------------------------------------------------------------
# Thomsen parameters
par['vp']=3.5
par['vs']=1.75
par['ro']=2.0
par['eps1']=0.4
par['eps2']=0.4
par['del1']=0.1
par['del2']=0.1
par['del3']=0.
par['gam1']=0.
par['gam2']=0.

# ------------------------------------------------------------
par['kz']=2./3.*par['nz']



# ------------------------------------------------------------
# source/receiver coordinates
# ------------------------------------------------------------

xsou=par['ox']+(par['nx']/2*par['dx']);
ysou=par['oy']+(par['ny']/2*par['dy']);
zsou=par['oz']+(par['nz']/2*par['dz']);
#print xsou,ysou,zsou
center=fdm.center3d(xsou,ysou,1*zsou,par)

Flow('zero3d',None,
     '''
     spike nsp=1 mag=0.0
     n1=%(nz)d o1=%(oz)g d1=%(dz)g 
     n2=%(nx)d o2=%(ox)g d2=%(dx)g 
     n3=%(ny)d o3=%(oy)g d3=%(dy)g |
     put label1=%(lz)s label2=%(lx)s label3=%(ly)s unit1=%(uz)s unit2=%(ux)s unit3=%(uy)s
     ''' % par)


# ------------------------------------------------------------

Flow('vp3d','zero3d','math output="%(vp)g"' %par)
Flow('vs3d','zero3d','math output="%(vs)g"' %par)
Flow('ro3d','zero3d','math output="%(ro)g"' %par)

Flow('eps13d','zero3d','math output="%(eps1)g"' %par)
Flow('eps23d','zero3d','math output="%(eps2)g"' %par)
Flow('del13d','zero3d','math output="%(del1)g"' %par)
Flow('del23d','zero3d','math output="%(del2)g"' %par)
Flow('del33d','zero3d','math output="%(del3)g"' %par)
Flow('gam13d','zero3d','math output="%(gam1)g"' %par)
Flow('gam23d','zero3d','math output="%(gam2)g"' %par)


stiff.ort3d('cA3d','vp3d','vs3d','ro3d','eps13d','eps23d','del13d','del23d','del33d','gam13d','gam23d',par)
# ------------------------------------------------------------

spk.deltx3('spkx3',64,64,64,par)
fdd.separator3PSS('PdzX','PdxX','PdyX',
                  'VdzX','VdxX','VdyX',
                  'HdzX','HdxX','HdyX',
                  'spkx3','cA3d','zero3d','y','x',27,27,27,par)


windowcmd='window min1=20 max1=44 min2=20 max2=44 min3=20 max3=44 |'
Plot('PdzX',windowcmd+pot.plotop3d(xformat+' point1=.5 title="\F5 P: L\_z"',par))
Plot('PdxX',windowcmd+pot.plotop3d(xformat+' title="\F5 P: L\_x"',par))
Plot('PdyX',windowcmd+pot.plotop3d(xformat+' title="\F5 P: L\_y"',par))

Plot('VdzX',windowcmd+pot.plotop3d(xformat+' title="\F5 SV: L\_z"',par))
Plot('VdxX',windowcmd+pot.plotop3d(xformat+' title="\F5 SV: L\_x"',par))
Plot('VdyX',windowcmd+pot.plotop3d(xformat+' title="\F5 SV: L\_y"',par))

Plot('HdzX',windowcmd+pot.plotop3d(xformat+' title="\F5 SH: L\_z" clip=1',par))
Plot('HdxX',windowcmd+pot.plotop3d(xformat+' title="\F5 SH: L\_x"',par))
Plot('HdyX',windowcmd+pot.plotop3d(xformat+' title="\F5 SH: L\_y"',par))



allplots=['PdzX','HdzX','VdzX',
          'PdxX','HdxX','VdxX',
          'PdyX','HdyX','VdyX']

pplot.multip('filters3d',allplots,3,3,0.3,0.3,-11,-10)


End()

sfspike
sfput
sfmath
sfcat
sfederiv3dfilters
sfwindow
sfbyte
sfgrey3