up [pdf]
from rsf.proj import*
from rsf.prog import RSFROOT

def Grey(data,other):
        Result(data,'put o1=0 d1=0.004 d2=1 o2=0 | grey  clip=0.5 minval=-0.5 maxval=0.5 label2=Trace unit2="" label1=Time unit1="s" title="" wherexlabel=b scalebar=y color=g  %s'%other)

# maxval=0.6 minval=-0.6
# maxval=0.2 minval=-0.2

########################################################################
# INITIALIZATION
########################################################################
matlab         = WhereIs('matlab')
matROOT = '../matfun'
matfun = 'Fxdecon'
matlabpath = os.environ.get('MATLABPATH',os.path.join(RSFROOT,'lib'))

if not matlab:
    sys.stderr.write('\nCannot find Matlab.\n')
    sys.exit(1)


############################################################
## generate and process synthetic data
############################################################
Flow('syn01-flat syn01-flat-fxdecon syn01-dip syn01-dip-fxdecon syn01-complex syn01-complex-fxdecon syn01-complex-fxemdpf',[os.path.join(matROOT,matfun+'.m')],
     '''MATLABPATH=%(matlabpath)s %(matlab)s 
     -nosplash -nojvm -r "addpath %(matROOT)s;%(matfun)s('${TARGETS[0]}','${TARGETS[1]}','${TARGETS[2]}','${TARGETS[3]}','${TARGETS[4]}','${TARGETS[5]}','${TARGETS[6]}');quit"
     '''%vars(),stdin=0,stdout=-1)

Flow('syn01-flat-fxdecon-noise','syn01-flat syn01-flat-fxdecon','add scale=1,-1 ${SOURCES[1]}')
Flow('syn01-dip-fxdecon-noise','syn01-dip syn01-dip-fxdecon','add scale=1,-1 ${SOURCES[1]}')
Flow('syn01-complex-fxdecon-noise','syn01-complex syn01-complex-fxdecon','add scale=1,-1 ${SOURCES[1]}')
Flow('syn01-complex-fxemdpf-noise','syn01-complex syn01-complex-fxemdpf','add scale=1,-1 ${SOURCES[1]}')

# copy syn01-complex-fxdecon
Flow('syn01-complex-fxdecon-cp','syn01-complex-fxdecon','cp')
Flow('syn01-complex-fxdecon-noise-cp','syn01-complex-fxdecon-noise','cp')


## Ploting
Grey('syn01-flat',' max1=2.0 max2=80 ')
Grey('syn01-flat-fxdecon','  max1=2.0 max2=80')
Grey('syn01-dip','  max1=2.0 max2=80')
Grey('syn01-dip-fxdecon','  max1=2.0 max2=80')
Grey('syn01-complex','  max1=2.0 max2=80')
Grey('syn01-complex-fxdecon',' max1=2.0 max2=80')
Grey('syn01-complex-fxemdpf',' max1=2.0 max2=80')
Grey('syn01-complex-fxdecon-cp',' max1=2.0 max2=80')


Grey('syn01-flat-fxdecon-noise','color=g  max1=2.0 max2=80')
Grey('syn01-dip-fxdecon-noise',' color=g max1=2.0 max2=80')
Grey('syn01-complex-fxdecon-noise',' color=g max1=2.0 max2=80')
Grey('syn01-complex-fxdecon-noise-cp',' color=g max1=2.0 max2=80')
Grey('syn01-complex-fxemdpf-noise',' color=g  max1=2.0 max2=80')


End()

sfadd
sfcp
sfput
sfgrey