up [pdf]
from rsf.proj import *

dat = {'dat':'gomshot.h',
       'zof':'gomnearoffset.H'}

for case in dat.keys():
    Fetch(dat[case],'gom')
    Flow(case,dat[case],'dd form=native')

def showdat(title,max1,f2=1,flip='',wantaxis1=1):
    return '''
    window min1=1.8 max1=%g max2=10000 f2=%d | %s
    tpow tpow=1 | grey  crowd=0.85 pclip=99 
    label1=Time unit1=s label2=Offset unit2=ft
    title="%s" wantaxis1=%d
    ''' % (max1,f2,flip,title,wantaxis1)

Flow('mask','dat','math output=1 | mutter half=n v0=4800 tp=1.6')

for filt in range(2):
    pef = 'pef%d' % filt
    lag = 'lag%d' % filt
    decon = 'decon%d' % filt
    data = 'shot' + str(filt)
    Flow([pef,lag],'dat mask',
         'pef a=%s maskin=${SOURCES[1]} lag=${TARGETS[1]}' %
         ['30,1','20,5'][filt])
    Flow(decon,['dat',pef],'helicon filt=${SOURCES[1]}')
    Plot(decon,showdat('PEF*Data',2.8+filt,f2=1+3*filt,wantaxis1=0))
    Plot(data,'dat',showdat('Data',2.8+filt,flip='reverse which=2 |'))
    Result(decon,[data,decon],'SideBySideAniso')

def showspec(title):
    return '''
    spectra all=y |
    graph title="%s" crowd1=0.85
    label1=Frequency unit1=Hz label2=Amplitude unit2=
    wheretitle=bot wherexlabel=top
    ''' % title

Plot('specdat','dat',showspec('Spectrum Data'))
Plot('specdecon','decon0',showspec('Spectrum PEF*Data'))
Result('specdecon','specdat specdecon','OverUnderAniso')

def showdat(title):
    return '''
    window f2=10 f1=10 |
    grey crowd1=0.85  crowd2=0.8
    label1=Time unit1=s label2=X unit2=ft title="%s"
    ''' % title

Flow(['zofpef','zoflag'],'zof',
     'window max3=6000 | pef a=10,2 lag=${TARGETS[1]}')
Flow('zofdecon','zof zofpef','helicon filt=${SOURCES[1]}')
Plot('zof','zof',showdat('Data'))
Plot('zofdecon',showdat('10x2 PEF * Data'))
Result('zof','zof zofdecon','OverUnderAniso')

###########################################################################
End()

sfdd
sfmath
sfmutter
sfpef
sfhelicon
sfwindow
sftpow
sfgrey
sfreverse
sfspectra
sfgraph

data/gom/gomshot.h
data/gom/gomnearoffset.H