up [pdf]
import os
from rsfproj import *

### Set FTP server parameter
FTPserver = {
    'server': os.environ.get('SLIM_SERVER'),
    'login': os.environ.get('SLIM_LOGIN'),
    'password':os.environ.get('SLIM_PASSWORD')}

filesloc = os.path.join('users','dwang','Geophysics','Bayes','model1','results')

#--------Fetch files from FTP server---------
flist = '''
        model1_data.rsf       model1_srme.rsf     model1_p0.rsf  
        model1_Bayes3D_large_eta.rsf  model1_Bayes3D.rsf model1_thr3D.rsf
  '''

#fetch data from FTP server
for fil in str.split(flist):
    Fetch(fil,filesloc,FTPserver)

Fetch('model1_Bayes3D_mult.rsf',filesloc,FTPserver)

def greym(title):
     return '''
     sfdd form=native |sfwindow n1=480|sfput d1=0.004 d2=15 o2=-2715|  
     sfgrey xinch=6 yinch=8 parallel2=n
     clip=2.5 1o2num=0 1d2num=0.2 1n2tic=10  
     label1="Time" unit1="s" 
     label2="Offset" unit2="m"
     labelsz=6.0  titlesz=6.5 title="%s"
      ''' % (title)

#--------basic plot----------------------
Plot('F1a','model1_data.rsf',greym(''))
Plot('F1b','model1_p0.rsf',greym(''))
Plot('F1c','model1_srme.rsf',greym(''))
Plot('F1d','model1_thr3D.rsf',greym(''))
Plot('F1e','model1_Bayes3D.rsf',greym(''))
Plot('F1f','model1_Bayes3D_large_eta.rsf',greym(''))

#--------difference plot------------
Flow('diff-data-srme',['model1_data.rsf','model1_srme.rsf'], \
      ' sfmath  a=${SOURCES[1]} output="input-a"')

Flow('diff-data-bayes',['model1_data.rsf','model1_Bayes3D.rsf'], \
      ' sfmath  a=${SOURCES[1]} output="input-a"')

Flow('diff-srme-bayes',['model1_srme.rsf','model1_Bayes3D.rsf'], \
      ' sfmath  a=${SOURCES[1]} output="input-a"')

Flow('noise',['model1_data.rsf','model1_Bayes3D.rsf','model1_Bayes3D_mult.rsf'], \
      ' sfmath  a=${SOURCES[1]} b=${SOURCES[2]} output="input-(a+b)"')




Plot('diff-data-srme',greym('diff-data-srme'))
Plot('diff-data-bayes',greym('diff-data-bayes'))
Plot('diff-srme-bayes',greym('diff-srme-bayes'))
Plot('bayes-mult','model1_Bayes3D_mult.rsf',greym('bayes mult'))
Plot('noise',greym('noise'))

#-------annotations-------------        
Plot('ant3',None,'box x0=5.58 y0=2.35 label="" xt=0.0 yt=0.0 lab_fat=0 boxit=1 \
       size=0.0 pointer=1 x_oval=0.0 y_oval=0.0')
Plot('ant4',None,'box x0=7.2 y0=4.7 label="" xt=-0.5 yt=0.4 lab_fat=0 boxit=1 \
       size=0.2 pointer=1 x_oval=0.0 y_oval=0.0')
Plot('ant5',None,'box x0=9.05 y0=5.7 label="" xt=0.5 yt=0.4 lab_fat=0 boxit=1 \
       size=0.2 pointer=1 x_oval=0.0 y_oval=0.0')
Plot('ant6',None,'box x0=6.85 y0=4.7 label="" xt=-0.5 yt=0.4 lab_fat=0 boxit=1 \
       size=0.2 pointer=1 x_oval=0.0 y_oval=0.0')
Plot('ant7',None,'box x0=8.8 y0=5.7 label="" xt=0.5 yt=0.4 lab_fat=0 boxit=1 \
       size=0.2 pointer=1 x_oval=0.0 y_oval=0.0')
Plot('ant',None,'box x0=6.85 y0=5.7 label="" xt=0.0 yt=0.0 lab_fat=0 boxit=1 \
       size=0.0 pointer=1 x_oval=0.0 y_oval=0.0')

Plot('ant8',None,'box x0=6.7 y0=4.0 label="" xt=-0.5 yt=0.4 lab_fat=0 boxit=1 \
       size=0.2 pointer=1 x_oval=0.0 y_oval=0.0')

#-------Final results-----------------------
Result('Figure1-a',['F1a']+['ant'],'Overlay')
Result('Figure1-b',['F1b']+['ant3'],'Overlay')
Result('Figure1-c',['F1c']+['ant6']+['ant7'],'Overlay')
Result('Figure1-d',['F1d']+['ant4']+['ant5'],'Overlay')
Result('Figure1-e',['F1e']+['ant'],'Overlay')
Result('Figure1-f',['F1f']+['ant8'],'Overlay')

Result('Figure1-g',['diff-data-srme']+['ant3'],'Overlay')
Result('Figure1-h',['diff-data-bayes']+['ant3'],'Overlay')
Result('Figure1-i',['diff-srme-bayes']+['ant3'],'Overlay')
Result('Figure1-j',['bayes-mult']+['ant3'],'Overlay')
Result('Figure1-k',['noise']+['ant3'],'Overlay')
End()

sfdd
sfwindow
sfput
sfgrey
sfmath
sfbox