up [pdf]
from rsf.proj import *

# Donwload data
Fetch('midpts.hh','midpts')

# Select a CMP gather, mute
Flow('bei','midpts.hh',
     '''
     window n3=1 | dd form=native | 
     mutter half=n v0=1.5 |
     put label1=Time unit1=s label2=Offset unit2=km | math output="input/4000000"
     ''')

#Flow('refa','cmpa','window n2=1')
Flow('refa','abnmo','snrstack')
#Flow('refa','modl','window n3=1 | window n2=1')

dat='bei'
Result(dat,'grey title="CMP" clip=0.99 labelsz=14 labelfat=2 font=4 titlesz=20 titlefat=2')
for typ in ('semblance','ab','weighted','similarity-weighted'):
        scn=typ+'scn'

        if typ == 'similarity-weighted':
                Flow(scn,[dat,'refa'],'simivscan thr=0.3 half=n v0=1.4 nv=111 dv=0.01 semblance=y type=%s ref=${SOURCES[1]} nb=10 | clip2 lower=0'%typ)
        else:
                Flow(scn,dat,'vscan half=n v0=1.4 nv=111 dv=0.01 semblance=y type=%s nb=10 | clip2 lower=0'%typ)

        if typ=='weighted':
                Plot(scn,scn,
                        '''
                        grey color=j allpos=y title="%s" pclip=80 labelsz=14 labelfat=2 font=4 titlesz=20 titlefat=2
                        '''%typ)
        else:
                Plot(scn,scn,
                        '''
                        grey color=j allpos=y title="%s" scalebar=n pclip=100 clip=0.3 labelsz=14 labelfat=2 font=4 titlesz=20 titlefat=2
                        '''%typ)
        pik=typ+'pik'
        Flow(pik,scn,'scale axis=2 | pick rect1=5')
        Plot(pik,
             '''
             graph yreverse=y transp=y min2=1.4 max2=2.51 pad=n
             plotcol=7 plotfat=15 wanttitle=n wantaxis=n scalebar=n simbolfat=10
             ''')
        Result(scn+'o',[scn,pik],'Overlay')

## Do NMO
        nmo = typ + 'nmo'
        Flow(nmo,[dat,pik],'nmo half=n velocity=${SOURCES[1]} str=0.1 ')
        Result(nmo,
                        '''
                        grey title="(%s)"
                        grid2=y gridcol=6 gridfat=7 g2num=0.5 clip=0.99 labelsz=14 labelfat=2 font=4 titlesz=20 titlefat=2
                        ''' % typ)

        inmo = typ + 'inmo'
        Flow(inmo,[nmo,pik],'inmo  half=n velocity=${SOURCES[1]} str=0.4')
        Result(inmo,
                        '''
                        grey title="(%s)" clip=0.99 labelsz=14 labelfat=2 font=4 titlesz=20 titlefat=2
                        ''' % typ)


#Result('comp1','./Fig/bei.vpl ./Fig/semblancescn.vpl ./Fig/abscn.vpl ./Fig/weightedscn.vpl','SideBySideAniso')
Result('comp1','./Fig/bei.vpl ./Fig/semblancescno.vpl ./Fig/abscno.vpl ./Fig/similarity-weightedscno.vpl','SideBySideAniso')
#Result('comp2','./Fig/bei.vpl ./Fig/semblancenmo.vpl ./Fig/abnmo.vpl ./Fig/weightednmo.vpl','SideBySideAniso')
#Result('comp3','./Fig/bei.vpl ./Fig/semblanceinmo.vpl ./Fig/abinmo.vpl ./Fig/weightedinmo.vpl','SideBySideAniso')

End()

sfwindow
sfdd
sfmutter
sfput
sfmath
sfsnrstack
sfgrey
sfvscan
sfclip2
sfscale
sfpick
sfgraph
sfnmo
sfinmo
sfsimivscan

data/midpts/midpts.hh