Example #1
0
def test(par):

    for i in ('s', 'r'):
        Flow('v' + i, 'u' + i, 'window n3=1 f3=400')
        Result('v' + i, fdmod.cgrey('', par))

        Flow(
            'k' + i, 'f' + i, '''
               lstk verb=y
               oa=%(oa)d na=%(na)d da=%(da)g
               nl=%(nl)d dl=%(dl)g sig=%g
               ''' % par)
        Result('k' + i, fdmod.dgrey('gainpanel=a pclip=100', par))

        jx = 20
        Result(
            'k' + i + 'all', 'k' + i, '''
               window j2=%d |
               transp plane=23 |
               put n3=1 n2=%d |
               grey pclip=100
               ''' % (jx, par['nx'] / 2 / jx * na))

        Flow('t' + i, 'k' + i,
             'byte gainpanel=a pclip=100 | put label1=x label2=t label3=a')

        Result(
            'ff', 'fs fr',
            'cat axis=3 space=n ${SOURCES[1]} | transp | grey pclip=100 gainpanel=e'
        )
        Result(
            'tt', 'ts tr', '''
               cat axis=3 space=n ${SOURCES[1]} |
               window j1=10 |
               transp plane=12 |
               transp plane=23 |
               grey title=""
               ''')

        #        for i in ('s','r'):
        #            Flow(['t'+i+'plt','t'+i+'bar'],'k'+i,'byte bar=${TARGETS[1]} gainpanel=a pclip=99.9')
        #            for k in range(20):
        #                Result('t'+i+'plt'+str(k),['t'+i+'plt','t'+i+'bar'],
        #                       'window n1=1 f1=%d | transp |' % (20*k) +
        #                       'grey title="" screenratio=0.2 screenht=3 label2=x unit2=m label1=p unit1="#" ')

        Flow('fi', 'fs fr', 'add mode=p ${SOURCES[1]}')
        Flow(
            'ki', 'ks kr', '''
             add mode=p ${SOURCES[1]} |
             transp plane=23 memsize=1000 |
             stack
             ''')

        Result('fi', fdmod.dgrey('', par))
        Result('ki', fdmod.dgrey('', par))
Example #2
0
def edata(plot,data,custom,par):

    Flow([plot+'_plt',plot+'_bar'],data,
         'scale axis=123 | byte bar=${TARGETS[1]} gainpanel=a pclip=100 %s' % custom)

    for i in range(2):
        Plot(  plot+str(i+1),[plot+'_plt',plot+'_bar'],
               'window n2=1 f2=%d bar=${SOURCES[1]} | transp |' % i
               +fdmod.dgrey('pclip=98 %s' %custom,par))        
        Result(plot+str(i+1),[plot+'_plt',plot+'_bar'],
               'window n2=1 f2=%d j3=10 bar=${SOURCES[1]} | transp |' % i
               +fdmod.dgrey('pclip=98 %s' %custom,par))   
Example #3
0
def test(par):

    for i in ('s','r'):
        Flow(  'v'+i,'u'+i,'window n3=1 f3=400')
        Result('v'+i,fdmod.cgrey('',par))
        
        Flow(  'k'+i,'f'+i,
               '''
               lstk verb=y
               oa=%(oa)d na=%(na)d da=%(da)g
               nl=%(nl)d dl=%(dl)g sig=%g
               ''' % par )
        Result('k'+i,fdmod.dgrey('gainpanel=a pclip=100',par))
        
        jx = 20
        Result('k'+i+'all','k'+i,
               '''
               window j2=%d |
               transp plane=23 |
               put n3=1 n2=%d |
               grey pclip=100
               ''' % (jx,par['nx']/2/jx*na) )
        
        Flow('t'+i,'k'+i,'byte gainpanel=a pclip=100 | put label1=x label2=t label3=a')
        
        Result('ff','fs fr','cat axis=3 space=n ${SOURCES[1]} | transp | grey pclip=100 gainpanel=e')
        Result('tt','ts tr',
               '''
               cat axis=3 space=n ${SOURCES[1]} |
               window j1=10 |
               transp plane=12 |
               transp plane=23 |
               grey title=""
               ''')
        
#        for i in ('s','r'):
#            Flow(['t'+i+'plt','t'+i+'bar'],'k'+i,'byte bar=${TARGETS[1]} gainpanel=a pclip=99.9')
#            for k in range(20):
#                Result('t'+i+'plt'+str(k),['t'+i+'plt','t'+i+'bar'],
#                       'window n1=1 f1=%d | transp |' % (20*k) +
#                       'grey title="" screenratio=0.2 screenht=3 label2=x unit2=m label1=p unit1="#" ')
                
        Flow('fi','fs fr','add mode=p ${SOURCES[1]}')
        Flow('ki','ks kr',
             '''
             add mode=p ${SOURCES[1]} |
             transp plane=23 memsize=1000 |
             stack
             ''')
        
        Result('fi',fdmod.dgrey('',par))
        Result('ki',fdmod.dgrey('',par))
Example #4
0
File: micro.py Project: psava/cwp12
def synthesize(data,rr,snapshots,par):
    # 2D acoustic modeling
    awefd(data,'wa-2d','wava','vp-2d','ro-2d','ss-2d',rr,par)
    Result(data,'transp |' + fdmod.dgrey('',par))
    for i in range(snapshots[0],snapshots[0]+snapshots[1]*snapshots[2],snapshots[2]):
        Plot('wa-2d-%d' % i,'wa-2d','window n3=%d f3=%d | ' % (1,i) + fdmod.cgrey('pclip=99.9 gainpanel=a',par))
        Result('wa-2d-%d' %i , ['wa-2d-%d' % i,rr],'Overlay')
Example #5
0
def mask(mask,xsou,tmin,tmax,par):
    
    dipline1(mask+'ml',
                    0.15+tmin,par['xmin'],
                    0.15,xsou,
                    0,1,
                    par['nt'],par['ot'],par['dt'],
                    par['nx'],par['ox'],par['dx'])
    dipline1(mask+'mr',
                    0.15,xsou,
                    0.15+tmax,par['xmax'],
                    0,1,
                    par['nt'],par['ot'],par['dt'],
                    par['nx'],par['ox'],par['dx'])

    Flow(mask,[mask+'ml',mask+'mr'],
         '''
         spike nsp=1 mag=1.0
         n1=%(nx)d o1=%(ox)g d1=%(dx)g k1=%(ltap)d l1=%(rtap)d
         n2=%(nt)d o2=%(ot)g d2=%(dt)g |
         smooth rect1=100 repeat=1 |
         scale axis=123 |
         transp |
         add mode=p ${SOURCES[0]} |
         add mode=p ${SOURCES[1]} |
         transp |
         smooth rect2=100 repeat=3 |
         put label1=x label2=t unit1=km unit2=s |
         spray axis=3 n=2 o=0 d=1 |
         transp plane=23
         ''' % par)
    Result(mask,
           'window n2=1 | transp|' + fdmod.dgrey('',par))
Example #6
0
def mask(mask,xsou,tmin,tmax,par):
    
    dipline1(mask+'ml',
                    0.15+tmin,par['xmin'],
                    0.15,xsou,
                    0,1,
                    par['nt'],par['ot'],par['dt'],
                    par['nx'],par['ox'],par['dx'])
    dipline1(mask+'mr',
                    0.15,xsou,
                    0.15+tmax,par['xmax'],
                    0,1,
                    par['nt'],par['ot'],par['dt'],
                    par['nx'],par['ox'],par['dx'])

    Flow(mask,[mask+'ml',mask+'mr'],
         '''
         spike nsp=1 mag=1.0
         n1=%(nx)d o1=%(ox)g d1=%(dx)g k1=%(ltap)d l1=%(rtap)d
         n2=%(nt)d o2=%(ot)g d2=%(dt)g |
         smooth rect1=100 repeat=1 |
         scale axis=123 |
         transp |
         add mode=p ${SOURCES[0]} |
         add mode=p ${SOURCES[1]} |
         transp |
         smooth rect2=100 repeat=3 |
         put label1=x label2=t unit1=km unit2=s |
         spray axis=3 n=2 o=0 d=1 |
         transp plane=23
         ''' % par)
    Result(mask,
           'window n2=1 | transp|' + fdmod.dgrey('',par))
Example #7
0
 def dgrey(self,custom,scalar=None,horizontal=True,ratio=0.5):
   '''
   This is equivalent to fdmod.cgrey('',par) 
   scalar:  horizontal scalar for the figure space
   '''
   self._scale(scalar,horizontal)
   toplot = ' plotfat=1 screenratio=%(ratio)g screenht=%(height)g '%self.par +custom
   print toplot
   return fdmod.dgrey(toplot,self.par)
Example #8
0
def edata(plot, data, custom, par):

    Flow(
        [plot + "_plt", plot + "_bar"],
        data,
        "scale axis=123 | byte bar=${TARGETS[1]} gainpanel=a pclip=100 %s" % custom,
    )

    for i in range(2):
        Plot(
            plot + str(i + 1),
            [plot + "_plt", plot + "_bar"],
            "window n2=1 f2=%d bar=${SOURCES[1]} | transp |" % i + fdmod.dgrey("pclip=98 %s" % custom, par),
        )
        Result(
            plot + str(i + 1),
            [plot + "_plt", plot + "_bar"],
            "window n2=1 f2=%d j3=10 bar=${SOURCES[1]} | transp |" % i + fdmod.dgrey("pclip=98 %s" % custom, par),
        )
Example #9
0
def pmodel(dat,wfl,wav,vel,den,sou,rec,ico,par):
    if(not par.has_key('mintplot')): par['mintplot']=0

    Result(wav,'window n1=1 n2=400 |' + fdmod.waveplot('',par))
    Result('p'+vel,[vel,ico,rec,sou],'Overlay')
    
    fdmod.awefd(dat,wfl,
                wav,vel,den,sou,rec,'',par)

#    Result(dat, 'window j2=5 | transp |' +
#           fdmod.dgrey('pclip=99.9 min1=%(mintplot)g labelsz=4'%par, par))
    Result(dat, 'window j2=5 | transp |' +
           fdmod.dgrey('pclip=99.5 screenratio=1.5 min1=%(mintplot)g labelsz=3 labelfat=3 '%par, par))
Example #10
0
def wcompare(plot, us, ur, iz, par):

    for u in [us, ur]:
        for i in range(2):
            Flow(
                plot + "_" + u + str(i + 1),
                u,
                "window n2=1 f2=%d j3=10 | transp |" % i + xzcoord(par) + "| window n2=1 f2=%d" % iz,
            )

        Flow(u + "all", [plot + "_" + u + "1", plot + "_" + u + "2"], "cat axis=2 space=n ${SOURCES[0:2]}", stdin=0)
        Plot(u + "all", fdmod.dgrey("max2=%g" % (2 * par["xmax"]), par))

    Result(plot, [us + "all", ur + "all"], "SideBySideAniso")
Example #11
0
def wcompare(plot,us,ur,iz,par):

    for u in ([us,ur]):
        for i in range(2):
            Flow(plot+'_'+u+str(i+1),u,
                 'window n2=1 f2=%d j3=10 | transp |' % i
                 + xzcoord(par)
                 + '| window n2=1 f2=%d' % iz)
            
        Flow(u+'all',[plot+'_'+u+'1',plot+'_'+u+'2'],
             'cat axis=2 space=n ${SOURCES[0:2]}', stdin=0)
        Plot(u+'all',fdmod.dgrey('max2=%g' % (2*par['xmax']) ,par))

    Result(plot,[us+'all',ur+'all'],'SideBySideAniso')
Example #12
0
def pmodel(dat, wfl, wav, vel, den, sou, rec, ico, par):
    if (not par.has_key('mintplot')): par['mintplot'] = 0

    Result(wav, 'window n1=1 n2=400 |' + fdmod.waveplot('', par))
    Result('p' + vel, [vel, ico, rec, sou], 'Overlay')

    fdmod.awefd(dat, wfl, wav, vel, den, sou, rec, '', par)

    #    Result(dat, 'window j2=5 | transp |' +
    #           fdmod.dgrey('pclip=99.9 min1=%(mintplot)g labelsz=4'%par, par))
    Result(
        dat, 'window j2=5 | transp |' + fdmod.dgrey(
            'pclip=99.5 screenratio=1.5 min1=%(mintplot)g labelsz=3 labelfat=3 '
            % par, par))
Example #13
0
def amodel(dat,wfl,wav,vel,den,ref,sou,rec,ico,par):
    if(not par.has_key('wscale')): par['wscale']=5
    if(not par.has_key('vbias')): par['vbias']=1500

    Result(wav,'window n1=1 n2=400 |' + fdmod.waveplot('format1=%3.2f',par))
    Result('a'+vel,[vel,ico,rec,sou],'Overlay')

    fdmod.lwefd1(dat+'o',wfl+'o',
                 dat+'x',wfl+'x',
                 wav,vel,den,ref,sou,rec,'',par)
    Flow(dat,[dat+'o',dat+'x'],'add ${SOURCES[1]} scale=1,%(wscale)g' % par)
    Flow(wfl,[wfl+'o',wfl+'x'],'add ${SOURCES[1]} scale=1,%(wscale)g' % par)

    Result(dat, 'window j2=5 | transp |' +
           fdmod.dgrey('pclip=99.5 screenratio=1.5 min1=%(mintplot)g labelsz=3 labelfat=3 '%par, par))
Example #14
0
def sampling(vo, rm, dat, rec, ico, cic, iic, par):

    for k in range(0, 3):
        ktag = "-s%01d" % k
        knum = pow(2, k + 1)

        Flow(rec + ktag, rec, 'window j2=%d' % (knum))
        Plot(rec + ktag, 'window |' + fdmod.rrplot('', par))

        Flow(dat + ktag, dat, 'window j1=%d' % (knum))
        Result(
            dat + ktag, 'window j2=5 | transp |' + fdmod.dgrey(
                'pclip=99 screenratio=1.5 min1=%(mintplot)g' % par, par))

        pimage(cic + ktag, iic + ktag, dat + ktag, vo, rm, rec + ktag, ico,
               par)
Example #15
0
def sampling(vo,rm,
             dat,rec,ico,
             cic,iic,
             par):

    for k in range(0,3):
        ktag = "-s%01d" % k
        knum = pow(2,k+1)

        Flow(rec+ktag,rec,'window j2=%d' % (knum))
        Plot(rec+ktag,'window |' + fdmod.rrplot('',par))
        
        Flow(dat+ktag,dat,'window j1=%d' % (knum))
        Result(dat+ktag, 'window j2=5 | transp |' +
               fdmod.dgrey('pclip=99 screenratio=1.5 min1=%(mintplot)g'%par, par))
        
        pimage(cic+ktag,iic+ktag,dat+ktag,vo,rm,rec+ktag,ico,par)
Example #16
0
def originaldata(sdat,rdat,sd,par):

    Flow(  'wav',None,'spike nsp=1 mag=1 k1=1 n1=%(nt)d d1=%(dt)g o1=%(ot)g' % par)
    Result('wav','window n1=500 |' + fdmod.waveplot('',par))

    sigsbee.getdata('data',par)
    sigsbee.makeshots('sall','data',par)
        
    Flow('swin',
         'sall',
         '''
         window n3=%(ns)d f3=%(fs)d j3=%(js)d |
         bandpass flo=2 fhi=10
         ''' % par)
    
    for file in (['swin','sall']):
        for iexp in range(par['ns']):
            etag = "-e%03d" % iexp

            Plot(file+etag,file,
                 'window n3=1 f3=%d | put o2=%g |' % (iexp,par['jos']+iexp*par['jds'])
                 + fdmod.dgrey('pclip=99',par))
            Result(file,map(lambda x: file+'-e%03d' % x,range(par['ns'])),'Movie')


    encode.shot2grid('sdata-t','rdata-t','wav','swin',par)
    Flow('S-sou-t','sdata-t','window | transp' %par)
    Flow('S-rec-t','rdata-t','window | transp' %par)

    encode.time2freq('S-sou-t','S-sou-w',par)
    encode.time2freq('S-rec-t','S-rec-w',par)
    
    # datum through water
    spmig.datum3('S-dfs',
                 'S-dfr',
                 sd,
                 'S-sou-w',
                 'S-rec-w',par) 

    # window datumed data (all shots)
    Flow(sdat,'S-dfs','window squeeze=n min1=%(oximg)g n1=%(nximg)g' % par)
    Flow(rdat,'S-dfr','window squeeze=n min1=%(oximg)g n1=%(nximg)g' % par)

    Result(sdat,fdmod.fgrey('pclip=99',par))
    Result(rdat,fdmod.fgrey('pclip=99',par))
Example #17
0
def amodel(dat, wfl, wav, vel, den, ref, sou, rec, ico, par):
    if (not par.has_key('wscale')): par['wscale'] = 5
    if (not par.has_key('vbias')): par['vbias'] = 1500

    Result(wav, 'window n1=1 n2=400 |' + fdmod.waveplot('format1=%3.2f', par))
    Result('a' + vel, [vel, ico, rec, sou], 'Overlay')

    fdmod.lwefd1(dat + 'o', wfl + 'o', dat + 'x', wfl + 'x', wav, vel, den,
                 ref, sou, rec, '', par)
    Flow(dat, [dat + 'o', dat + 'x'],
         'add ${SOURCES[1]} scale=1,%(wscale)g' % par)
    Flow(wfl, [wfl + 'o', wfl + 'x'],
         'add ${SOURCES[1]} scale=1,%(wscale)g' % par)

    Result(
        dat, 'window j2=5 | transp |' + fdmod.dgrey(
            'pclip=99.5 screenratio=1.5 min1=%(mintplot)g labelsz=3 labelfat=3 '
            % par, par))
Example #18
0
def originaldata(sdat, rdat, sd, par):

    Flow('wav', None,
         'spike nsp=1 mag=1 k1=1 n1=%(nt)d d1=%(dt)g o1=%(ot)g' % par)
    Result('wav', 'window n1=500 |' + fdmod.waveplot('', par))

    sigsbee.getdata('data', par)
    sigsbee.makeshots('sall', 'data', par)

    Flow(
        'swin', 'sall', '''
         window n3=%(ns)d f3=%(fs)d j3=%(js)d |
         bandpass flo=2 fhi=10
         ''' % par)

    for file in (['swin', 'sall']):
        for iexp in range(par['ns']):
            etag = "-e%03d" % iexp

            Plot(
                file + etag, file, 'window n3=1 f3=%d | put o2=%g |' %
                (iexp, par['jos'] + iexp * par['jds']) +
                fdmod.dgrey('pclip=99', par))
            Result(file, map(lambda x: file + '-e%03d' % x, range(par['ns'])),
                   'Movie')

    encode.shot2grid('sdata-t', 'rdata-t', 'wav', 'swin', par)
    Flow('S-sou-t', 'sdata-t', 'window | transp' % par)
    Flow('S-rec-t', 'rdata-t', 'window | transp' % par)

    encode.time2freq('S-sou-t', 'S-sou-w', par)
    encode.time2freq('S-rec-t', 'S-rec-w', par)

    # datum through water
    spmig.datum3('S-dfs', 'S-dfr', sd, 'S-sou-w', 'S-rec-w', par)

    # window datumed data (all shots)
    Flow(sdat, 'S-dfs', 'window squeeze=n min1=%(oximg)g n1=%(nximg)g' % par)
    Flow(rdat, 'S-dfr', 'window squeeze=n min1=%(oximg)g n1=%(nximg)g' % par)

    Result(sdat, fdmod.fgrey('pclip=99', par))
    Result(rdat, fdmod.fgrey('pclip=99', par))
Example #19
0
def test(par):
    # ------------------------------------------------------------
    # source coordinate
    fdmod.point('ss',par['xsou'],par['zsou'],par)
    Plot('ss',fdmod.ssplot('',par))
    Result('vel',['vel','ss'],'Overlay')
    Result('ref',['ref','ss'],'Overlay')
    Result('img',['img','ss'],'Overlay')

    # slowness
    Flow('slo','vel',
         '''
         transp |
         math "output=1/input" |
         spray axis=2 n=1 |
         put label2=y
         ''' % par )
    Result('slo','window | transp |' + fdmod.cgrey('allpos=y bias=0.065',par))

    # migration wavelet
    Flow('wvl',None,
         '''
         spike nsp=1 mag=1
         n1=%(nt)d d1=%(dt)g o1=0        k1=1
         n2=1      d2=%(dx)g o2=%(xsou)g |
         scale axis=123 |
         put label1=t label2=x label3=y
         ''' % par)

    # modeling wavelet (time domain)
    Flow('wav',None,
         '''
         spike nsp=1 mag=1
         n1=%(nt)d d1=%(dt)g o1=0   k1=%(kt)d
         n2=1      d2=%(dx)g o2=%(xsou)g |
         ricker1 frequency=%(frq)g |
         scale axis=123 |
         put label1=t label2=x label3=y
         ''' % par)
    Result('wav','window n1=200 |' + fdmod.waveplot('',par))

    # modeling wavelet (frequency domain)
    Flow('sou','wav',
         '''
         fft1 |
         window squeeze=n n1=%(nw)d min1=%(ow)g |
         pad beg2=%(xpad)d n2out=%(nx)d |
         put label1=w label2=x label3=y |
         transp memsize=250 plane=12 |
         transp memsize=250 plane=23 
         ''' % par)

    # global slowness perturnation
    Flow('ds',None,
         '''
         spike nsp=1 mag=0.00005
         n1=%(nz)d d1=%(dz)g o1=%(oz)g
         n2=%(nx)d d2=%(dx)g o2=%(ox)g |
         put label1=z label2=x label3=y |
         smooth rect1=1 rect2=1 |
         transp plane=12 |
         transp plane=23 |
         rtoc
         ''' % par)
    Plot('ds','window | real | transp |'+ fdmod.cgrey('pclip=99.9',par))

    # ------------------------------------------------------------
    # zero-offset
    # ------------------------------------------------------------
    # data
    zomig.model3('Zmod','slo','img',par)
    Flow('Zdat','Zmod',
         '''
         transp plane=23 |
         transp plane=12 |
         pad beg1=%(begw)d n1out=%(padw)d |
         fft1 inv=y |
         put o1=0 label1=t label2=x
         ''' % par)
    Result('Zdat',fdmod.dgrey('screenratio=0.5 screenht=7',par))
    
    # wavefield
    zomig.Awftwo3('woz','Zmod','slo',par)

    # migration
    zomig.image3('Zimg','slo','Zmod',par)
    Plot(  'Zimg','window | transp |' + fdmod.cgrey('',par))
    Result('Zimg','Zimg','Overlay')

    # WEMVA zero-offset
    zomig.s2i(  'ds' ,'ZFds','woz','slo',par) # forward   F(ds)
    zomig.i2s('ZFds','ZAFds','woz','slo',par) # adjoint A(F(ds))
    Result( 'ZFds','window | real | transp |'+ fdmod.cgrey('',par))
    Result('ZAFds','window | real | transp |'+ fdmod.cgrey('pclip=98',par))

    # ------------------------------------------------------------
    # shot-record 
    # ------------------------------------------------------------
    # data
    spmig.modelPW3('Smod','slo','sou','ref',par)
    Flow('Sdat','Smod',
         '''
         transp plane=23 |
         transp plane=12 |
         pad beg1=%(begw)d n1out=%(padw)d |
         fft1 inv=y |
         window f1=%(kt)d |
         pad n1out=%(nt)d |
         put o1=0 o2=%(xoff)g o3=%(xsou)g
         ''' % par)
    Result('Sdat',
           fdmod.dgrey('min2=%g max2=%g label2="Offset" screenratio=0.5 screenht=7'
                       %(par['xoff'],-par['xoff']),par))
    
    # wavefields
    spmig.wflds  ('dos','dor','wvl','Sdat',par)
    zomig.Cwfone3('wos','dos','slo',par) #   source
    zomig.Awfone3('wor','dor','slo',par) # receiver
    
    # migration
    spmig.imagePW3('Simg','cig','slo','dos','dor',par)
    Plot(  'Simg','window | transp |'+ fdmod.cgrey('',par))
    Result('Simg','Simg ss','Overlay')

    # WEMVA shot-record
    spmig.s2i(  'ds', 'SFds','wos','wor','slo',par) # forward   F(ds)
    spmig.i2s('SFds','SAFds','wos','wor','slo',par) # adjoint A(F(ds))
    Result( 'SFds','window | real | transp |'+ fdmod.cgrey('',par))
    Result('SAFds','window | real | transp |'+ fdmod.cgrey('pclip=98',par))

    # ------------------------------------------------------------
    for ispk in range(par['nspk']):
        i = par['ospk'] + ispk
        tag = str(i)

        par['xx']=par['nx']/2+i*par['jspk']
        par['xs']=par['xx']    # x start
        par['xe']=par['xx']    # x end
        par['zs']=par['nz']/2  # z start
        par['ze']=par['nz']/2  # z end

        # slowness perturbation
        Flow('ds'+tag,None,
             '''
             spike nsp=1 mag=1
             n1=%(nz)d d1=%(dz)g o1=%(oz)g k1=%(zs)d l1=%(ze)d
             n2=%(nx)d d2=%(dx)g o2=%(ox)g k2=%(xs)d l2=%(xe)d |
             put label1=z label2=x label3=y |
             smooth rect1=6 rect2=2 repeat=3 |
             scale axis=123 |
             scale rscale=0.00005 |
             transp plane=12 |
             transp plane=23 |
             rtoc
             ''' % par)
        Result('ds'+tag,'window | real | transp |'+ fdmod.cgrey('',par))

        # image perturbation
        Flow('di'+tag,'ZFds msk',
             '''
             window squeeze=n n1=1 f1=%(xx)d |
             pad beg1=%(xx)d n1out=%(nx)d |
             put o1=%(ox)g |
             math m=${SOURCES[1]} output="input*m"
             ''' %par)
        Result('di'+tag,'window | real | transp | smooth rect2=3 repeat=3 |'+ fdmod.cgrey('',par))

        # WEMVA zero-offset
        zomig.s2i(  'ds'+tag, 'ZFds'+tag,'woz','slo',par) # forward   F(ds)
        zomig.i2s('ZFds'+tag,'ZAFds'+tag,'woz','slo',par) # adjoint A(F(ds))
        zomig.i2s(  'di'+tag, 'ZAdi'+tag,'woz','slo',par) # adjoint   A(di)
        zomig.s2i('ZAdi'+tag,'ZFAdi'+tag,'woz','slo',par) # forward F(A(di))

        Result(   'ZFds'+tag,'window | real | transp |'+ fdmod.cgrey('',par))
        Result(  'ZAFds'+tag,'window | real | transp |'+ fdmod.cgrey('pclip=99.9',par))
        Result(   'ZAdi'+tag,'window | real | transp |'+ fdmod.cgrey('pclip=99.9',par))
        Result(  'ZFAdi'+tag,'window | real | transp |'+ fdmod.cgrey('',par))

        # WEMVA shot-record
        spmig.s2i(  'ds'+tag, 'SFds'+tag,'wos','wor','slo',par) # forward   F(ds)
        spmig.i2s('SFds'+tag,'SAFds'+tag,'wos','wor','slo',par) # adjoint A(F(ds))
        spmig.i2s(  'di'+tag, 'SAdi'+tag,'wos','wor','slo',par) # adjoint   A(di)
        spmig.s2i('SAdi'+tag,'SFAdi'+tag,'wos','wor','slo',par) # forward F(A(di))

        Result(   'SFds'+tag,'window | real | transp |'+ fdmod.cgrey('',par))
        Result(  'SAFds'+tag,'window | real | transp |'+ fdmod.cgrey('pclip=99.9',par))
        Result(   'SAdi'+tag,'window | real | transp |'+ fdmod.cgrey('pclip=99.9',par))
        Result(  'SFAdi'+tag,'window | real | transp |'+ fdmod.cgrey('',par))
Example #20
0
def run(par):
    # ------------------------------------------------------------
    fdmod.point('ss1',par['xsou1'],par['oz'],par)
    fdmod.point('ss2',par['xsou2'],par['oz'],par)
    Plot('ss1','window      |' + fdmod.ssplot('plotcol=5',par))
    Plot('ss2','window      |' + fdmod.ssplot('plotcol=5',par))

    # ------------------------------------------------------------
    # velocity
    Plot(  'vel',fdmod.cgrey('bias=4.8 allpos=y pclip=99 color=j',par))
    Result('vel','vel ss1 ss2','Overlay')

    # slowness
    Flow('slo','vel',
         '''
         math output=1/input |
         transp |
         transp plane=23 |
         put o2=0 d2=1 label2=y
         ''')
    Result('slo','window | transp |'
           + fdmod.cgrey('allpos=y pclip=95 bias=0.125',par))

    # reflectivity
    Flow('ref','del',
         '''
         transp |
         transp plane=23 |
         put o2=0 d2=1 label2=y
         ''')
    Result('ref','window | transp |' + fdmod.cgrey('pclip=99',par))
    
    # ------------------------------------------------------------
    # wavelet
    fdmod.wavelet('wav',8,par)
    Result('wav','window n1=500 |' + fdmod.waveplot('',par))

    # ------------------------------------------------------------
    for i in ('1','2'):
        Flow('spk'+i,'wav',
             '''
             pad beg2=%d n2out=%d |
             put o2=%g d2=%g
             ''' % ( (par['xsou'+i]-par['ox'])/par['dx'],par['nx'],par['ox'],par['dx']) )
        Result('spk'+i,fdmod.dgrey('pclip=100',par))
        
    # ------------------------------------------------------------
    for i in ('1','2'):
        # source wavefield (from time to frequency)
        zomig.wflds('dds'+i,'spk'+i,par)
        
        # wavefield extrapolation MODELING
        spmig.modelPW3('ddr'+i,'slo','dds'+i,'ref',par)
        
    # ------------------------------------------------------------
    # shots 1 and 2
    Flow('dds0','dds1 dds2','add ${SOURCES[1]}')
    Flow('ddr0','ddr1 ddr2','add ${SOURCES[1]}') # both shots

    for i in ('1','2','0'):
        Result('dds'+i,'window | real | smooth rect1=5 | sfgrey pclip=100')
        Result('ddr'+i,'window | real | smooth rect1=5 | sfgrey pclip=100')

    # ------------------------------------------------------------
    # available dds[0,1,2], ddr[0,1,2], slo
    # ------------------------------------------------------------
    for i in ('1','2','0'):
        # recorded data (from frequency to time) 
        Flow('ttr'+i,'ddr'+i,
             '''
             window |
             transp |
             pad beg1=%(fw)d n1out=%(kw)d |
             fft1 inv=y opt=n
             ''' % par)
        Result('ttr'+i,fdmod.dgrey('pclip=100 min1=1 max1=6 screenratio=0.5 screenht=7',par))
    
        # wavefield extrapolation MIGRATION
        spmig.imagePW3('ii'+i,'cc'+i,'slo','dds'+i,'ddr'+i,par)
        Plot(  'ii'+i,'window min1=%(lox)d max1=%(hix)d | transp |' %par
               + fdmod.cgrey('pclip=99',par))
        Result('ii'+i,['ii'+i,'ss1','ss2'],'Overlay')

    Flow('ii','ii1 ii2','add ${SOURCES[1]}')
    Plot('ii','window min1=%(lox)d max1=%(hix)d | transp |' %par
         + fdmod.cgrey('pclip=100',par))
    Result('ii',['ii','ss1','ss2'],'Overlay')
    
    # ------------------------------------------------------------
    # datuming
    zomig.Cwfone3('wfs','dds0','slo',par) # source wavefield for one shot
    zomig.Awfone3('wfr','ddr0','slo',par) # receiver wavefield for two shots

    # ------------------------------------------------------------
    # data in the time domain
    for k in ('s','r'):    
        Flow('q'+k,'wf'+k,
             '''
             window min1=%(lox)d max1=%(hix)d j1=2 j3=2 |
             transp plane=23 memsize=500 |
             transp plane=12 memsize=500 |
             pad beg1=%(fw)d n1out=%(kw)d |
             fft1 inv=y opt=n |
             window max1=%(tcut)g
             ''' % par)
        
        Plot('q'+k,'window j3=10 |' +
             fdmod.dgrey('gainpanel=a pclip=99',par),view=1)

    Flow(  'qi','qs qr','add mode=p ${SOURCES[1]}')
    Plot('qi','window j3=10 |'
           + fdmod.dgrey('gainpanel=a pclip=100',par),view=1)
        
    # SIC
    Flow('kk',['qs','qr'],
         '''
         sic3d ur=${SOURCES[1]} nbuf=500 verb=y stack=n
         oanga=%(oanga)g nanga=%(nanga)d danga=%(danga)g
         oangb=%(oangb)g nangb=%(nangb)d dangb=%(dangb)g
         nl=%(nl)d dl=%(dl)g
         sig=%(sig)g
         ''' % par)
    
    Plot('kk','transp plane=23 | stack | transp |'
           + fdmod.cgrey('pclip=100',par))
    Result('kk',['kk','ss1','ss2'],'Overlay')
Example #21
0
def run(par):
    # experiments
    fdmod.horizontal('rr', 0, par)

    Plot('rr', 'window j2=10|' + fdmod.rrplot('', par))
    Plot('ss', 'window      |' + fdmod.ssplot('', par))
    Plot('sx', 'window      |' + fdmod.ssplot('plotcol=5', par))

    # wavelet
    fdmod.wavelet('wav_', par['frq'], par)
    Flow('wav', 'wav_', 'transp')
    Result('wav', 'window n2=200 |' + fdmod.waveplot('', par))

    # velocity
    Flow(
        'vbck', None, '''
         math n1=%(nz)d o1=%(oz)g d1=%(dz)g output="2000" |
         spray axis=2 n=%(nx)d o=%(ox)g d=%(dx)g
         ''' % par)
    Flow(
        'vprt', None, '''
         spike nsp=1 mag=1
         n1=%(nz)d o1=%(oz)g d1=%(dz)g k1=%(kz)d l1=%(mz)d
         n2=%(nx)d o2=%(ox)g d2=%(dx)g k2=%(kx)d l2=%(mx)d |
         smooth rect1=25 rect2=25 repeat=3 |
         scale axis=123 |
         scale rscale=%(vprt)g
         ''' % par)
    Flow('velo', 'vbck vprt', 'add ${SOURCES[1]}')
    Plot('velo', fdmod.cgrey('allpos=y bias=1200 pclip=100 color=g', par))
    Result('velo', ['velo', 'ss', 'sx'], 'Overlay')

    # density
    Flow('dens', 'velo', 'math output=1')

    # reflector
    Plot(
        'refl', 'refl velo', '''
         depth2time velocity=${SOURCES[1]} dt=%(dt)g nt=%(nt)d |
         scale rscale=-1 |
         ricker1 frequency=%(frq)g |
         time2depth velocity=${SOURCES[1]} dz=%(dz)g nz=%(nz)d |
         ''' % par + fdmod.cgrey('pclip=100', par))
    Result('refl', ['refl', 'ss', 'sx'], 'Overlay')

    # mask
    Flow(
        'mask', None, '''
         spike nsp=1 mag=1
         n1=%(nx)d o1=%(ox)g d1=%(dx)g k1=101 l1=900
         n2=%(nt)d o2=%(ot)g d2=%(dt)g |
         smooth rect1=100 |
         scale axis=123
         ''' % par)
    Result('mask', 'transp |' + fdmod.dgrey('allpos=y pclip=100', par))

    # F-D modeling (born)
    fdmod.lwefd1('do', 'wo', 'dd', 'wd', 'wav', 'velo', 'dens', 'refl', 'ss',
                 'rr', 'jsnap=100', par)
    Result(
        'do', 'transp | window min1=0.25 |' +
        fdmod.dgrey('min1=0.25 pclip=100', par))
    Result(
        'dd', 'transp | window min1=0.25 |' +
        fdmod.dgrey('min1=0.25 pclip=100', par))
    Result('wo', fdmod.wgrey('', par))
    Result('wd', fdmod.wgrey('', par))

    # source data and wavefield
    fdmod.awefd1('ds', 'ws', 'wav', 'velo', 'dens', 'sx', 'rr', '', par)
    Result('ws', 'window j3=20 |' + fdmod.wgrey('', par))

    # receiver wavefield
    Flow('du', 'dd mask',
         'add mode=p ${SOURCES[1]} | reverse which=2 opt=i verb=y')
    fdmod.awefd('dx', 'wx', 'du', 'velo', 'dens', 'rr', 'rr', '', par)
    Flow('dr', 'dx', 'reverse which=2 opt=i verb=y')
    Flow('wr', 'wx', 'reverse which=4 opt=i verb=y')
    Result('wr', 'window j3=20 |' + fdmod.wgrey('', par))

    for i in range(0, par['nt'] / 100, 1):
        fdmod.wframe('wo' + '-' + str(i), 'wo', i, 'pclip=99.9', par)
        fdmod.wframe('wd' + '-' + str(i), 'wd', i, 'pclip=100', par)

    for i in range(0, par['nt'] / 100, 1):
        fdmod.wframe('wx' + '-' + str(i), 'wx', i * 25, 'pclip=99.9', par)

    # ------------------------------------------------------------
    minx = 500
    maxx = 1500
    minz = par['oz'] + par['nz'] * par['dz'] / 2
    numz = par['nz'] / 2

    mint = 0.1
    numt = 150
    maxt = mint + numt * par['dt'] * par['jsnap']

    # wavefield
    for i in ('s', 'r'):
        Flow(
            'u' + i, 'w' + i, '''
             window min1=%(zmin)g max1=%(zmax)g min2=%(xmin)g max2=%(xmax)g |
             scale axis=123
             ''' % par)
        Plot('u' + i, 'window j3=10 |' + fdmod.wgrey('pclip=99', par), view=1)

        for k in range(0, par['nt'] / par['jsnap'], 25):
            fdmod.wframe('u' + i + '-' + str(k / 25), 'u' + i, k, 'pclip=99',
                         par)

        # windowed wavefields
        Flow(
            'p' + i, 'u' + i, '''
             window min1=%g n1=%g min2=%g max2=%g min3=%g n3=%g
             ''' % (minz, numz, minx, maxx, mint, numt))
        Flow('q' + i, 'p' + i, 'transp plane=13 memsize=500')
        Flow('o' + i, 'q' + i, 'transp plane=23 memsize=500')

    Flow('qi', 'qs qr', 'add mode=p ${SOURCES[1]}')
    Flow('oi', 'os or', 'add mode=p ${SOURCES[1]}')

    for i in ('s', 'r', 'i'):
        Plot('q' + i,
             'window j3=10 |' + fdmod.dgrey('gainpanel=a pclip=100', par),
             view=1)
        Plot('o' + i,
             'window j3=10 | transp |' +
             fdmod.egrey('gainpanel=a pclip=100', par),
             view=1)

        Flow(['q' + i + 'plt', 'q' + i + 'bar'], 'q' + i,
             'byte bar=${TARGETS[1]} gainpanel=a pclip=100')
        for k in range(10):
            Result(
                'q' + i + 'plt' + str(k), ['q' + i + 'plt', 'q' + i + 'bar'],
                'window n3=1 f3=%d |' % (10 * k) + fdmod.dgrey(
                    '''
                bar=${SOURCES[1]} min1=%g max1=%g min2=%g max2=%g
                labelsz=8 labelfat=3 screenratio=1.5
                ''' % (mint, maxt, minx, maxx), par))

    # cut along the reflectors
    Flow(
        'cut', 'refl', '''
         window min1=%g n1=%g min2=%g max2=%g |
         spray axis=3 n=%d o=%g d=%g |
         transp plane=13 memsize=500
         ''' % (minz, numz, minx, maxx, numt, 0.1, par['dt'] * 4))

    for i in ('s', 'r'):
        Flow(
            'c' + i, ['q' + i, 'cut'], '''
             add mode=p ${SOURCES[1]} |
             transp plane=23 |
             stack
             ''')
        Result('c' + i, fdmod.dgrey('', par))

        Flow('f' + i, 'q' + i, 'window n3=1 min3=300')
        Result('f' + i, fdmod.dgrey('', par))

    # ------------------------------------------------------------
    # conventional IC
    Flow('ii', ['ps', 'pr'], 'ic ur=${SOURCES[1]} version=0 nbuf=500 verb=y')
    Plot('ii', fdmod.cgrey('pclip=99.9', par))
    Result('ii', ['ii', 'ss', 'sx'], 'Overlay')
Example #22
0
def test(vp, vs, ro, epsilon, delta, ss, rr, par):
    # ------------------------------------------------------------
    # source/receiver coordinates
    Plot(
        rr, 'window n1=2 | dd type=complex | window j2=10 | ' +
        fdmod.cgraph('wantscalebar=y symbol=o plotcol=1', par))
    Plot(
        ss, 'window n1=2 | dd type=complex | window | ' +
        fdmod.cgraph('wantscalebar=y symbol=x plotcol=2', par))

    # ------------------------------------------------------------
    # acoustic source
    fdmod.wavelet('wava0', par['frq'], par)
    Flow('wava', 'wava0', 'transp')
    Result(
        'wava', 'transp | window n1=500 |' +
        fdmod.waveplot('title="Acoustic source"', par))

    # ------------------------------------------------------------
    # elastic source
    fdmod.wavelet('hor0', par['frq'], par)
    fdmod.wavelet('ver0', par['frq'], par)
    Flow('hor', 'hor0', 'math output=input*%(hscale)g' % par)
    Flow('ver', 'ver0', 'math output=input*%(vscale)g' % par)

    Flow('wave0', 'ver hor', 'cat axis=2 space=n ${SOURCES[1:2]}')
    Flow(
        'wave', 'wave0', '''
         transp plane=12 |
         transp plane=23 |
         transp plane=12
         ''')

    Plot(
        'ver', 'wave', 'window n2=1 f2=0 | window n1=500 |' +
        fdmod.waveplot('title="Elastic vertical source"', par))
    Plot(
        'hor', 'wave', 'window n2=1 f2=1 | window n1=500 |' +
        fdmod.waveplot('title="Elastic horizontal source"', par))
    Result('wave', 'hor ver', 'Movie')

    # ------------------------------------------------------------
    Plot(vp, fdmod.cgrey('wantscalebar=y allpos=y bias=1.0    pclip=100', par))
    Plot(vs, fdmod.cgrey('wantscalebar=y allpos=y bias=1.0    pclip=100', par))
    Plot(ro, fdmod.cgrey('wantscalebar=y allpos=y bias=100000 pclip=100', par))
    Plot(epsilon,
         fdmod.cgrey('wantscalebar=y allpos=y             pclip=100', par))
    Plot(delta,
         fdmod.cgrey('wantscalebar=y allpos=y             pclip=100', par))

    Result(vp, [vp, ss, rr], 'Overlay')
    Result(vs, [vs, ss, rr], 'Overlay')
    Result(ro, [ro, ss, rr], 'Overlay')
    Result(epsilon, [epsilon, ss, rr], 'Overlay')
    Result(delta, [delta, ss, rr], 'Overlay')

    fdmod.anisotropic('cc', 'vp', 'vs', 'ro', 'epsilon', 'delta', par)

    # ------------------------------------------------------------
    # acoustic modeling
    amodel('da', 'wa', 'wava', vp, ro, ss, rr, '', par)

    Flow(
        'waw', 'wa', '''
         window min1=%g max1=%g min2=%g max2=%g |
         scale axis=123
         ''' % (par['zmin'], par['zmax'], par['xmin'], par['xmax']))

    Result('wa', fdmod.wgrey('pclip=99 title="Acoustic wavefield"', par))
    Result(
        'da',
        'transp | window f1=%(kt)d | put o1=%(ot)g | pad end1=%(kt)d |' % par +
        fdmod.dgrey('pclip=99 title="Acoustic data" grid=y', par))

    # elastic modeling
    emodel('de', 'we', 'wave', 'cc', ro, ss, rr, 'ssou=%(ssou)s opot=n' % par,
           par)

    for i in range(2):
        Flow(
            'we' + str(i + 1), 'we', '''
             window n3=1 f3=%d |
             window min1=%g max1=%g min2=%g max2=%g |
             scale axis=123
             ''' % (i, par['zmin'], par['zmax'], par['xmin'], par['xmax']))

        Result('we' + str(i + 1),
               fdmod.wgrey('title=u%s pclip=99' % str(i + 1), par))
        Result(
            'de' + str(i + 1), 'de', '''
               window n2=1 f2=%d |
               transp |
               window f1=%d | put o1=%g | pad end1=%d |
               ''' % (i, par['kt'], par['ot'], par['kt']) +
            fdmod.dgrey('title=u%s pclip=99 grid=y' % str(i + 1), par))

    Flow('weall', 'we1 we2', 'cat axis=1 space=n ${SOURCES[1]}')
    Result(
        'weall', '''
           grey title="Elastic Wavefields" wantaxis=y screenratio=%f screenht=8
           gainpanel=a pclip=99
           grid1=y grid2=y g1num=0.25 g2num=0.25
           ''' % (2 * par['ratio']))

    Flow('wall', 'waw we1 we2', 'cat axis=1 space=n ${SOURCES[1:3]}')
    Result(
        'wall', '''
           grey title="" wantaxis=y screenratio=%f screenht=10
           gainpanel=a pclip=99
           grid1=y grid2=y g1num=0.1 g2num=0.1
           ''' % (3 * par['ratio']))

    # wavefield movie frames
    for j in range(0, par['nt'] / par['jsnap'], 1):
        fdmod.wframe('wa-' + str(j), 'wa', j, 'pclip=99.9', par)
        fdmod.wframe('we1-' + str(j), 'we1', j, 'pclip=99.9', par)
        fdmod.wframe('we2-' + str(j), 'we2', j, 'pclip=99.9', par)
Example #23
0
def run(par):
    # ------------------------------------------------------------
    fdmod.point('ss1', par['xsou1'], par['oz'], par)
    fdmod.point('ss2', par['xsou2'], par['oz'], par)
    Plot('ss1', 'window      |' + fdmod.ssplot('plotcol=5', par))
    Plot('ss2', 'window      |' + fdmod.ssplot('plotcol=5', par))

    # ------------------------------------------------------------
    # velocity
    Plot('vel', fdmod.cgrey('bias=4.8 allpos=y pclip=99 color=j', par))
    Result('vel', 'vel ss1 ss2', 'Overlay')

    # slowness
    Flow(
        'slo', 'vel', '''
         math output=1/input |
         transp |
         transp plane=23 |
         put o2=0 d2=1 label2=y
         ''')
    Result(
        'slo',
        'window | transp |' + fdmod.cgrey('allpos=y pclip=95 bias=0.125', par))

    # reflectivity
    Flow(
        'ref', 'del', '''
         transp |
         transp plane=23 |
         put o2=0 d2=1 label2=y
         ''')
    Result('ref', 'window | transp |' + fdmod.cgrey('pclip=99', par))

    # ------------------------------------------------------------
    # wavelet
    fdmod.wavelet('wav', 8, par)
    Result('wav', 'window n1=500 |' + fdmod.waveplot('', par))

    # ------------------------------------------------------------
    for i in ('1', '2'):
        Flow(
            'spk' + i, 'wav', '''
             pad beg2=%d n2out=%d |
             put o2=%g d2=%g
             ''' % ((par['xsou' + i] - par['ox']) / par['dx'], par['nx'],
                    par['ox'], par['dx']))
        Result('spk' + i, fdmod.dgrey('pclip=100', par))

    # ------------------------------------------------------------
    for i in ('1', '2'):
        # source wavefield (from time to frequency)
        zomig.wflds('dds' + i, 'spk' + i, par)

        # wavefield extrapolation MODELING
        spmig.modelPW3('ddr' + i, 'slo', 'dds' + i, 'ref', par)

    # ------------------------------------------------------------
    # shots 1 and 2
    Flow('dds0', 'dds1 dds2', 'add ${SOURCES[1]}')
    Flow('ddr0', 'ddr1 ddr2', 'add ${SOURCES[1]}')  # both shots

    for i in ('1', '2', '0'):
        Result('dds' + i, 'window | real | smooth rect1=5 | sfgrey pclip=100')
        Result('ddr' + i, 'window | real | smooth rect1=5 | sfgrey pclip=100')

    # ------------------------------------------------------------
    # available dds[0,1,2], ddr[0,1,2], slo
    # ------------------------------------------------------------
    for i in ('1', '2', '0'):
        # recorded data (from frequency to time)
        Flow(
            'ttr' + i, 'ddr' + i, '''
             window |
             transp |
             pad beg1=%(fw)d n1out=%(kw)d |
             fft1 inv=y opt=n
             ''' % par)
        Result(
            'ttr' + i,
            fdmod.dgrey('pclip=100 min1=1 max1=6 screenratio=0.5 screenht=7',
                        par))

        # wavefield extrapolation MIGRATION
        spmig.imagePW3('ii' + i, 'cc' + i, 'slo', 'dds' + i, 'ddr' + i, par)
        Plot(
            'ii' + i, 'window min1=%(lox)d max1=%(hix)d | transp |' % par +
            fdmod.cgrey('pclip=99', par))
        Result('ii' + i, ['ii' + i, 'ss1', 'ss2'], 'Overlay')

    Flow('ii', 'ii1 ii2', 'add ${SOURCES[1]}')
    Plot(
        'ii', 'window min1=%(lox)d max1=%(hix)d | transp |' % par +
        fdmod.cgrey('pclip=100', par))
    Result('ii', ['ii', 'ss1', 'ss2'], 'Overlay')

    # ------------------------------------------------------------
    # datuming
    zomig.Cwfone3('wfs', 'dds0', 'slo', par)  # source wavefield for one shot
    zomig.Awfone3('wfr', 'ddr0', 'slo',
                  par)  # receiver wavefield for two shots

    # ------------------------------------------------------------
    # data in the time domain
    for k in ('s', 'r'):
        Flow(
            'q' + k, 'wf' + k, '''
             window min1=%(lox)d max1=%(hix)d j1=2 j3=2 |
             transp plane=23 memsize=500 |
             transp plane=12 memsize=500 |
             pad beg1=%(fw)d n1out=%(kw)d |
             fft1 inv=y opt=n |
             window max1=%(tcut)g
             ''' % par)

        Plot('q' + k,
             'window j3=10 |' + fdmod.dgrey('gainpanel=a pclip=99', par),
             view=1)

    Flow('qi', 'qs qr', 'add mode=p ${SOURCES[1]}')
    Plot('qi',
         'window j3=10 |' + fdmod.dgrey('gainpanel=a pclip=100', par),
         view=1)

    # SIC
    Flow(
        'kk', ['qs', 'qr'], '''
         sic3d ur=${SOURCES[1]} nbuf=500 verb=y stack=n
         oanga=%(oanga)g nanga=%(nanga)d danga=%(danga)g
         oangb=%(oangb)g nangb=%(nangb)d dangb=%(dangb)g
         nl=%(nl)d dl=%(dl)g
         sig=%(sig)g
         ''' % par)

    Plot('kk',
         'transp plane=23 | stack | transp |' + fdmod.cgrey('pclip=100', par))
    Result('kk', ['kk', 'ss1', 'ss2'], 'Overlay')
Example #24
0
def test(vp,vs,ro,epsilon,delta,ss,rr,par):
    # ------------------------------------------------------------
    # source/receiver coordinates
    Plot(rr,'window n1=2 | dd type=complex | window j2=10 | '
         + fdmod.cgraph('wantscalebar=y symbol=o plotcol=1',par))
    Plot(ss,'window n1=2 | dd type=complex | window | '
         + fdmod.cgraph('wantscalebar=y symbol=x plotcol=2',par))

    # ------------------------------------------------------------
    # acoustic source
    fdmod.wavelet('wava0',par['frq'],par)
    Flow(  'wava','wava0','transp')
    Result('wava','transp | window n1=500 |' + fdmod.waveplot('title="Acoustic source"',par))
    
    # ------------------------------------------------------------
    # elastic source
    fdmod.wavelet('hor0',par['frq'],par)
    fdmod.wavelet('ver0',par['frq'],par)
    Flow('hor','hor0','math output=input*%(hscale)g' % par)
    Flow('ver','ver0','math output=input*%(vscale)g' % par)

    Flow('wave0','ver hor','cat axis=2 space=n ${SOURCES[1:2]}')
    Flow('wave','wave0',
         '''
         transp plane=12 |
         transp plane=23 |
         transp plane=12
         ''')
    
    Plot('ver','wave','window n2=1 f2=0 | window n1=500 |' + fdmod.waveplot('title="Elastic vertical source"',par))
    Plot('hor','wave','window n2=1 f2=1 | window n1=500 |' + fdmod.waveplot('title="Elastic horizontal source"',par))
    Result('wave','hor ver','Movie')

    # ------------------------------------------------------------
    Plot(vp,     fdmod.cgrey('wantscalebar=y allpos=y bias=1.0    pclip=100',par))
    Plot(vs,     fdmod.cgrey('wantscalebar=y allpos=y bias=1.0    pclip=100',par))
    Plot(ro,     fdmod.cgrey('wantscalebar=y allpos=y bias=100000 pclip=100',par))
    Plot(epsilon,fdmod.cgrey('wantscalebar=y allpos=y             pclip=100',par))
    Plot(delta,  fdmod.cgrey('wantscalebar=y allpos=y             pclip=100',par))

    Result(vp,     [vp,     ss,rr],'Overlay')
    Result(vs,     [vs,     ss,rr],'Overlay')
    Result(ro,     [ro,     ss,rr],'Overlay')
    Result(epsilon,[epsilon,ss,rr],'Overlay')
    Result(delta,  [delta,  ss,rr],'Overlay')

    fdmod.anisotropic('cc','vp','vs','ro','epsilon','delta',par)

    # ------------------------------------------------------------
    # acoustic modeling
    amodel('da','wa','wava',vp,ro,ss,rr,'',par)
    
    Flow('waw','wa',
         '''
         window min1=%g max1=%g min2=%g max2=%g |
         scale axis=123
         ''' % (par['zmin'],par['zmax'],par['xmin'],par['xmax']))
    
    Result('wa',          fdmod.wgrey('pclip=99 title="Acoustic wavefield"',par))
    Result('da','transp | window f1=%(kt)d | put o1=%(ot)g | pad end1=%(kt)d |' % par
           + fdmod.dgrey('pclip=99 title="Acoustic data" grid=y',par))

    # elastic modeling
    emodel('de','we','wave','cc',ro,ss,rr,'ssou=%(ssou)s opot=n' % par,par)
    
    for i in range(2):
        Flow('we'+str(i+1),'we',
             '''
             window n3=1 f3=%d |
             window min1=%g max1=%g min2=%g max2=%g |
             scale axis=123
             ''' % (i,par['zmin'],par['zmax'],par['xmin'],par['xmax']))
        
        Result('we'+str(i+1),
               fdmod.wgrey('title=u%s pclip=99' % str(i+1),par))
        Result('de'+str(i+1),'de',
               '''
               window n2=1 f2=%d |
               transp |
               window f1=%d | put o1=%g | pad end1=%d |
               ''' % (i,par['kt'],par['ot'],par['kt'])
               + fdmod.dgrey('title=u%s pclip=99 grid=y' %str(i+1),par))
    
    Flow(  'weall','we1 we2','cat axis=1 space=n ${SOURCES[1]}')
    Result('weall',
           '''
           grey title="Elastic Wavefields" wantaxis=y screenratio=%f screenht=8
           gainpanel=a pclip=99
           grid1=y grid2=y g1num=0.25 g2num=0.25
           ''' % (2*par['ratio']) )

    Flow('wall','waw we1 we2','cat axis=1 space=n ${SOURCES[1:3]}')
    Result('wall',
           '''
           grey title="" wantaxis=y screenratio=%f screenht=10
           gainpanel=a pclip=99
           grid1=y grid2=y g1num=0.1 g2num=0.1
           ''' % (3*par['ratio']) )


    # wavefield movie frames
    for j in range(0,par['nt']/par['jsnap'],1):
        fdmod.wframe('wa-' +str(j),'wa', j,'pclip=99.9',par)
        fdmod.wframe('we1-'+str(j),'we1',j,'pclip=99.9',par)
        fdmod.wframe('we2-'+str(j),'we2',j,'pclip=99.9',par)
Example #25
0
def run(par):
    # experiments
    fdmod.horizontal('rr',0,par)

    Plot('rr','window j2=10|' + fdmod.rrplot('',par))
    Plot('ss','window      |' + fdmod.ssplot('',par))
    Plot('sx','window      |' + fdmod.ssplot('plotcol=5',par))
    
    # wavelet
    fdmod.wavelet('wav_',par['frq'],par)
    Flow('wav','wav_','transp')
    Result('wav','window n2=200 |' + fdmod.waveplot('',par))
    
    # velocity
    Flow('vbck',None,
         '''
         math n1=%(nz)d o1=%(oz)g d1=%(dz)g output="2000" |
         spray axis=2 n=%(nx)d o=%(ox)g d=%(dx)g
         ''' % par)
    Flow('vprt',None,
         '''
         spike nsp=1 mag=1
         n1=%(nz)d o1=%(oz)g d1=%(dz)g k1=%(kz)d l1=%(mz)d
         n2=%(nx)d o2=%(ox)g d2=%(dx)g k2=%(kx)d l2=%(mx)d |
         smooth rect1=25 rect2=25 repeat=3 |
         scale axis=123 |
         scale rscale=%(vprt)g
         ''' % par)
    Flow(  'velo','vbck vprt','add ${SOURCES[1]}')
    Plot(  'velo',fdmod.cgrey('allpos=y bias=1200 pclip=100 color=g',par))
    Result('velo',['velo','ss','sx'],'Overlay')
    
    # density
    Flow('dens','velo','math output=1')
    
    # reflector
    Plot('refl','refl velo',
         '''
         depth2time velocity=${SOURCES[1]} dt=%(dt)g nt=%(nt)d |
         scale rscale=-1 |
         ricker1 frequency=%(frq)g |
         time2depth velocity=${SOURCES[1]} dz=%(dz)g nz=%(nz)d |
         ''' % par + fdmod.cgrey('pclip=100',par))
    Result('refl',['refl','ss','sx'],'Overlay')

    # mask
    Flow('mask',None,
         '''
         spike nsp=1 mag=1
         n1=%(nx)d o1=%(ox)g d1=%(dx)g k1=101 l1=900
         n2=%(nt)d o2=%(ot)g d2=%(dt)g |
         smooth rect1=100 |
         scale axis=123
         ''' % par)
    Result('mask','transp |' + fdmod.dgrey('allpos=y pclip=100',par))
        
    # F-D modeling (born)
    fdmod.lwefd1(
        'do','wo',
        'dd','wd',
        'wav','velo','dens','refl','ss','rr','jsnap=100',par)
    Result('do','transp | window min1=0.25 |' + fdmod.dgrey('min1=0.25 pclip=100',par))
    Result('dd','transp | window min1=0.25 |' + fdmod.dgrey('min1=0.25 pclip=100',par))
    Plot('wo',fdmod.wgrey('',par),view=1)
    Plot('wd',fdmod.wgrey('',par),view=1)

    # source data and wavefield
    fdmod.awefd1(
        'ds','ws',
        'wav','velo','dens','sx','rr','',par)
    Plot('ws','window j3=20 |' + fdmod.wgrey('',par),view=1)

    # receiver wavefield
    Flow('du','dd mask',
         'add mode=p ${SOURCES[1]} | reverse which=2 opt=i verb=y')
    fdmod.awefd(
        'dx','wx',
        'du','velo','dens','rr','rr','',par)
    Flow('dr','dx','reverse which=2 opt=i verb=y')
    Flow('wr','wx','reverse which=4 opt=i verb=y')
    Plot('wr','window j3=20 |' + fdmod.wgrey('',par),view=1)

    for i in range(0,par['nt']/100,1):
        fdmod.wframe('wo'+'-'+str(i),'wo',i,'pclip=99.9',par)
        fdmod.wframe('wd'+'-'+str(i),'wd',i,'pclip=100',par)

    for i in range(0,par['nt']/100,1):
        fdmod.wframe('wx'+'-'+str(i),'wx',i*25,'pclip=99.9',par)
    
    # ------------------------------------------------------------
    minx=500
    maxx=1500
    minz=par['oz']+par['nz']*par['dz']/2
    numz=par['nz']/2

    mint=0.1
    numt=150
    maxt=mint+numt*par['dt']*par['jsnap']

    # wavefield
    for i in ('s','r'):
        Flow('u'+i,'w'+i,
             '''
             window min1=%(zmin)g max1=%(zmax)g min2=%(xmin)g max2=%(xmax)g |
             scale axis=123
             ''' % par)
        Plot('u'+i,'window j3=10 |' + fdmod.wgrey('pclip=99',par),view=1)

        for k in range(0,par['nt']/par['jsnap'],25):
            fdmod.wframe('u'+i+'-'+str(k/25),'u'+i,k,'pclip=99',par)
        
        # windowed wavefields
        Flow('p'+i,'u'+i,
             '''
             window min1=%g n1=%g min2=%g max2=%g min3=%g n3=%g
             ''' % (minz,numz,
                    minx,maxx,
                    mint,numt))
        Flow('q'+i,'p'+i,'transp plane=13 memsize=500')
        Flow('o'+i,'q'+i,'transp plane=23 memsize=500')
        
    Flow(  'qi','qs qr','add mode=p ${SOURCES[1]}')
    Flow(  'oi','os or','add mode=p ${SOURCES[1]}')
    
    for i in ('s','r','i'):
        Plot('q'+i,'window j3=10 |'
             + fdmod.dgrey('gainpanel=a pclip=100',par),view=1)    
        Plot('o'+i,'window j3=10 | transp |'
             + fdmod.egrey('gainpanel=a pclip=100',par),view=1)
        
        Flow(['q'+i+'plt','q'+i+'bar'],'q'+i,
             'byte bar=${TARGETS[1]} gainpanel=a pclip=100')
        for k in range(10):
            Result('q'+i+'plt'+str(k),['q'+i+'plt','q'+i+'bar'],
                   'window n3=1 f3=%d |' % (10*k) +
                   fdmod.dgrey(
                '''
                bar=${SOURCES[1]} min1=%g max1=%g min2=%g max2=%g
                labelsz=8 labelfat=3 screenratio=1.5
                ''' %(mint,maxt,minx,maxx),par))
        
    # cut along the reflectors
    Flow('cut','refl',
         '''
         window min1=%g n1=%g min2=%g max2=%g |
         spray axis=3 n=%d o=%g d=%g |
         transp plane=13 memsize=500
         ''' % (minz,numz,
                minx,maxx,
                numt,0.1,par['dt']*4) )
    
    for i in ('s','r'):
        Flow('c'+i,['q'+i,'cut'],
             '''
             add mode=p ${SOURCES[1]} |
             transp plane=23 |
             stack
             ''')
        Result('c'+i,fdmod.dgrey('',par))

        Flow(  'f'+i,'q'+i,'window n3=1 min3=300')
        Result('f'+i,fdmod.dgrey('',par))

    # ------------------------------------------------------------
    # conventional IC
    Flow(  'ii',['ps','pr'],'ic ur=${SOURCES[1]} version=0 nbuf=500 verb=y')
    Plot(  'ii',fdmod.cgrey('pclip=99.9',par))
    Result('ii',['ii','ss','sx'],'Overlay')
Example #26
0
def test(par):
    # ------------------------------------------------------------
    # source coordinate
    fdmod.point('ss', par['xsou'], par['zsou'], par)
    Plot('ss', fdmod.ssplot('', par))
    Result('vel', ['vel', 'ss'], 'Overlay')
    Result('ref', ['ref', 'ss'], 'Overlay')
    Result('img', ['img', 'ss'], 'Overlay')

    # slowness
    Flow(
        'slo', 'vel', '''
         transp |
         math "output=1/input" |
         spray axis=2 n=1 |
         put label2=y
         ''' % par)
    Result('slo',
           'window | transp |' + fdmod.cgrey('allpos=y bias=0.065', par))

    # migration wavelet
    Flow(
        'wvl', None, '''
         spike nsp=1 mag=1
         n1=%(nt)d d1=%(dt)g o1=0        k1=1
         n2=1      d2=%(dx)g o2=%(xsou)g |
         scale axis=123 |
         put label1=t label2=x label3=y
         ''' % par)

    # modeling wavelet (time domain)
    Flow(
        'wav', None, '''
         spike nsp=1 mag=1
         n1=%(nt)d d1=%(dt)g o1=0   k1=%(kt)d
         n2=1      d2=%(dx)g o2=%(xsou)g |
         ricker1 frequency=%(frq)g |
         scale axis=123 |
         put label1=t label2=x label3=y
         ''' % par)
    Result('wav', 'window n1=200 |' + fdmod.waveplot('', par))

    # modeling wavelet (frequency domain)
    Flow(
        'sou', 'wav', '''
         fft1 |
         window squeeze=n n1=%(nw)d min1=%(ow)g |
         pad beg2=%(xpad)d n2out=%(nx)d |
         put label1=w label2=x label3=y |
         transp memsize=250 plane=12 |
         transp memsize=250 plane=23 
         ''' % par)

    # global slowness perturnation
    Flow(
        'ds', None, '''
         spike nsp=1 mag=0.00005
         n1=%(nz)d d1=%(dz)g o1=%(oz)g
         n2=%(nx)d d2=%(dx)g o2=%(ox)g |
         put label1=z label2=x label3=y |
         smooth rect1=1 rect2=1 |
         transp plane=12 |
         transp plane=23 |
         rtoc
         ''' % par)
    Plot('ds', 'window | real | transp |' + fdmod.cgrey('pclip=99.9', par))

    # ------------------------------------------------------------
    # zero-offset
    # ------------------------------------------------------------
    # data
    zomig.model3('Zmod', 'slo', 'img', par)
    Flow(
        'Zdat', 'Zmod', '''
         transp plane=23 |
         transp plane=12 |
         pad beg1=%(begw)d n1out=%(padw)d |
         fft1 inv=y |
         put o1=0 label1=t label2=x
         ''' % par)
    Result('Zdat', fdmod.dgrey('screenratio=0.5 screenht=7', par))

    # wavefield
    zomig.Awftwo3('woz', 'Zmod', 'slo', par)

    # migration
    zomig.image3('Zimg', 'slo', 'Zmod', par)
    Plot('Zimg', 'window | transp |' + fdmod.cgrey('', par))
    Result('Zimg', 'Zimg', 'Overlay')

    # WEMVA zero-offset
    zomig.s2i('ds', 'ZFds', 'woz', 'slo', par)  # forward   F(ds)
    zomig.i2s('ZFds', 'ZAFds', 'woz', 'slo', par)  # adjoint A(F(ds))
    Result('ZFds', 'window | real | transp |' + fdmod.cgrey('', par))
    Result('ZAFds', 'window | real | transp |' + fdmod.cgrey('pclip=98', par))

    # ------------------------------------------------------------
    # shot-record
    # ------------------------------------------------------------
    # data
    spmig.modelPW3('Smod', 'slo', 'sou', 'ref', par)
    Flow(
        'Sdat', 'Smod', '''
         transp plane=23 |
         transp plane=12 |
         pad beg1=%(begw)d n1out=%(padw)d |
         fft1 inv=y |
         window f1=%(kt)d |
         pad n1out=%(nt)d |
         put o1=0 o2=%(xoff)g o3=%(xsou)g
         ''' % par)
    Result(
        'Sdat',
        fdmod.dgrey(
            'min2=%g max2=%g label2="Offset" screenratio=0.5 screenht=7' %
            (par['xoff'], -par['xoff']), par))

    # wavefields
    spmig.wflds('dos', 'dor', 'wvl', 'Sdat', par)
    zomig.Cwfone3('wos', 'dos', 'slo', par)  #   source
    zomig.Awfone3('wor', 'dor', 'slo', par)  # receiver

    # migration
    spmig.imagePW3('Simg', 'cig', 'slo', 'dos', 'dor', par)
    Plot('Simg', 'window | transp |' + fdmod.cgrey('', par))
    Result('Simg', 'Simg ss', 'Overlay')

    # WEMVA shot-record
    spmig.s2i('ds', 'SFds', 'wos', 'wor', 'slo', par)  # forward   F(ds)
    spmig.i2s('SFds', 'SAFds', 'wos', 'wor', 'slo', par)  # adjoint A(F(ds))
    Result('SFds', 'window | real | transp |' + fdmod.cgrey('', par))
    Result('SAFds', 'window | real | transp |' + fdmod.cgrey('pclip=98', par))

    # ------------------------------------------------------------
    for ispk in range(par['nspk']):
        i = par['ospk'] + ispk
        tag = str(i)

        par['xx'] = par['nx'] / 2 + i * par['jspk']
        par['xs'] = par['xx']  # x start
        par['xe'] = par['xx']  # x end
        par['zs'] = par['nz'] / 2  # z start
        par['ze'] = par['nz'] / 2  # z end

        # slowness perturbation
        Flow(
            'ds' + tag, None, '''
             spike nsp=1 mag=1
             n1=%(nz)d d1=%(dz)g o1=%(oz)g k1=%(zs)d l1=%(ze)d
             n2=%(nx)d d2=%(dx)g o2=%(ox)g k2=%(xs)d l2=%(xe)d |
             put label1=z label2=x label3=y |
             smooth rect1=6 rect2=2 repeat=3 |
             scale axis=123 |
             scale rscale=0.00005 |
             transp plane=12 |
             transp plane=23 |
             rtoc
             ''' % par)
        Result('ds' + tag, 'window | real | transp |' + fdmod.cgrey('', par))

        # image perturbation
        Flow(
            'di' + tag, 'ZFds msk', '''
             window squeeze=n n1=1 f1=%(xx)d |
             pad beg1=%(xx)d n1out=%(nx)d |
             put o1=%(ox)g |
             math m=${SOURCES[1]} output="input*m"
             ''' % par)
        Result(
            'di' + tag, 'window | real | transp | smooth rect2=3 repeat=3 |' +
            fdmod.cgrey('', par))

        # WEMVA zero-offset
        zomig.s2i('ds' + tag, 'ZFds' + tag, 'woz', 'slo',
                  par)  # forward   F(ds)
        zomig.i2s('ZFds' + tag, 'ZAFds' + tag, 'woz', 'slo',
                  par)  # adjoint A(F(ds))
        zomig.i2s('di' + tag, 'ZAdi' + tag, 'woz', 'slo',
                  par)  # adjoint   A(di)
        zomig.s2i('ZAdi' + tag, 'ZFAdi' + tag, 'woz', 'slo',
                  par)  # forward F(A(di))

        Result('ZFds' + tag, 'window | real | transp |' + fdmod.cgrey('', par))
        Result('ZAFds' + tag,
               'window | real | transp |' + fdmod.cgrey('pclip=99.9', par))
        Result('ZAdi' + tag,
               'window | real | transp |' + fdmod.cgrey('pclip=99.9', par))
        Result('ZFAdi' + tag,
               'window | real | transp |' + fdmod.cgrey('', par))

        # WEMVA shot-record
        spmig.s2i('ds' + tag, 'SFds' + tag, 'wos', 'wor', 'slo',
                  par)  # forward   F(ds)
        spmig.i2s('SFds' + tag, 'SAFds' + tag, 'wos', 'wor', 'slo',
                  par)  # adjoint A(F(ds))
        spmig.i2s('di' + tag, 'SAdi' + tag, 'wos', 'wor', 'slo',
                  par)  # adjoint   A(di)
        spmig.s2i('SAdi' + tag, 'SFAdi' + tag, 'wos', 'wor', 'slo',
                  par)  # forward F(A(di))

        Result('SFds' + tag, 'window | real | transp |' + fdmod.cgrey('', par))
        Result('SAFds' + tag,
               'window | real | transp |' + fdmod.cgrey('pclip=99.9', par))
        Result('SAdi' + tag,
               'window | real | transp |' + fdmod.cgrey('pclip=99.9', par))
        Result('SFAdi' + tag,
               'window | real | transp |' + fdmod.cgrey('', par))