def pmig(data, hdip, ydip, frame1=1, frame2=1, frame3=1): if version.old_version(): return # think how to do it better def Grey3(name, title, color='I', extra=''): Flow('bar' + name, name, 'bar') Result( name, [name, 'bar' + name], ''' byte | transp plane=23 | grey3 title="%s" bar=${SOURCES[1]} frame1=%d frame2=%d frame3=%d color=%s flat=y point1=0.75 point2=0.75 %s ''' % (title, frame1, frame2, frame3, color, extra)) Grey3(data, 'Data') Grey3(hdip, 'Offset Slope', 'j', 'scalebar=y bartype=v') Grey3(ydip, 'Midpoint Slope', 'j', 'scalebar=y bartype=v') nmo = data + '-nmo' vnmo = data + '-vnmo' Flow([nmo, vnmo], [data, hdip], 'pnmo dip=${SOURCES[1]} vel=${TARGETS[1]}') Grey3(nmo, 'Oriented NMO') stk = data + '-stk' Flow(stk, nmo, 'stack') Result(stk, 'grey title="Oriented Stack" wheretitle=t wherexlabel=b') for case in (data, hdip, ydip): Flow(case + '2', case, 'transp plane=23 memsize=500') mig = data + '-mig' Flow( mig, [data + '2', hdip + '2', ydip + '2'], ''' pmig hdip=${SOURCES[1]} xdip=${SOURCES[2]} | transp plane=23 memsize=500 ''') Grey3(mig, 'Oriented Prestack Time Migration') Result( mig + '2', mig, ''' stack | grey title="Oriented Prestack Time Migration" wheretitle=t wherexlabel=b ''') mzo = data + '-mzo' Flow( mzo, [data + '2', hdip + '2', ydip + '2'], ''' pmig hdip=${SOURCES[1]} xdip=${SOURCES[2]} mzo=y | transp plane=23 memsize=500 ''') Grey3(mzo, 'Oriented Migration to Zero Offset') Result( mzo + '2', mzo, 'stack | grey title="Oriented DMO Stack" wheretitle=t wherexlabel=b')
def nwarp2( name, # name prefix pp, ps, # PP and PS images warp, # initial warp nx, # number of traces tmax, # maximum time for display tmin=0, # minimum time for display j2=1, # trace sumsampling trace=None, # seleted trace o2=0, # trace start gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing frame1=10, # time frame ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing rect2=50, # lateral smoothing iter=2, # number of iterations ss=0, # PP-PS (0) or PP-SS (1) inter=1, # interleaving clip=6 # display clip ): if version.old_version(): return # think how to do it better interg = ''' pad n2=%d | put n2=%d n3=%d | stack ''' % ((nx / inter + 1) * inter, inter, nx / inter + 1) inter = 2 * inter interw = ''' pad n2=%d | put n2=%d n3=%d | stack ''' % ((nx / inter + 1) * inter, inter, nx / inter + 1) if trace: for case in (pp, ps, warp): Flow(case + '1', case, 'window n2=1 min2=%d' % trace) warp1(name + 't', pp + '1', ps + '1', warp + '1', tmax, tmin, gmin, gmax, niter, dt, fmin, fmax, frect, ng, g0, pmin, pmax, an, rect1, iter, ss) else: trace = 10 def plot(title): return ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s clip=%g labelfat=3 font=2 titlefat=3 label2=Trace unit2= ''' % (tmin, tmax, title, clip) vplot = plot('Vp/Vs') + ''' clip=%g scalebar=y color=j bias=%g minval=%g maxval=%g ''' % (0.5 * (gmax - gmin), 0.5 * (gmin + gmax), gmin, gmax) balance = ''' nsmooth1 rect=${SOURCES[1]} | abalance rect1=%d rect2=%d order=100 other=${SOURCES[2]} ''' % (rect1, rect2) ifreq = 'iphase rect1=%d rect2=%d order=100' % (2 * rect1, 2 * rect2) def freqplot(title): return ''' scale scale dscale=%g | %s clip=%g bias=%g color=j scalebar=y barlabel="Frequency (Hz)" ''' % (0.5 / (math.pi * dt), plot(title), (fmax - fmin) * 0.25, (fmax + fmin) * 0.5) def specplot(title): return ''' cat axis=2 ${SOURCES[1]} | graph title="%s" max1=%g label1="Frequency (Hz)" dash=0,1 plotfat=7 label2= ''' % (title, 4 * fmax) def giplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | scale axis=1 | grey title="Interleaved (%s)" label1=Time unit1=s label2="Inline" unit2= labelfat=3 font=2 titlefat=3 screenratio=0.6 screenht=8 ''' % (tmin, tmax, title) def wiplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | scale axis=1 | wiggle poly=y transp=y yreverse=y title="Interleaved (%s)" label1=Time unit1=s label2="In-line" ''' % (tmin, tmax, title) Plot(pp, plot('PP')) Flow(pp + 'i', pp, ifreq) Plot(pp + 'i', freqplot('PP Local Frequency')) Result(pp + 'line', pp, 'Overlay') PS = ('PS', 'SS')[ss] Plot( ps, ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s labelfat=3 font=2 titlefat=3 label2=Trace unit2= ''' % (tmin, tmax * 2., PS)) Flow(pp + 's0', pp, 'spectra all=y') scanplot = ''' window min1=%g max1=%g | byte gainpanel=all allpos=y | grey3 frame1=%d frame3=%d frame2=%d color=j flat=n label1=Time unit1=s label3="In-line" label2="Relative Gamma" wanttitle=n ''' % (tmin, tmax, frame1, (trace - o2) / j2, ng / 2) simplot = ''' window min1=%g max1=%g | grey title="%s" allpos=y color=j clip=1 label1="Time (s)" ''' % (tmin, tmax, '%s') warpit = warping(niter, 200, 200) for i in range(iter): wrp = warp ################# # INITIAL WARPING ################# def n(s): return '%s-%s-%d' % (name, s, i) psw = n('psw') Flow(psw, [ps, pp, wrp], warp0) Plot(psw, plot('Warped ' + PS)) dif = n('dif') Plot(dif, [psw, pp], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma') Flow(gamma, wrp, warp2gamma(ss)) Plot(gamma, vplot) Result(psw, [pp, psw, dif, gamma], 'TwoRows') psw1 = n('psw1') pp1 = n('pp1') Flow(pp1, pp, 'window n2=1 f2=286') Flow(psw1, psw, 'window n2=1 f2=286') ppps = n('ppps') Result( ppps, [psw1, pp1], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | dots gaineach=n Xscreenwd=9.225 Xscreenht=5.2 Xyyscale=0.8 labels="Difference:SS warped:PP" label1=Time unit1=s title="LTF transform balancing" ''') #################### # SPECTRAL BALANCING #################### si = n('si') Flow(si, psw, ifreq) Plot(si, freqplot(PS + ' Local Frequency')) ## msk = n('msk') ## Flow(msk,[si,pp+'i'],getmask) ## sr = n('sr') ## pr = n('pr') ## Flow(sr+'0',[msk,si,pp+'i'],psrect(frect)) ## Flow(sr,[psw,sr+'0',pp],balance) ## Flow(pr+'0',[msk,si,pp+'i'],pprect(frect)) ## Flow(pr,[pp,pr+'0',pp],balance) ppltft = n('ppltft') Flow(ppltft, pp, ''' ltft rect=%d verb=n | transp ''' % frect, split=[2, 471], reduce="cat axis=3") Result( ppltft, ''' transp | window max2=100 | math output="abs(input)" | real | byte allpos=y gainpanel=40 pclip=100 | grey3 transp=n yreverse=n color=j title="PP before matched" label1=Time unit1=s frame1=512 frame2=100 frame3=235 point1=0.8 point2=0.3 labelfat=3 font=2 titlefat=3 ''') ppltftspe = n('ppltftspe') Flow( ppltftspe, ppltft, ''' math output="abs(input)" | real ''') pswltft = n('pswltft') Flow(pswltft, psw, ''' ltft rect=%d verb=n | transp ''' % frect, split=[2, 471], reduce="cat axis=3") Result( pswltft, ''' transp | window max2=100 | math output="abs(input)" | real | byte allpos=y gainpanel=40 pclip=100 | grey3 transp=n yreverse=n color=j title="PS warped before matched" label1=Time unit1=s frame1=512 frame2=100 frame3=235 point1=0.8 point2=0.3 labelfat=3 font=2 titlefat=3 ''') pswltftspe = n('pswltftspe') Flow( pswltftspe, pswltft, ''' math output="abs(input)" | real ''') pprick = n('pprick') Flow(pprick, ppltftspe, ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''', stdout=0, split=[2, 1024]) pswrick = n('pswrick') Flow(pswrick, pswltftspe, ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''', stdout=0, split=[2, 1024]) ppshape = n('ppshape') pswshape = n('pswshape') Flow([ppshape, pswshape], [ppltft, pswltft, pprick, pswrick], ''' freshape in2=${SOURCES[1]} ma=${SOURCES[2]} ma2=${SOURCES[3]} out2=${TARGETS[1]} ''') ## Result('ppmorphltft', ## ''' ## transp | window max2=100 | ## math output="abs(input)" | real | ## grey transp=n yreverse=n color=j ## title="PP matched" label1=Time unit1=s ## screenratio=0.35 screenht=5 ## labelfat=3 font=2 titlefat=3 parallel2=n scalebar=y ## ''') ## Result('psmorphltft', ## ''' ## transp | window max2=100 | ## math output="abs(input)" | real | ## grey transp=n yreverse=n color=j ## title="PS matched" label1=Time unit1=s ## screenratio=0.35 screenht=5 ## labelfat=3 font=2 titlefat=3 parallel2=n scalebar=y ## ''') sr = n('sr') pr = n('pr') Flow(pr, ppshape, 'transp | ltft inv=y verb=y') Flow(sr, pswshape, 'transp | ltft inv=y verb=y') ## Plot('ippmorphltft', ## ''' ## graph plotfat=10 label1=Time unit1=s unit2= ## wanttitle=n labelsz=10 label2="PP matched" ## ''') ## Plot('ipsmorphltft', ## ''' ## graph plotfat=10 label1=Time unit1=s unit2= ## wanttitle=n labelsz=10 label2="PS matched" ## ''') ## Result('match','ippmorphltft ipsmorphltft','OverUnderAniso') sr1 = n('sr1') pr1 = n('pr1') Flow(pr1, pr, 'window n2=1 f2=286') Flow(sr1, sr, 'window n2=1 f2=286') ltftppps = n('ltftppps') Result( ltftppps, [sr1, pr1], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | dots gaineach=0 Xscreenwd=9.225 Xscreenht=5.2 Xyyscale=0.8 labels="Difference:PS warped:PP" label1=Time unit1=s title="LTF transform balancing" ''') ## Plot('ltftbefore','pp morph', ## ''' ## cat axis=2 ${SOURCES[1]} | ## spectra | window max1=100 | ## graph dash=0,1 title="Before LTFT matching" max2=2 min2=0 ## label1=Frequency unit1=Hz label2= unit2= ## ''') ## Plot('ltftafter','ippmorphltft ipsmorphltft', ## ''' ## cat axis=2 ${SOURCES[1]} | ## spectra | window max1=100 | ## graph dash=0,1 title="After LTFT matching" max2=2 min2=0 ## label1=Frequency unit1=Hz label2= unit2= ## ''') ## Result('ltftspectra','ltftbefore ltftafter','SideBySideAniso') pi = n('pi') Flow(pi, pr, ifreq) Flow(si + '2', sr, ifreq) Plot(si + '2', freqplot(PS + ' Local Frequency')) Plot(pi, freqplot('PP Local Frequency')) Result(si, [pp + 'i', si, pi, si + '2'], 'TwoRows') s0 = psw + 's0' Flow(s0, psw, 'spectra all=y') Plot(s0, [pp + 's0', s0], specplot('Before')) s1 = psw + 's1' Flow(s1, sr, 'spectra all=y') Flow(pr + 's1', pr, 'spectra all=y') Plot(s1, [pr + 's1', s1], specplot('After')) Result(n('sp'), [s0, s1], 'SideBySideIso') if i == 0: in0 = n('in0') Flow(pr + 'in0', pr, interg) Flow(sr + 'in0', sr, interg) Plot(in0, [pr + 'in0', sr + 'in0'], giplot('Before')) Flow(pr + 'in0w', pr, interw) Flow(sr + 'in0w', sr, interw) Plot(in0 + 'w', [pr + 'in0w', sr + 'in0w'], wiplot('Before')) Result(in0, in0, 'Overlay') Result(in0 + 'w', in0 + 'w', 'Overlay') sim0 = n('sim0') Flow(sim0, [pr, sr], simil(rect1, rect2)) Result(sim0, simplot % 'Before') Plot(sr, plot('Warped and Balanced ' + PS)) Plot(pr, plot('Balanced PP')) dif = dif + '2' Plot(dif, [sr, pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) Result(sr, [pr, sr, dif, gamma], 'TwoRows') ############ # GAMMA SCAN ############ g1 = 2 - g0 warpscan2 = warpscan(ng, g0, g1, rect1, 1, int(0.5 + rect2 / j2)) sc = n('sc') Flow(sr + '2', sr, 'window j2=%d' % j2) Flow(pr + '2', pr, 'window j2=%d' % j2) Flow(sc, [sr + '2', pr + '2'], warpscan2) Result(sc, scanplot) pk = n('pk') if i == 0: Flow( pk + '0', sc, pick(max(pmin, g0), min(pmax, g1), rect1, 4 * rect2 / j2, an=an)) else: Flow(pk + '0', sc, pick(g0, g1, rect1, 4 * rect2 / j2, an=an)) Flow( pk, pk + '0', ''' transp memsize=500 | spline n1=%d d1=1 o1=%g | transp memsize=500 | math output="(input-1)*x1" ''' % (nx, o2)) ######### # WARPING ######### warp = n('wrp') Flow([warp, psw + '2'], [sr, pr, pk, wrp], warpit, stdout=-1) Plot(psw + '2', plot('Warped ' + PS)) dif = n('dif2') Plot(dif, [psw + '2', pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma2') Flow(gamma, warp, warp2gamma(ss)) Plot(gamma, vplot) Result(psw + '2', [pr, psw + '2', dif, gamma], 'TwoRows') if i == iter - 1: in1 = n('in1') Flow(pr + 'in1', pr, interg) Flow(psw + '2in1', psw + '2', interg) Plot(in1, [pr + 'in1', psw + '2in1'], giplot('After')) Flow(pr + 'in1w', pr, interw) Flow(psw + '2in1w', psw + '2', interw) Plot(in1 + 'w', [pr + 'in1w', psw + '2in1w'], wiplot('After')) Result(in1, in1, 'Overlay') Result(in1 + 'w', in1 + 'w', 'Overlay') Result(in0 + '1', [in0, in1], 'SideBySideIso') Result(in0 + '1w', [in0 + 'w', in1 + 'w'], 'OverUnderAniso') sim1 = n('sim1') Flow(sim1, [pr, psw + '2'], simil(rect1, rect2)) Result(sim1, simplot % 'After') Flow(psw + '1', [ps, pp, warp], warp0) Result(psw + '1', plot('Warped ' + PS)) rt = n('rt') Flow(psw + 'i', psw + '1', ifreq) Flow( rt, psw + 'i', ''' math output="sqrt(1+12*(1/input^2-1/%g^2))" | dd type=int ''' % (fmax * 2 * math.pi * dt)) dl = n('dl') Flow( dl, [psw + '1', rt], ''' deblur rect=${SOURCES[1]} verb=y niter=100 eps=0.04 nliter=1 ''') Result( dl, ''' window min1=%g max1=%g | grey title="Deblurred %s" label1="Time (s)" ''' % (tmin, tmax, PS)) Flow('e' + gamma, warp, warp2egamma(ss)) Result(gamma, 'e' + gamma, vplot) g0 = (g0 + 1) * 0.5
def warp1( name, # name prefix pp, ps, # PP and PS images warp, # initial warp tmax, # maximum time for display tmin=0, # minimum time for display gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing iter=2, # number of iterations ss=0): if version.old_version(): return # think how to do it better graph = ''' graph wanttitle=n min2=%g max2=%g min1=%g max1=%g wherexlabel=t wheretitle=b crowd=0.8 label2="Vp/Vs" ''' % (gmin, gmax, tmin, tmax) dplot = ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | window min1=%g max1=%g | dots gaineach=0 labels="Difference:PS warped:PP" label1=Time unit1=s ''' % (tmin, tmax) def iphase(title): return ''' cat axis=2 ${SOURCES[1]} | scale dscale=%g | graph title="Local Frequency (%s)" label1="Time (s)" min2=%g max2=%g min1=%g max1=%g dash=0,1 label2="Frequency (Hz)" ''' % (0.5 / (math.pi * dt), title, fmin, fmax, tmin, tmax) warpit = warping(niter, 200) for i in range(iter): ################# # INITIAL WARPING ################# wrp = warp def showpick(case): return ''' graph transp=y min2=%g max2=%g min1=%g max1=%g yreverse=y plotcol=%d plotfat=%d wantaxis=n wanttitle=n pad=n ''' % (g0, g1, tmin, tmax, (7, 0)[case], (5, 1)[case]) def n(s): return '%s-%s-%d' % (name, s, i) gamma = n('gamma') Flow(gamma, wrp, warp2gamma(ss)) Plot(gamma, graph) psw = n('psw') Flow(psw, [ps, pp, wrp], warp0) Plot(psw, [psw, pp], dplot) Result(psw, [gamma, psw], 'OverUnderAniso') #################### # SPECTRAL BALANCING #################### ppft = n('ppft') psft = n('psft') ltft = 'ltft rect=%d | transp' % frect Flow(ppft, pp, ltft) Flow(psft, psw, ltft) Flow(ppft + 'a', ppft, 'math output="abs(input)" | real') Flow(psft + 'a', psft, 'math output="abs(input)" | real') ftplot = ''' window min1=%g max1=%g max2=%g | grey allpos=y color=j labelfat=3 font=2 titlefat=3 screenht=6. screenratio=0.45 ''' % (fmin, fmax, tmax) Plot(ppft + 'a', ftplot + 'title="PP before balancing" scalebar=y maxval=0.014') Result(ppft + 'a', 'Overlay') Plot( psft + 'a', ftplot + 'title="Warped SS before balancing" scalebar=y maxval=0.014') Result(psft + 'a', 'Overlay') Result(n('ft0'), [ppft + 'a', psft + 'a'], 'OverUnderAniso') pprick = n('pprick') psrick = n('psrick') Flow(pprick, ppft + 'a', ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''', stdout=0, split=[2, 1024]) Flow(psrick, psft + 'a', ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''', stdout=0, split=[2, 1024]) rickplot = ''' cat axis=3 ${SOURCES[1]} | window n1=1 max2=%g | math output="sqrt(input)" | graph title="Dominant Frequency" label2=Frequency unit2=Hz min2=%g max2=%g ''' % (tmax, fmin, fmax) Result(n('rick'), [pprick, psrick], rickplot) Flow([ppft + 'b', psft + 'b'], [ppft, psft, pprick, psrick], ''' freshape in2=${SOURCES[1]} ma=${SOURCES[2]} ma2=${SOURCES[3]} out2=${TARGETS[1]} ''') Flow(ppft + 'c', ppft + 'b', 'math output="abs(input)" | real') Flow(psft + 'c', psft + 'b', 'math output="abs(input)" | real') Plot(ppft + 'c', ftplot + 'title="PP after balancing" scalebar=y maxval=0.014') Result(ppft + 'c', 'Overlay') Plot( psft + 'c', ftplot + 'title="Warped SS after balancing" scalebar=y maxval=0.014') Result(psft + 'c', 'Overlay') Result(n('fta'), [ppft + 'c', psft + 'c'], 'OverUnderAniso') sr = n('sr') pr = n('pr') Flow(pr, ppft + 'b', 'transp | ltft inv=y') Flow(sr, psft + 'b', 'transp | ltft inv=y') Plot(psw + '1', [sr, pr], dplot) Result(psw + '1', [gamma, psw + '1'], 'OverUnderAniso') ############ # GAMMA SCAN ############ g1 = 2 - g0 warpscan1 = warpscan(2 * ng, g0, g1, rect1) greyscan = ''' window min1=%g max1=%g | grey title="Gamma scan" allpos=y min2=%g max2=%g color=j pclip=100 label1="Time (s)" label2="Gamma" ''' % (tmin, tmax, g0, g1) scn = n('scn') Flow(scn, [sr, pr], warpscan1) Plot(scn, greyscan) pik = n('pik') if i == 0: Flow(pik + '0', scn, pick(max(pmin, g0), min(pmax, g1), 2 * rect1, an=an)) else: Flow(pik + '0', scn, pick(g0, g1, 2 * rect1, an=an)) Flow(pik, pik + '0', 'math output="(input-1)*x1" ') Plot(pik, pik + '0', showpick(0)) Plot(pik + '0', showpick(1)) Result(scn, [scn, pik, pik + '0'], 'Overlay') ######### # WARPING ######### warp = n('wrp') Flow([warp, psw + '2'], [sr, pr, pik, wrp], warpit, stdout=-1) Flow(gamma + '2', warp, warp2gamma(ss)) Plot(gamma + '2', graph) Plot(psw + '2', [psw + '2', pr], dplot) Result(psw + '2', [gamma + '2', psw + '2'], 'OverUnderAniso') g0 = (g0 + 1) * 0.5 ############ # Comparison ############ Flow(psw + 'line', psw, 'math output=0.1') Flow( psw + '0c', [psw, pp], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 ''') Flow( psw + '1c', [sr, pr], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 ''') Flow( psw + '2c', [psw + '2', pr], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 ''') Result( psw + 'c', [psw + '2c', psw + 'line', psw + '1c', psw + 'line', psw + '0c'], ''' cat ${SOURCES[1:5]} axis=2 | window min1=%g max1=%g | dots gaineach=0 labelfat=4 font=2 titlefat=4 labels="Difference 3:SS registered:PP balanced: :Difference 2:SS balanced:PP balanced: :Difference 1:SS initial warped:PP" label1=Time unit1=s ''' % (tmin, tmax))
def nwarp2( name, # name prefix pp, ps, # PP and PS images warp, # initial warp nx, # number of traces tmax, # maximum time for display tmin=0, # minimum time for display j2=1, # trace sumsampling trace=None, # seleted trace o2=0, # trace start gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing frame1=10, # time frame ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing rect2=50, # lateral smoothing iter=2, # number of iterations ss=0, # PP-PS (0) or PP-SS (1) inter=1, # interleaving clip=6 # display clip ): if version.old_version(): return # think how to do it better interg = ''' pad n2=%d | put n2=%d n3=%d | stack ''' % ((nx / inter + 1) * inter, inter, nx / inter + 1) inter = 2 * inter interw = ''' pad n2=%d | put n2=%d n3=%d | stack ''' % ((nx / inter + 1) * inter, inter, nx / inter + 1) if trace: for case in (pp, ps, warp): Flow(case + '1', case, 'window n2=1 min2=%d' % trace) warp1(name + 't', pp + '1', ps + '1', warp + '1', tmax, tmin, gmin, gmax, niter, dt, fmin, fmax, frect, ng, g0, pmin, pmax, an, rect1, iter, ss) else: trace = 10 def plot(title): return ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s clip=%g label2=Trace unit2= ''' % (tmin, tmax, title, clip) vplot = plot('Vp/Vs') + ''' clip=%g scalebar=y color=j bias=%g minval=%g maxval=%g ''' % (0.5 * (gmax - gmin), 0.5 * (gmin + gmax), gmin, gmax) balance = ''' nsmooth1 rect=${SOURCES[1]} | abalance rect1=%d rect2=%d order=100 other=${SOURCES[2]} ''' % (rect1, rect2) ifreq = 'iphase rect1=%d rect2=%d order=100' % (2 * rect1, 2 * rect2) def freqplot(title): return ''' scale scale dscale=%g | %s clip=%g bias=%g color=j scalebar=y barlabel="Frequency (Hz)" ''' % (0.5 / (math.pi * dt), plot(title), (fmax - fmin) * 0.25, (fmax + fmin) * 0.5) def specplot(title): return ''' cat axis=2 ${SOURCES[1]} | graph title="%s" max1=%g label1="Frequency (Hz)" dash=0,1 plotfat=7 label2= ''' % (title, 4 * fmax) def giplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | scale axis=1 | grey title="Interleaved (%s)" label1=Time unit1=s label2="Inline" unit2= ''' % (tmin, tmax, title) def wiplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | scale axis=1 | wiggle poly=y transp=y yreverse=y title="Interleaved (%s)" label1=Time unit1=s label2="In-line" ''' % (tmin, tmax, title) Plot(pp, plot('PP')) Flow(pp + 'i', pp, ifreq) Plot(pp + 'i', freqplot('PP Local Frequency')) Result(pp + 'line', pp, 'Overlay') PS = ('PS', 'SS')[ss] Plot( ps, ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s ''' % (tmin, tmax * 2., PS)) Flow(pp + 's0', pp, 'spectra all=y') scanplot = ''' window min1=%g max1=%g | byte gainpanel=all allpos=y | grey3 frame1=%d frame3=%d frame2=%d color=j flat=n label1=Time unit1=s label3="In-line" label2="Relative Gamma" wanttitle=n ''' % (tmin, tmax, frame1, (trace - o2) / j2, ng / 2) simplot = ''' window min1=%g max1=%g | grey title="%s" allpos=y color=j clip=1 label1="Time (s)" ''' % (tmin, tmax, '%s') warpit = warping(niter, 200, 200) for i in range(iter): wrp = warp ################# # INITIAL WARPING ################# def n(s): return '%s-%s-%d' % (name, s, i) psw = n('psw') Flow(psw, [ps, pp, wrp], warp0) Plot(psw, plot('Warped ' + PS)) dif = n('dif') Plot(dif, [psw, pp], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma') Flow(gamma, wrp, warp2gamma(ss)) Plot(gamma, vplot) Result(psw + 'all', [pp, psw, dif, gamma], 'TwoRows') psw1 = n('psw1') pp1 = n('pp1') Flow(pp1, pp, 'window n2=1 f2=286') Flow(psw1, psw, 'window n2=1 f2=286') #### Result(psw, plot('PSW')) #### ppps = n('ppps') Result( ppps, [psw1, pp1], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | dots gaineach=n Xscreenwd=9.225 Xscreenht=5.2 Xyyscale=0.8 labels="Difference:SS warped:PP" label1=Time unit1=s title="LTF transform balancing" ''') #################### # SPECTRAL BALANCING #################### si = n('si') Flow(si, psw, ifreq) Plot(si, freqplot(PS + ' Local Frequency')) nc = 1 radius2(pp, psw, niter=5, c=[0.7, 0.45, 0.35, 0.35, 0.5], bias=-20, clip=30, rect1=rect1, rect2=rect2, theor=False, initial=1, minval=-20, maxval=10, titlehigh='PP', titlelow='PSW', it=i) psws = n('psws') pps = n('pps') Flow(psws, 'low-smooth%d%i' % (nc, i), 'cp') Flow(pps, 'high-smooth%d%i' % (nc, i), 'cp') # balance amplitudes pswsb = n('pswsb') Flow( pswsb, [psws, pps], 'abalance other=${SOURCES[1]} rect1=%i rect2=%i order=100' % (50, 50)) Result(pps, plot("PP smoothed")) Result(psws, plot("PS smoothed ")) Result(pswsb, plot("PS smoothed balanced")) ############# ## GAMMA SCAN ############# g1 = 2 - g0 warpscan2 = warpscan(ng, g0, g1, rect1, 1, int(0.5 + rect2 / j2)) sc = n('sc') sr = n('sr') pr = n('pr') Flow(pr, pps, 'cp') Flow(sr, pswsb, 'cp') Flow(sr + '2', sr, 'window j2=%d' % j2) Flow(pr + '2', pr, 'window j2=%d' % j2) Flow(sc, [sr + '2', pr + '2'], warpscan2) Result(sc, scanplot) pk = n('pk') if i == 0: Flow( pk + '0', sc, pick(max(pmin, g0), min(pmax, g1), rect1, 4 * rect2 / j2, an=an)) else: Flow(pk + '0', sc, pick(g0, g1, rect1, 4 * rect2 / j2, an=an)) Flow( pk, pk + '0', ''' transp memsize=500 | spline n1=%d d1=1 o1=%g | transp memsize=500 | math output="(input-1)*x1" ''' % (nx, o2)) ################## if i == 0: in0 = n('in0') Flow(pr + 'in0', pr, interg) Flow(sr + 'in0', sr, interg) Plot(in0, [pr + 'in0', sr + 'in0'], giplot('Before')) Flow(pr + 'in0w', pr, interw) Flow(sr + 'in0w', sr, interw) Plot(in0 + 'w', [pr + 'in0w', sr + 'in0w'], wiplot('Before')) Result(in0, in0, 'Overlay') Result(in0 + 'w', in0 + 'w', 'Overlay') ################ ######### # WARPING ######### warp = n('wrp') Flow([warp, psw + '2'], [sr, pr, pk, wrp], warpit, stdout=-1) #Flow([warp,psw+'2'],[psw,pr,pk,wrp],warpit,stdout=-1) Plot(psw + '2', plot('Warped ' + PS)) dif = n('dif2') Plot(dif, [psw + '2', pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma2') Flow(gamma, warp, warp2gamma(ss)) Plot(gamma, vplot) if i == iter - 1: in1 = n('in1') Flow(pr + 'in1', pr, interg) Flow(psw + '2in1', psw + '2', interg) Plot(in1, [pr + 'in1', psw + '2in1'], giplot('After')) Flow(pr + 'in1w', pr, interw) Flow(psw + '2in1w', psw + '2', interw) Plot(in1 + 'w', [pr + 'in1w', psw + '2in1w'], wiplot('After')) Result(in1, in1, 'Overlay') Result(in1 + 'w', in1 + 'w', 'Overlay') sim1 = n('sim1') Flow(sim1, [pr, psw + '2'], simil(rect1, rect2)) Result(sim1, simplot % 'After') Flow(psw + '1', [ps, pp, warp], warp0) Result(psw + '1', plot('Warped ' + PS)) rt = n('rt') Flow(psw + 'i', psw + '1', ifreq) Flow( rt, psw + 'i', ''' math output="sqrt(1+12*(1/input^2-1/%g^2))" | dd type=float ''' % (fmax * 2 * math.pi * dt)) dl = n('dl') Flow( dl, [psw + '1', rt], ''' dd type=float | deblur rect=${SOURCES[1]} verb=y niter=100 eps=0.04 nliter=1 ''') Result( dl, ''' window min1=%g max1=%g | grey title="Deblurred %s" label1="Time (s)" ''' % (tmin, tmax, PS)) Flow('e' + gamma, warp, warp2egamma(ss)) Result(gamma, 'e' + gamma, vplot) g0 = (g0 + 1) * 0.5
def warp1( name, # name prefix pp, ps, # PP and PS images warp, # initial warp tmax, # maximum time for display tmin=0, # minimum time for display gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing iter=2, # number of iterations ss=0): if version.old_version(): return # think how to do it better graph = ''' graph wanttitle=n min2=%g max2=%g min1=%g max1=%g wherexlabel=t wheretitle=b crowd=0.8 label2="Vp/Vs" ''' % (gmin, gmax, tmin, tmax) dplot = ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | window min1=%g max1=%g | dots gaineach=0 labels="Difference:PS warped:PP" label1=Time unit1=s ''' % (tmin, tmax) def iphase(title): return ''' cat axis=2 ${SOURCES[1]} | scale dscale=%g | graph title="Local Frequency (%s)" label1="Time (s)" min2=%g max2=%g min1=%g max1=%g dash=0,1 label2="Frequency (Hz)" ''' % (0.5 / (math.pi * dt), title, fmin, fmax, tmin, tmax) warpit = warping(niter, 200) for i in range(iter): ################# # INITIAL WARPING ################# wrp = warp def showpick(case): return ''' graph transp=y min2=%g max2=%g min1=%g max1=%g yreverse=y plotcol=%d plotfat=%d wantaxis=n wanttitle=n pad=n ''' % (g0, g1, tmin, tmax, (7, 0)[case], (5, 1)[case]) def n(s): return '%s-%s-%d' % (name, s, i) gamma = n('gamma') Flow(gamma, wrp, warp2gamma(ss)) Plot(gamma, graph) psw = n('psw') Flow(psw, [ps, pp, wrp], warp0) Plot(psw, [psw, pp], dplot) Result(psw, [gamma, psw], 'OverUnderAniso')
def warp3( name, # name prefix pp, ps, # PP and PS images warp, # initial warp nx, # number of traces tmax, # maximum time for display tmin=0, # minimum time for display ny=1, # number of lines j2=1, # trace subsampling j3=1, # line subsampling line=None, # selected line trace=None, # seleted trace o2=0, # in-line start o3=0, # cross-line start gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing frame1=10, # time frame ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing rect2=50, # in-line smoothing rect3=50, # cross-line smoothing iter=2, # number of iterations ss=0, # PP-PS (0) or PP-SS (1) inter=1, # interleaving clip=6 # display clip ): if version.old_version(): return # think how to do it better if line: for case in (pp, ps, warp): Flow(case + '2', case, 'window n3=1 min3=%d' % line) warp2(name + 'l', pp + '2', ps + '2', warp + '2', nx, tmax, tmin, j2 / j3, trace, o2, gmin, gmax, niter, dt, fmin, fmax, frect, frame1, ng, g0, pmin, pmax, an, rect1, rect2, iter, ss, inter, clip) else: line = 10 def plot3(title): return ''' window min1=%g max1=%g | byte gainpanel=all | grey3 title="%s" flat=y frame1=%d frame2=%d frame3=%d Xpoint1=0.75 Xpoint2=0.75 label1="Time (s)" label2="In-line" label3="Cross-line" ''' % (tmin, tmax, title, frame1, trace - o2, line - o3) Result(pp, plot3('PP')) PS = ('PS', 'SS')[ss] ifreq = ''' window j2=%d j3=%d | iphase rect1=%d rect2=%d rect3=%d order=100 complex=y | transp memsize=500 | spline n1=%d d1=1 o1=%g | transp memsize=500 | transp plane=13 memsize=500 | spline n1=%d d1=1 o1=%g | transp plane=13 memsize=500 ''' % (j2, j3, 2 * rect1, 2 * rect2 / j2, 2 * rect3 / j3, nx, o2, ny, o3) def freqplot3(title): return ''' window min1=%g max1=%g | scale dscale=%g | byte clip=%g bias=%g bar=bar.rsf | grey3 title="%s" flat=n frame1=%d frame2=%d frame3=%d point1=0.75 point2=0.75 label1="Time (s)" label2="In-line" label3="Cross-line" color=j scalebar=y barlabel=Frequency barunit=Hz ''' % (tmin, tmax, 0.5 / (math.pi * dt), (fmax - fmin) * 0.25, (fmax + fmin) * 0.5, title, frame1, trace - o2, line - o3) Flow(pp + 'i', pp, ifreq) Result(pp + 'i', freqplot3('PP Local Frequency')) balance = ''' nsmooth1 rect=${SOURCES[1]} | abalance rect1=%d rect2=%d rect3=%d order=100 other=${SOURCES[2]} ''' % (rect1, rect2, rect3) def pslice(title): return ''' window min1=%g max1=%g | window n1=1 f1=%d | grey verb=y color=j label1="In-line" label2="Cross-line" title="%s" transp=n yreverse=n clip=%g ''' % (tmin, tmax, frame1, title, clip) warpit = warping(niter, 200, 200, 200) Plot(pp + 's', pp, pslice('PP')) for i in range(iter): wrp = warp ################# # INITIAL WARPING ################# def n(s): return '%s-%s-%d' % (name, s, i) psw = n('psw') Flow(psw, [ps, pp, wrp], warp0) Result(psw, plot3('Warped ' + PS)) if i == 0: Plot(ps + 's', psw, pslice('Warped %s (Before)' % PS)) #################### # SPECTRAL BALANCING #################### si = n('si') Flow(si, psw, ifreq) Result(si, freqplot3(PS + ' Local Frequency')) msk = n('msk') Flow(msk, [si, pp + 'i'], getmask) sr = n('sr') pr = n('pr') Flow(sr + '0', [msk, si, pp + 'i'], psrect(frect)) Flow(sr, [psw, sr + '0', pp], balance) Flow(pr + '0', [msk, si, pp + 'i'], pprect(frect)) Flow(pr, [pp, pr + '0', pp], balance) Result(sr, plot3('Warped and Balanced ' + PS)) Result(pr, plot3('Balanced PP')) ############ # GAMMA SCAN ############ g1 = 2 - g0 warpscan3 = warpscan(ng, g0, g1, rect1, 1, int(0.5 + rect2 / j2), int(0.5 + rect3 / j3)) Flow(sr + '2', sr, 'window j2=%d j3=%d' % (j2, j3)) Flow(pr + '2', pr, 'window j2=%d j3=%d' % (j2, j3)) sc = n('sc') Flow(sc, [sr + '2', pr + '2'], warpscan3) pk = n('pk') if i == 0: Flow( pk + '0', sc, pick(max(pmin, g0), min(pmax, g1), rect1, 4 * rect2 / j2, 4 * rect3 / j3, an=an)) else: Flow(pk + '0', sc, pick(g0, g1, rect1, 4 * rect2 / j2, 4 * rect3 / j3, an=an)) Flow( pk, pk + '0', ''' transp memsize=500 | spline n1=%d d1=1 o1=%g | transp memsize=500 | transp plane=13 memsize=500 | spline n1=%d d1=1 o1=%g | transp plane=13 memsize=500 | math output="(input-1)*x1" ''' % (nx, o2, ny, o3)) ######### # WARPING ######### warp = n('wrp') Flow([warp, psw + '2'], [sr, pr, pk, wrp], warpit, stdout=-1) Result(psw + '2', plot3('Warped ' + PS)) Flow(psw + '1', [ps, pp, warp], warp0) Result(psw + '1', plot3('Warped ' + PS)) gamma = n('gamma2') Flow(gamma, warp, warp2gamma(ss)) Result( gamma, ''' window min1=%g max1=%g | byte bias=%g clip=%g bar=bar.rsf | grey3 title="Vp/Vs" flat=n frame1=%d frame2=%d frame3=%d point1=0.75 point2=0.75 color=j scalebar=y minval=%g maxval=%g label1="Time (s)" label2="In-line" label3="Cross-line" ''' % (tmin, tmax, (gmin + gmax) / 2, (gmax - gmin) / 2, frame1, trace - o2, line - o3, gmin, gmax)) if i == iter - 1: Flow(psw + '1', [ps, pp, warp], warp0) Plot(psw + 's', psw + '1', pslice('Warped %s (After)' % PS)) Result(psw + 's', [pp + 's', ps + 's', psw + 's'], 'SideBySideIso') g0 = (g0 + 1) * 0.5
def warp2( name, # name prefix pp, ps, # PP and PS images warp, # initial warp nx, # number of traces tmax, # maximum time for display tmin=0, # minimum time for display j2=1, # trace sumsampling trace=None, # seleted trace o2=0, # trace start gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing frame1=10, # time frame ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing rect2=50, # lateral smoothing iter=2, # number of iterations ss=0, # PP-PS (0) or PP-SS (1) inter=1, # interleaving clip=6 # display clip ): if version.old_version(): return # think how to do it better interg = 'pad n2=%d | put n2=%d n3=%d | stack' % ( (nx / inter + 1) * inter, inter, nx / inter + 1) inter = 2 * inter interw = 'pad n2=%d | put n2=%d n3=%d | stack' % ( (nx / inter + 1) * inter, inter, nx / inter + 1) if trace: for case in (pp, ps, warp): Flow(case + '1', case, 'window n2=1 min2=%d' % trace) warp1(name + 't', pp + '1', ps + '1', warp + '1', tmax, tmin, gmin, gmax, niter, dt, fmin, fmax, frect, ng, g0, pmin, pmax, an, rect1, iter, ss) else: trace = 10 def plot(title): return ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s clip=%g ''' % (tmin, tmax, title, clip) vplot = plot('Vp/Vs') + ''' clip=%g scalebar=y color=j bias=%g minval=%g maxval=%g ''' % (0.5 * (gmax - gmin), 0.5 * (gmin + gmax), gmin, gmax) balance = ''' nsmooth1 rect=${SOURCES[1]} | abalance rect1=%d rect2=%d order=100 other=${SOURCES[2]} ''' % (rect1, rect2) ifreq = 'iphase rect1=%d rect2=%d order=100 complex=y' % (2 * rect1, 2 * rect2) def freqplot(title): return ''' scale scale dscale=%g | %s clip=%g bias=%g color=j scalebar=y barlabel=Frequency barunit=Hz ''' % (0.5 / (math.pi * dt), plot(title), (fmax - fmin) * 0.25, (fmax + fmin) * 0.5) def specplot(title): return ''' cat axis=2 ${SOURCES[1]} | graph title="%s" max1=%g label1=Frequency unit1=Hz dash=0,1 plotfat=7 label2= ''' % (title, 4 * fmax) def giplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | grey title="Interleaved (%s)" label1=Time unit1=s label2="In-line" ''' % (tmin, tmax, title) def wiplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | wiggle poly=y transp=y yreverse=y title="Interleaved (%s)" label1=Time unit1=s label2="In-line" ''' % (tmin, tmax, title) Plot(pp, plot('PP')) Flow(pp + 'i', pp, ifreq) Plot(pp + 'i', freqplot('PP Local Frequency')) Result(pp + 'line', pp, 'Overlay') PS = ('PS', 'SS')[ss] Plot(ps, 'grey title=%s label1=Time unit1=s' % PS) Flow(pp + 's0', pp, 'spectra all=y') scanplot = ''' window min1=%g max1=%g | byte gainpanel=all allpos=y | grey3 frame1=%d frame3=%d frame2=%d color=j flat=n label1=Time unit1=s label3="In-line" label2="Relative Gamma" wanttitle=n ''' % (tmin, tmax, frame1, (trace - o2) / j2, ng / 2) simplot = ''' window min1=%g max1=%g | grey title="%s" allpos=y color=j clip=1 label1="Time (s)" ''' % (tmin, tmax, '%s') warpit = warping(niter, 200, 200) for i in range(iter): wrp = warp ################# # INITIAL WARPING ################# def n(s): return '%s-%s-%d' % (name, s, i) psw = n('psw') Flow(psw, [ps, pp, wrp], warp0) Plot(psw, plot('Warped ' + PS)) dif = n('dif') Plot(dif, [psw, pp], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma') Flow(gamma, wrp, warp2gamma(ss)) Plot(gamma, vplot) Result(psw, [pp, psw, dif, gamma], 'TwoRows') #################### # SPECTRAL BALANCING #################### si = n('si') Flow(si, psw, ifreq) Plot(si, freqplot(PS + ' Local Frequency')) msk = n('msk') Flow(msk, [si, pp + 'i'], getmask) sr = n('sr') pr = n('pr') Flow(sr + '0', [msk, si, pp + 'i'], psrect(frect)) Flow(sr, [psw, sr + '0', pp], balance) Flow(pr + '0', [msk, si, pp + 'i'], pprect(frect)) Flow(pr, [pp, pr + '0', pp], balance) pi = n('pi') Flow(pi, pr, ifreq) Flow(si + '2', sr, ifreq) Plot(si + '2', freqplot(PS + ' Local Frequency')) Plot(pi, freqplot('PP Local Frequency')) Result(si, [pp + 'i', si, pi, si + '2'], 'TwoRows') ppft = n('ppft') psft = n('psft') ltft = 'ltft rect=%d | transp' % frect Flow(ppft, pp, ltft) Flow(psft, psw, ltft) Flow(ppft + 'a', ppft, 'math output="abs(input)" | real') Flow(psft + 'a', psft, 'math output="abs(input)" | real') s0 = psw + 's0' Flow(s0, psw, 'spectra all=y') Plot(s0, [pp + 's0', s0], specplot('Before')) s1 = psw + 's1' Flow(s1, sr, 'spectra all=y') Flow(pr + 's1', pr, 'spectra all=y') Plot(s1, [pr + 's1', s1], specplot('After')) Result(n('sp'), [s0, s1], 'SideBySideIso') if i == 0: in0 = n('in0') Flow(pr + 'in0', pr, interg) Flow(sr + 'in0', sr, interg) Plot(in0, [pr + 'in0', sr + 'in0'], giplot('Before')) Flow(pr + 'in0w', pr, interw) Flow(sr + 'in0w', sr, interw) Plot(in0 + 'w', [pr + 'in0w', sr + 'in0w'], wiplot('Before')) Result(in0, in0, 'Overlay') Result(in0 + 'w', in0 + 'w', 'Overlay') sim0 = n('sim0') Flow(sim0, [pr, sr], simil(rect1, rect2)) Result(sim0, simplot % 'Before') Plot(sr, plot('Warped and Balanced ' + PS)) Plot(pr, plot('Balanced PP')) dif = dif + '2' Plot(dif, [sr, pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) Result(sr, [pr, sr, dif, gamma], 'TwoRows') ############ # GAMMA SCAN ############ g1 = 2 - g0 warpscan2 = warpscan(ng, g0, g1, rect1, 1, int(0.5 + rect2 / j2)) sc = n('sc') Flow(sr + '2', sr, 'window j2=%d' % j2) Flow(pr + '2', pr, 'window j2=%d' % j2) Flow(sc, [sr + '2', pr + '2'], warpscan2) Result(sc, scanplot) pk = n('pk') if i == 0: Flow( pk + '0', sc, pick(max(pmin, g0), min(pmax, g1), rect1, 4 * rect2 / j2, an=an)) else: Flow(pk + '0', sc, pick(g0, g1, rect1, 4 * rect2 / j2, an=an)) Flow( pk, pk + '0', ''' transp memsize=500 | spline n1=%d d1=1 o1=%g | transp memsize=500 | math output="(input-1)*x1" ''' % (nx, o2)) ######### # WARPING ######### warp = n('wrp') Flow([warp, psw + '2'], [sr, pr, pk, wrp], warpit, stdout=-1) Plot(psw + '2', plot('Warped ' + PS)) dif = n('dif2') Plot(dif, [psw + '2', pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma2') Flow(gamma, warp, warp2gamma(ss)) Plot(gamma, vplot) Result(psw + '2', [pr, psw + '2', dif, gamma], 'TwoRows') if i == iter - 1: in1 = n('in1') Flow(pr + 'in1', pr, interg) Flow(psw + '2in1', psw + '2', interg) Plot(in1, [pr + 'in1', psw + '2in1'], giplot('After')) Flow(pr + 'in1w', pr, interw) Flow(psw + '2in1w', psw + '2', interw) Plot(in1 + 'w', [pr + 'in1w', psw + '2in1w'], wiplot('After')) Result(in1, in1, 'Overlay') Result(in1 + 'w', in1 + 'w', 'Overlay') Result(in0 + '1', [in0, in1], 'SideBySideIso') Result(in0 + '1w', [in0 + 'w', in1 + 'w'], 'OverUnderAniso') sim1 = n('sim1') Flow(sim1, [pr, psw + '2'], simil(rect1, rect2)) Result(sim1, simplot % 'After') Flow(psw + '1', [ps, pp, warp], warp0) Result(psw + '1', plot('Warped ' + PS)) rt = n('rt') Flow(psw + 'i', psw + '1', ifreq) Flow( rt, psw + 'i', 'math output="sqrt(1+12*(1/input^2-1/%g^2))" ' % (fmax * 2 * math.pi * dt)) dl = n('dl') Flow( dl, [psw + '1', rt], 'deblur rect=${SOURCES[1]} verb=y niter=100 eps=0.04 nliter=1') Result( dl, ''' window min1=%g max1=%g | grey title="Deblurred %s" label1="Time (s)" ''' % (tmin, tmax, PS)) Flow('e' + gamma, warp, warp2egamma(ss)) Result(gamma, 'e' + gamma, vplot) g0 = (g0 + 1) * 0.5
def nwarp2(name, # name prefix pp,ps, # PP and PS images warp, # initial warp nx, # number of traces tmax, # maximum time for display tmin=0, # minimum time for display j2=1, # trace sumsampling trace=None, # seleted trace o2=0, # trace start gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing frame1=10, # time frame ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing rect2=50, # lateral smoothing iter=2, # number of iterations ss=0, # PP-PS (0) or PP-SS (1) inter=1, # interleaving clip=6 # display clip ): if version.old_version(): return # think how to do it better interg = ''' pad n2=%d | put n2=%d n3=%d | stack ''' % ((nx/inter+1)*inter,inter,nx/inter+1) inter = 2*inter interw = ''' pad n2=%d | put n2=%d n3=%d | stack ''' % ((nx/inter+1)*inter,inter,nx/inter+1) if trace: for case in (pp,ps,warp): Flow(case+'1',case,'window n2=1 min2=%d' % trace) warp1(name+'t',pp+'1',ps+'1',warp+'1',tmax,tmin, gmin,gmax,niter, dt,fmin,fmax,frect,ng,g0,pmin,pmax,an,rect1,iter,ss) else: trace=10 def plot(title): return ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s clip=%g labelfat=3 font=2 titlefat=3 label2=Trace unit2= ''' % (tmin,tmax,title,clip) vplot = plot('Vp/Vs') + ''' clip=%g scalebar=y color=j bias=%g minval=%g maxval=%g ''' % (0.5*(gmax-gmin),0.5*(gmin+gmax),gmin,gmax) balance = ''' nsmooth1 rect=${SOURCES[1]} | abalance rect1=%d rect2=%d order=100 other=${SOURCES[2]} ''' % (rect1,rect2) ifreq = 'iphase rect1=%d rect2=%d order=100' % (2*rect1,2*rect2) def freqplot(title): return ''' scale scale dscale=%g | %s clip=%g bias=%g color=j scalebar=y barlabel="Frequency (Hz)" ''' % (0.5/(math.pi*dt),plot(title),(fmax-fmin)*0.25,(fmax+fmin)*0.5) def specplot(title): return ''' cat axis=2 ${SOURCES[1]} | graph title="%s" max1=%g label1="Frequency (Hz)" dash=0,1 plotfat=7 label2= ''' % (title,4*fmax) def giplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | scale axis=1 | grey title="Interleaved (%s)" label1=Time unit1=s label2="Inline" unit2= labelfat=3 font=2 titlefat=3 screenratio=0.6 screenht=8 ''' % (tmin,tmax,title) def wiplot(title): return ''' interleave axis=2 ${SOURCES[1]} | window min1=%g max1=%g | scale axis=1 | wiggle poly=y transp=y yreverse=y title="Interleaved (%s)" label1=Time unit1=s label2="In-line" ''' % (tmin,tmax,title) Plot(pp,plot('PP')) Flow(pp+'i',pp,ifreq) Plot(pp+'i',freqplot('PP Local Frequency')) Result(pp+'line',pp,'Overlay') PS = ('PS','SS')[ss] Plot(ps, ''' window min1=%g max1=%g | grey title="%s" label1=Time unit1=s labelfat=3 font=2 titlefat=3 label2=Trace unit2= ''' % (tmin,tmax*2.,PS)) Flow(pp+'s0',pp,'spectra all=y') scanplot = ''' window min1=%g max1=%g | byte gainpanel=all allpos=y | grey3 frame1=%d frame3=%d frame2=%d color=j flat=n label1=Time unit1=s label3="In-line" label2="Relative Gamma" wanttitle=n ''' % (tmin,tmax,frame1,(trace-o2)/j2,ng/2) simplot = ''' window min1=%g max1=%g | grey title="%s" allpos=y color=j clip=1 label1="Time (s)" ''' % (tmin,tmax,'%s') warpit = warping(niter,200,200) for i in range(iter): wrp = warp ################# # INITIAL WARPING ################# def n(s): return '%s-%s-%d' % (name,s,i) psw = n('psw') Flow(psw,[ps,pp,wrp],warp0) Plot(psw,plot('Warped ' + PS)) dif = n('dif') Plot(dif,[psw,pp], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma') Flow(gamma,wrp,warp2gamma(ss)) Plot(gamma,vplot) Result(psw,[pp,psw,dif,gamma],'TwoRows') psw1 = n('psw1') pp1 = n('pp1') Flow(pp1,pp,'window n2=1 f2=286') Flow(psw1,psw,'window n2=1 f2=286') ppps = n('ppps') Result(ppps,[psw1,pp1], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | dots gaineach=n Xscreenwd=9.225 Xscreenht=5.2 Xyyscale=0.8 labels="Difference:SS warped:PP" label1=Time unit1=s title="LTF transform balancing" ''') #################### # SPECTRAL BALANCING #################### si = n('si') Flow(si,psw,ifreq) Plot(si,freqplot(PS + ' Local Frequency')) ## msk = n('msk') ## Flow(msk,[si,pp+'i'],getmask) ## sr = n('sr') ## pr = n('pr') ## Flow(sr+'0',[msk,si,pp+'i'],psrect(frect)) ## Flow(sr,[psw,sr+'0',pp],balance) ## Flow(pr+'0',[msk,si,pp+'i'],pprect(frect)) ## Flow(pr,[pp,pr+'0',pp],balance) ppltft = n('ppltft') Flow(ppltft,pp, ''' ltft rect=%d verb=n | transp ''' % frect,split=[2,471],reduce="cat axis=3") Result(ppltft, ''' transp | window max2=100 | math output="abs(input)" | real | byte allpos=y gainpanel=40 pclip=100 | grey3 transp=n yreverse=n color=j title="PP before matched" label1=Time unit1=s frame1=512 frame2=100 frame3=235 point1=0.8 point2=0.3 labelfat=3 font=2 titlefat=3 ''') ppltftspe = n('ppltftspe') Flow(ppltftspe,ppltft, ''' math output="abs(input)" | real ''') pswltft = n('pswltft') Flow(pswltft,psw, ''' ltft rect=%d verb=n | transp ''' % frect,split=[2,471],reduce="cat axis=3") Result(pswltft, ''' transp | window max2=100 | math output="abs(input)" | real | byte allpos=y gainpanel=40 pclip=100 | grey3 transp=n yreverse=n color=j title="PS warped before matched" label1=Time unit1=s frame1=512 frame2=100 frame3=235 point1=0.8 point2=0.3 labelfat=3 font=2 titlefat=3 ''') pswltftspe = n('pswltftspe') Flow(pswltftspe,pswltft, ''' math output="abs(input)" | real ''') pprick = n('pprick') Flow(pprick,ppltftspe, ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''',stdout=0,split=[2,1024]) pswrick = n('pswrick') Flow(pswrick,pswltftspe, ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''',stdout=0,split=[2,1024]) ppshape = n('ppshape') pswshape = n('pswshape') Flow([ppshape,pswshape],[ppltft,pswltft,pprick,pswrick], ''' freshape in2=${SOURCES[1]} ma=${SOURCES[2]} ma2=${SOURCES[3]} out2=${TARGETS[1]} ''') ## Result('ppmorphltft', ## ''' ## transp | window max2=100 | ## math output="abs(input)" | real | ## grey transp=n yreverse=n color=j ## title="PP matched" label1=Time unit1=s ## screenratio=0.35 screenht=5 ## labelfat=3 font=2 titlefat=3 parallel2=n scalebar=y ## ''') ## Result('psmorphltft', ## ''' ## transp | window max2=100 | ## math output="abs(input)" | real | ## grey transp=n yreverse=n color=j ## title="PS matched" label1=Time unit1=s ## screenratio=0.35 screenht=5 ## labelfat=3 font=2 titlefat=3 parallel2=n scalebar=y ## ''') sr = n('sr') pr = n('pr') Flow(pr,ppshape,'transp | ltft inv=y verb=y') Flow(sr,pswshape,'transp | ltft inv=y verb=y') ## Plot('ippmorphltft', ## ''' ## graph plotfat=10 label1=Time unit1=s unit2= ## wanttitle=n labelsz=10 label2="PP matched" ## ''') ## Plot('ipsmorphltft', ## ''' ## graph plotfat=10 label1=Time unit1=s unit2= ## wanttitle=n labelsz=10 label2="PS matched" ## ''') ## Result('match','ippmorphltft ipsmorphltft','OverUnderAniso') sr1 = n('sr1') pr1 = n('pr1') Flow(pr1,pr,'window n2=1 f2=286') Flow(sr1,sr,'window n2=1 f2=286') ltftppps = n('ltftppps') Result(ltftppps,[sr1,pr1], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | dots gaineach=0 Xscreenwd=9.225 Xscreenht=5.2 Xyyscale=0.8 labels="Difference:PS warped:PP" label1=Time unit1=s title="LTF transform balancing" ''') ## Plot('ltftbefore','pp morph', ## ''' ## cat axis=2 ${SOURCES[1]} | ## spectra | window max1=100 | ## graph dash=0,1 title="Before LTFT matching" max2=2 min2=0 ## label1=Frequency unit1=Hz label2= unit2= ## ''') ## Plot('ltftafter','ippmorphltft ipsmorphltft', ## ''' ## cat axis=2 ${SOURCES[1]} | ## spectra | window max1=100 | ## graph dash=0,1 title="After LTFT matching" max2=2 min2=0 ## label1=Frequency unit1=Hz label2= unit2= ## ''') ## Result('ltftspectra','ltftbefore ltftafter','SideBySideAniso') pi = n('pi') Flow(pi,pr,ifreq) Flow(si+'2',sr,ifreq) Plot(si+'2',freqplot(PS + ' Local Frequency')) Plot(pi,freqplot('PP Local Frequency')) Result(si,[pp+'i',si,pi,si+'2'],'TwoRows') s0 = psw+'s0' Flow(s0,psw,'spectra all=y') Plot(s0,[pp+'s0',s0],specplot('Before')) s1 = psw+'s1' Flow(s1,sr,'spectra all=y') Flow(pr+'s1',pr,'spectra all=y') Plot(s1,[pr+'s1',s1],specplot('After')) Result(n('sp'),[s0,s1],'SideBySideIso') if i == 0: in0 = n('in0') Flow(pr+'in0',pr,interg) Flow(sr+'in0',sr,interg) Plot(in0, [pr+'in0',sr+'in0'],giplot('Before')) Flow(pr+'in0w',pr,interw) Flow(sr+'in0w',sr,interw) Plot(in0+'w',[pr+'in0w',sr+'in0w'],wiplot('Before')) Result(in0,in0,'Overlay') Result(in0+'w',in0+'w','Overlay') sim0 = n('sim0') Flow(sim0,[pr,sr],simil(rect1,rect2)) Result(sim0,simplot % 'Before') Plot(sr,plot('Warped and Balanced ' + PS)) Plot(pr,plot('Balanced PP')) dif = dif+'2' Plot(dif,[sr,pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) Result(sr,[pr,sr,dif,gamma],'TwoRows') ############ # GAMMA SCAN ############ g1 = 2-g0 warpscan2 = warpscan(ng,g0,g1,rect1,1,int(0.5+rect2/j2)) sc = n('sc') Flow(sr+'2',sr,'window j2=%d' % j2) Flow(pr+'2',pr,'window j2=%d' % j2) Flow(sc,[sr+'2',pr+'2'],warpscan2) Result(sc,scanplot) pk = n('pk') if i==0: Flow(pk+'0',sc,pick(max(pmin,g0),min(pmax,g1), rect1,4*rect2/j2,an=an)) else: Flow(pk+'0',sc,pick(g0,g1,rect1,4*rect2/j2,an=an)) Flow(pk,pk+'0', ''' transp memsize=500 | spline n1=%d d1=1 o1=%g | transp memsize=500 | math output="(input-1)*x1" ''' % (nx,o2)) ######### # WARPING ######### warp = n('wrp') Flow([warp,psw+'2'],[sr,pr,pk,wrp],warpit,stdout=-1) Plot(psw+'2',plot('Warped ' + PS)) dif = n('dif2') Plot(dif,[psw+'2',pr], 'add scale=1,-1 ${SOURCES[1]} | ' + plot('Difference')) gamma = n('gamma2') Flow(gamma,warp,warp2gamma(ss)) Plot(gamma,vplot) Result(psw+'2',[pr,psw+'2',dif,gamma],'TwoRows') if i == iter-1: in1 = n('in1') Flow(pr+'in1',pr,interg) Flow(psw+'2in1',psw+'2',interg) Plot(in1,[pr+'in1',psw+'2in1'],giplot('After')) Flow(pr+'in1w',pr,interw) Flow(psw+'2in1w',psw+'2',interw) Plot(in1+'w',[pr+'in1w',psw+'2in1w'],wiplot('After')) Result(in1,in1,'Overlay') Result(in1+'w',in1+'w','Overlay') Result(in0+'1',[in0,in1],'SideBySideIso') Result(in0+'1w',[in0+'w',in1+'w'],'OverUnderAniso') sim1 = n('sim1') Flow(sim1,[pr,psw+'2'],simil(rect1,rect2)) Result(sim1,simplot % 'After') Flow(psw+'1',[ps,pp,warp],warp0) Result(psw+'1',plot('Warped ' + PS)) rt = n('rt') Flow(psw+'i',psw+'1',ifreq) Flow(rt,psw+'i', ''' math output="sqrt(1+12*(1/input^2-1/%g^2))" | dd type=int ''' % (fmax*2*math.pi*dt)) dl = n('dl') Flow(dl,[psw+'1',rt], ''' deblur rect=${SOURCES[1]} verb=y niter=100 eps=0.04 nliter=1 ''') Result(dl, ''' window min1=%g max1=%g | grey title="Deblurred %s" label1="Time (s)" ''' % (tmin,tmax,PS)) Flow('e'+gamma,warp,warp2egamma(ss)) Result(gamma,'e'+gamma,vplot) g0 = (g0+1)*0.5
def warp1(name, # name prefix pp,ps, # PP and PS images warp, # initial warp tmax, # maximum time for display tmin=0, # minimum time for display gmin=1, # minimum gamma gmax=4, # maximum gamma niter=20, # warping iterations dt=0.004, # time sampling fmin=0, # minimum frequency fmax=40, # maximum frequency frect=12, # frequency smoothing ng=101, # number of gammas g0=0.96, # first gamma pmin=0, # minimum gamma for picking pmax=2, # maximum gamma for picking an=0.5, # anisotropy for picking rect1=50, # vertical smoothing iter=2, # number of iterations ss=0 ): if version.old_version(): return # think how to do it better graph = ''' graph wanttitle=n min2=%g max2=%g min1=%g max1=%g wherexlabel=t wheretitle=b crowd=0.8 label2="Vp/Vs" ''' % (gmin,gmax,tmin,tmax) dplot =''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 | window min1=%g max1=%g | dots gaineach=0 labels="Difference:PS warped:PP" label1=Time unit1=s ''' % (tmin,tmax) def iphase(title): return ''' cat axis=2 ${SOURCES[1]} | scale dscale=%g | graph title="Local Frequency (%s)" label1="Time (s)" min2=%g max2=%g min1=%g max1=%g dash=0,1 label2="Frequency (Hz)" ''' % (0.5/(math.pi*dt),title,fmin,fmax,tmin,tmax) warpit = warping(niter,200) for i in range(iter): ################# # INITIAL WARPING ################# wrp = warp def showpick(case): return ''' graph transp=y min2=%g max2=%g min1=%g max1=%g yreverse=y plotcol=%d plotfat=%d wantaxis=n wanttitle=n pad=n ''' % (g0,g1,tmin,tmax,(7,0)[case],(5,1)[case]) def n(s): return '%s-%s-%d' % (name,s,i) gamma = n('gamma') Flow(gamma,wrp,warp2gamma(ss)); Plot(gamma,graph) psw = n('psw') Flow(psw,[ps,pp,wrp],warp0) Plot(psw,[psw,pp],dplot) Result(psw,[gamma,psw],'OverUnderAniso') #################### # SPECTRAL BALANCING #################### ppft = n('ppft') psft = n('psft') ltft = 'ltft rect=%d | transp' % frect Flow(ppft,pp,ltft) Flow(psft,psw,ltft) Flow(ppft+'a',ppft,'math output="abs(input)" | real') Flow(psft+'a',psft,'math output="abs(input)" | real') ftplot = ''' window min1=%g max1=%g max2=%g | grey allpos=y color=j labelfat=3 font=2 titlefat=3 screenht=6. screenratio=0.45 ''' % (fmin,fmax,tmax) Plot(ppft+'a',ftplot +'title="PP before balancing" scalebar=y maxval=0.014') Result(ppft+'a','Overlay') Plot(psft+'a',ftplot +'title="Warped SS before balancing" scalebar=y maxval=0.014') Result(psft+'a','Overlay') Result(n('ft0'),[ppft+'a',psft+'a'],'OverUnderAniso') pprick = n('pprick') psrick = n('psrick') Flow(pprick,ppft+'a', ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''',stdout=0, split=[2,1024]) Flow(psrick,psft+'a', ''' ricker niter=1000 ma=$TARGET verb=n m=40 ''',stdout=0, split=[2,1024]) rickplot = ''' cat axis=3 ${SOURCES[1]} | window n1=1 max2=%g | math output="sqrt(input)" | graph title="Dominant Frequency" label2=Frequency unit2=Hz min2=%g max2=%g ''' % (tmax,fmin,fmax) Result(n('rick'),[pprick,psrick],rickplot) Flow([ppft+'b',psft+'b'],[ppft,psft,pprick,psrick], ''' freshape in2=${SOURCES[1]} ma=${SOURCES[2]} ma2=${SOURCES[3]} out2=${TARGETS[1]} ''') Flow(ppft+'c',ppft+'b','math output="abs(input)" | real') Flow(psft+'c',psft+'b','math output="abs(input)" | real') Plot(ppft+'c',ftplot +'title="PP after balancing" scalebar=y maxval=0.014') Result(ppft+'c','Overlay') Plot(psft+'c',ftplot +'title="Warped SS after balancing" scalebar=y maxval=0.014') Result(psft+'c','Overlay') Result(n('fta'),[ppft+'c',psft+'c'],'OverUnderAniso') sr = n('sr') pr = n('pr') Flow(pr,ppft+'b','transp | ltft inv=y') Flow(sr,psft+'b','transp | ltft inv=y') Plot(psw+'1',[sr,pr],dplot) Result(psw+'1',[gamma,psw+'1'],'OverUnderAniso') ############ # GAMMA SCAN ############ g1 = 2-g0 warpscan1 = warpscan(2*ng,g0,g1,rect1) greyscan = ''' window min1=%g max1=%g | grey title="Gamma scan" allpos=y min2=%g max2=%g color=j pclip=100 label1="Time (s)" label2="Gamma" ''' % (tmin,tmax,g0,g1) scn = n('scn') Flow(scn,[sr,pr],warpscan1) Plot(scn,greyscan) pik = n('pik') if i==0: Flow(pik+'0',scn,pick(max(pmin,g0),min(pmax,g1),2*rect1,an=an)) else: Flow(pik+'0',scn,pick(g0,g1,2*rect1,an=an)) Flow(pik,pik+'0','math output="(input-1)*x1" ') Plot(pik,pik+'0',showpick(0)) Plot(pik+'0',showpick(1)) Result(scn,[scn,pik,pik+'0'],'Overlay') ######### # WARPING ######### warp = n('wrp') Flow([warp,psw+'2'],[sr,pr,pik,wrp],warpit,stdout=-1) Flow(gamma+'2',warp,warp2gamma(ss)) Plot(gamma+'2',graph) Plot(psw+'2',[psw+'2',pr],dplot) Result(psw+'2',[gamma+'2',psw+'2'],'OverUnderAniso') g0 = (g0+1)*0.5 ############ # Comparison ############ Flow(psw+'line',psw,'math output=0.1') Flow(psw+'0c',[psw,pp], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 ''') Flow(psw+'1c',[sr,pr], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 ''') Flow(psw+'2c',[psw+'2',pr], ''' add scale=1,-1 ${SOURCES[1]} | cat ${SOURCES[0]} ${SOURCES[1]} axis=2 ''') Result(psw+'c',[psw+'2c',psw+'line',psw+'1c',psw+'line',psw+'0c'], ''' cat ${SOURCES[1:5]} axis=2 | window min1=%g max1=%g | dots gaineach=0 labelfat=4 font=2 titlefat=4 labels="Difference 3:SS registered:PP balanced: :Difference 2:SS balanced:PP balanced: :Difference 1:SS initial warped:PP" label1=Time unit1=s ''' % (tmin,tmax))
def stack(name, v0, nv, dv, nx, padx, nt, tmin=0, tmax=10, rect1=10, rect2=10, srect1=1, srect2=3, vslope=None, units='km', f1=1, j3=1, dx=1, x0=0, beg1=0, frect1=0, frect2=0, an=1, nout=2048, vx0=None): if version.old_version(): return # think how to do it better scn = name+'-scn' vel = name+'-vel' Flow(scn,name, 'mutter v0=%g | vscan semblance=y v0=%g nv=%d dv=%g' % (v0,v0,nv,dv)) if vslope: pick = 'mutter x0=%g v0=%g half=n | ' % (vx0,vslope) else: pick = '' pick = pick + 'pick rect1=%d rect2=%d | window' % (rect1,rect2) def grey(title): return ''' window n1=%d | grey title="%s" label1=Time unit1=s label2=Distance unit2="%s" ''' % (nt,title,units) def velgrey(title): return grey(title) + ''' color=j scalebar=y mean=y barlabel=Velocity barunit="%s/s" barreverse=y ''' % units Flow(vel,scn,pick) Result(vel,velgrey('RMS Velocity')) nmo = name+'-nmo' stk = name+'-stk' Flow(nmo,[name,vel],'mutter v0=%g | nmo velocity=${SOURCES[1]}' % v0) Flow(stk,nmo,'stack') Result(stk,grey('NMO Stack')) stk2=stk+'2' Flow(stk2,nmo, ''' window f1=%d | logstretch nout=%d | fft1 | transp plane=13 memsize=500 | finstack | transp memsize=500 | fft1 inv=y | window n1=%d | logstretch inv=y | pad beg1=%d | transp | bandpass fhi=%g | transp ''' % (f1,nout,nout,f1,0.75*0.5/dx)) Result(stk2,grey('DMO Stack')) diffimg(name,stk2,v0,nv,dv,nx,padx,nt,tmin,tmax, rect1, rect2, srect1, srect2, vslope, units, f1, j3, dx, x0, beg1, frect1, frect2, an, nout, vx0)