def goEstimateWaveletFromCmpGather(): """ Estimates wavelet from a CMP gather """ st = Sampling(501,0.004,0.0); nt,dt,ft = st.count,st.delta,st.first sx = Sampling(201,0.010,0.0); nx,dx,fx = sx.count,sx.delta,sx.first nref,vnmo = 100,2.0 # number of reflectors and NMO velocity freq,decay = 30.0,0.1 # peak frequency and decay for wavelet p = makeCmpReflections(vnmo,nref,st,sx) # cmp gather without wavelet f = addArWavelet(freq,decay,st,sx,p) # cmp gather with wavelet plotGather(st,sx,f,"CMP gather") na,ka = 11,-5 # sampling for inverse wavelet a ak = zerofloat(na) # array for the known inverse wavelet a r,w = exp(-decay),2.0*PI*freq*st.delta # radius and frequency of poles a1,a2 = -2.0*r*cos(w),r*r # coefficients for inverse wavelet ak[0-ka] = 1.0 ak[1-ka] = a1 ak[2-ka] = a2 wn = WaveletNmo(st,sx,vnmo) ae = wn.getInverseA(na,ka,f) # the estimated inverse wavelet nh,kh = 100,-20 # sampling for wavelet h for a in [ak,ae]: if a is ak: title = "known wavelet" else: title = "estimated wavelet" print title h = wn.getWaveletH(na,ka,a,nh,kh); plotSequence(Sampling(nh,st.delta,kh*st.delta),normalize(h),title=title) g = wn.applyHNmoA(na,ka,ak,nh,kh,h,f) plotGather(st,sx,g,"NMO with "+title)
def goEstimateWaveletFromVigGather(): """ Estimates wavelet from Viking Graben gather """ st,sx,f = readVigGather(800) nt,nx = st.count,sx.count dt,dx = st.delta,sx.delta ft,fx = st.first,sx.first ts=0.010,0.646,0.846,1.150,1.511,1.825,2.490,2.985 vs=1.510,1.575,1.687,1.817,1.938,1.980,2.446,2.735 vnmoP = CubicInterpolator(ts,vs).interpolate(rampfloat(ft,dt,nt)) vnmoM = fillfloat(1.500,nt) # water velocity, for multiples vnmo = vnmoM na,ka = 16,0 # sampling for inverse wavelet a nh,kh = 151,-25 # sampling for wavelet h fmin,fmax,sfac = 5.0,75.0,1.00 texp,tbal,smax = 2.0,100,9.00 tmin,tmax,perc = 0.4,1.9,98.0 #f = tpow(texp,st,f) if tbal>0: f = balance(tbal,f) nmo = NormalMoveout() nmo.setStretchMax(smax) wn = WaveletNmo(nmo) wn.setTimeRange(int(tmin/dt),int(tmax/dt)) wn.setFrequencyRange(fmin*dt,fmax*dt) wn.setStabilityFactor(sfac) e = nmo.apply(st,sx,vnmo,f) apef = wn.getInverseAPef(na,ka,f) anmo = wn.getInverseANmo(na,ka,st,sx,vnmo,f) hpef = wn.getWaveletH(na,ka,apef,nh,kh); hnmo = wn.getWaveletH(na,ka,anmo,nh,kh); plotWavelets(Sampling(nh,st.delta,kh*st.delta),[hnmo,hpef], title="estimated wavelets") plotGather(st,sx,f,tmin=tmin,tmax=tmax,perc=perc,title="CMP gather") plotGather(st,sx,e,tmin=tmin,tmax=tmax,perc=perc,title="conventional NMO") alist = [apef,anmo] hlist = [hpef,hnmo] tlist = ["PEF","NMO"] for ia in range(0,len(alist)): a = alist[ia] h = hlist[ia] t = tlist[ia] nah = na+nh kah = ka+kh ah = zerofloat(nah) conv(na,ka,a,nh,kh,h,nah,kah,ah) g = wn.applyHNmoA(na,ka,a,nh,kh,h,st,sx,vnmo,f) epef = wn.getVariancePef(na,ka,a,f) enmo = wn.getVarianceNmo(na,ka,a,st,sx,vnmo,f) enor = wn.getNormalizedVarianceNmo(na,ka,a,st,sx,vnmo,f) print tlist[ia]+": epef =",epef," enmo =",enmo," enor =",enor print " a ="; dump(a) plotGather(st,sx,g,tmin=tmin,tmax=tmax,perc=perc, title=t+": improved NMO")
def goEstimateWaveletFromOzGather(): """ Estimates wavelet from one of Oz Yilmaz's gathers """ name = "oz30" if name is "oz01": # Vibroseis st = Sampling(1275,0.004,0.004); nt,dt,ft = st.count,st.delta,st.first sx = Sampling(53,0.100584,-2.615184); nx,dx,fx = sx.count,sx.delta,sx.first vnmo = 3.00 # NMO velocity texp,tbal = 1.00,500 tmin,tmax,perc = 1.5,2.5,99 na,ka = 21,-10 # sampling for inverse wavelet a nh,kh = 51,-25 # sampling for wavelet h elif name is "oz04": # Vibroseis st = Sampling(1275,0.004,0.004); nt,dt,ft = st.count,st.delta,st.first sx = Sampling(52,0.1,-2.55); nx,dx,fx = sx.count,sx.delta,sx.first vnmo = 3.00 # NMO velocity texp,tbal = 1.00,500 tmin,tmax,perc = 0.0,5.0,99 na,ka = 21,-10 # sampling for inverse wavelet a nh,kh = 51,-25 # sampling for wavelet h elif name is "oz16": # Airgun st = Sampling(1325,0.004,0.004); nt,dt,ft = st.count,st.delta,st.first sx = Sampling( 48,0.025,0.233); nx,dx,fx = sx.count,sx.delta,sx.first vnmo = 1.95 # NMO velocity texp,tbal = 1.00,100 tmin,tmax,perc = 0.8,2.3,98 na,ka = 11,0 # sampling for inverse wavelet a nh,kh = 201,-50 # sampling for wavelet h elif name is "oz30": # Airgun st = Sampling(2175,0.004,0.00400); nt,dt,ft = st.count,st.delta,st.first sx = Sampling( 96,0.025,0.23075); nx,dx,fx = sx.count,sx.delta,sx.first vnmo = 1.60 # NMO velocity texp,tbal = 0.00,0 tmin,tmax,perc = 2.5,3.0,98 na,ka = 11,0 # sampling for inverse wavelet a nh,kh = 201,-50 # sampling for wavelet h f = zerofloat(nt,nx) ais = ArrayInputStream("/data/seis/oz/"+name+".F") ais.readFloats(f) ais.close() f = tpow(texp,st,f) if tbal>0: f = balance(tbal,f) wn = WaveletNmo(st,sx,vnmo) a = wn.getInverseA(na,ka,f) # estimate inverse wavelet h = wn.getWaveletH(na,ka,a,nh,kh); # estimate wavelet nah = na+nh kah = ka+kh ah = zerofloat(nah) conv(na,ka,a,nh,kh,h,nah,kah,ah) g = wn.applyHNmoA(na,ka,a,nh,kh,h,f) e = wn.applyNmo(f) print "a ="; dump(a); plotGather(st,sx,f,tmin=tmin,tmax=tmax,perc=perc,title="input gather") plotGather(st,sx,e,tmin=tmin,tmax=tmax,perc=perc,title="conventional NMO") plotGather(st,sx,g,tmin=tmin,tmax=tmax,perc=perc,title="improved NMO") plotSequence(Sampling(na,st.delta,ka*st.delta),normalize(a), title="inverse") plotSequence(Sampling(nh,st.delta,kh*st.delta),normalize(h), title="estimated wavelet") plotSequence(Sampling(nah,st.delta,kah*st.delta),normalize(ah), title="unit impulse")
def goEstimateWaveletFromGather(name): """ Estimates wavelet from a gather sampled in time and offset """ print name if name == "syn1": # Synthetic with one reflector st = Sampling(501, 0.004, 0.0) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(201, 0.010, 0.0) nx, dx, fx = sx.count, sx.delta, sx.first nref, vnmo = 1, 2.0 # number of reflectors and NMO velocity tran, tbed = False, False freq, decay = 20.0, 0.05 # peak frequency and decay for wavelet fmin, fmax, sfac = 0.0, 50.0, 1.00 texp, tbal = 0.00, 0 tmin, tmax, perc = 0.75, 1.75, 100.0 zp = True # zero-phase? if zp: na, ka = 5, -2 nh, kh = 251, -125 decay *= 4.0 else: na, ka = 11, 0 nh, kh = 151, -25 hsyn = getArWavelet(freq, decay, st, nh, kh, zp) elif name == "synr": # Synthetic with random reflectors st = Sampling(501, 0.004, 0.0) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(201, 0.010, 0.0) nx, dx, fx = sx.count, sx.delta, sx.first tran, tbed = True, False nref, vnmo = 40, 2.0 # number of reflectors and NMO velocity freq, decay = 20.0, 0.05 # peak frequency and decay for wavelet fmin, fmax, sfac = 0.0, 50.0, 1.00 texp, tbal = 0.00, 0 tmin, tmax, perc = 0.0, 1.75, 100.0 zp = False # zero-phase? na, ka = 11, 0 # sampling for inverse wavelet a nh, kh = 151, -25 # sampling for wavelet h hsyn = getArWavelet(freq, decay, st, nh, kh) elif name == "synt": # Synthetic with random thin beds st = Sampling(501, 0.004, 0.0) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(201, 0.010, 0.0) nx, dx, fx = sx.count, sx.delta, sx.first tran, tbed = True, True nref, vnmo = 40, 2.0 # number of reflectors and NMO velocity freq, decay = 20.0, 0.05 # peak frequency and decay for wavelet fmin, fmax, sfac = 0.0, 50.0, 1.0001 texp, tbal = 0.00, 0 tmin, tmax, perc = 0.15, 1.75, 100.0 zp = True # zero-phase? if zp: na, ka = 5, -2 nh, kh = 251, -125 decay *= 4.0 else: na, ka = 11, 0 nh, kh = 151, -25 hsyn = getArWavelet(freq, decay, st, nh, kh, zp) elif name == "oz01": # Vibroseis st = Sampling(1275, 0.004, 0.004) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(53, 0.100584, -2.615184) nx, dx, fx = sx.count, sx.delta, sx.first vnmo = 3.00 # NMO velocity fmin, fmax, sfac = 5.0, 80.0, 1.01 texp, tbal = 0.00, 100 tmin, tmax, perc = 1.5, 2.5, 99 na, ka = 21, 0 # sampling for inverse wavelet a nh, kh = 51, -25 # sampling for wavelet h hsyn = None elif name == "oz04": # Vibroseis st = Sampling(1275, 0.004, 0.004) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(52, 0.1, -2.55) nx, dx, fx = sx.count, sx.delta, sx.first vnmo = 3.00 # NMO velocity fmin, fmax, sfac = 5.0, 80.0, 1.01 texp, tbal = 0.00, 100 tmin, tmax, perc = 0.0, 5.0, 99 na, ka = 21, 0 # sampling for inverse wavelet a nh, kh = 51, -25 # sampling for wavelet h hsyn = None elif name == "oz16": # Airgun st = Sampling(1325, 0.004, 0.004) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(48, 0.025, 0.233) nx, dx, fx = sx.count, sx.delta, sx.first vnmo = 1.95 # NMO velocity fmin, fmax, sfac = 5.0, 50.0, 1.001 texp, tbal = 0.00, 100 tmin, tmax, perc = 0.8, 2.3, 98 na, ka = 11, 0 # sampling for inverse wavelet a nh, kh = 201, -50 # sampling for wavelet h hsyn = None elif name == "oz30": # Airgun st = Sampling(2175, 0.004, 0.00400) nt, dt, ft = st.count, st.delta, st.first sx = Sampling(96, 0.025, 0.23075) nx, dx, fx = sx.count, sx.delta, sx.first vnmo = 1.55 # NMO velocity fmin, fmax, sfac = 5.0, 100.0, 1.00 texp, tbal = 0.00, 100 #tmin,tmax,perc = 1.2,2.2,98 #tmin,tmax,perc = 2.5,3.5,98 tmin, tmax, perc = 1.2, 3.2, 98 na, ka = 11, 0 # sampling for inverse wavelet a nh, kh = 151, -25 # sampling for wavelet h hsyn = None f = zerofloat(nt, nx) if name[0:3] == "syn": p = makeCmpReflections(vnmo, nref, st, sx, random=tran, thinBeds=tbed) f = addArWavelet(freq, decay, st, sx, p, zp) else: ais = ArrayInputStream("/data/seis/oz/" + name + ".F") ais.readFloats(f) ais.close() f = tpow(texp, st, f) if tbal > 0: f = balance(tbal, f) nt, nx = st.count, sx.count dt, dx = st.delta, sx.delta ft, fx = st.first, sx.first vnmo = fillfloat(vnmo, nt) nmo = NormalMoveout() #nmo.setStretchMax(9.0) wn = WaveletNmo(nmo) wn.setFrequencyRange(fmin * dt, fmax * dt) wn.setTimeRange(int(tmin / dt), int(tmax / dt)) wn.setStabilityFactor(sfac) e = nmo.apply(st, sx, vnmo, f) apef = wn.getInverseAPef(na, ka, f) anmo = wn.getInverseANmo(na, ka, st, sx, vnmo, f) hpef = wn.getWaveletH(na, ka, apef, nh, kh) hnmo = wn.getWaveletH(na, ka, anmo, nh, kh) plotWavelets(Sampling(nh, st.delta, kh * st.delta), [hnmo, hpef, hsyn], title="estimated wavelets") plotGather(st, sx, f, tmin=tmin, tmax=tmax, perc=perc, title="input gather") plotGather(st, sx, e, tmin=tmin, tmax=tmax, perc=perc, title="conventional NMO") alist = [apef, anmo] hlist = [hpef, hnmo] tlist = ["PEF", "NMO"] for ia in range(0, len(alist)): a = alist[ia] h = hlist[ia] t = tlist[ia] nah = na + nh kah = ka + kh ah = zerofloat(nah) conv(na, ka, a, nh, kh, h, nah, kah, ah) g = wn.applyHNmoA(na, ka, a, nh, kh, h, st, sx, vnmo, f) epef = wn.getVariancePef(na, ka, a, f) enmo = wn.getVarianceNmo(na, ka, a, st, sx, vnmo, f) enor = wn.getNormalizedVarianceNmo(na, ka, a, st, sx, vnmo, f) print t + ": epef =", epef, " enmo =", enmo, " enor =", enor print " a =" dump(a) plotGather(st, sx, g, tmin=tmin, tmax=tmax, perc=perc, title=t + ": improved NMO")