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 testInverseCalcReal(na,ka): #################### Build wavelet and CMP gather with const v########## st = Sampling(1500,0.004,0.0); nt,dt,ft = st.count,st.delta,st.first sx = Sampling(60,0.0496,.262); nx,dx,fx = sx.count,sx.delta,sx.first cmp = "C:/Users/Chris/Documents/CWP/Research/research/vikinggrabenCMP/m1cdp=1300.strip" hp = SUDataGrabber.grab2DFile(cmp, nx, nt) hp = tpow(3.0,st,hp) tnmo = [0.010,0.646,0.846,1.150,1.511,1.825,2.490,2.985] vnmo = [1.510,1.575,1.687,1.817,1.938,1.980,2.446,2.735] vnmoInterp = interpolateVel(tnmo,st,vnmo) #################### Enhanced NMO Estimation ######################### wn = WaveletNmo(st,sx,vnmoInterp) aenha = wn.getInverseA(na,ka,hp) # estimate inverse wavelet print "enhance nmo inverse coefficients" dump(aenha) pd = PredDecon(hp,na,ka) apred = pd.getPredErrorCoef() print "predictive decon inverse coefficients" dump(apred) ####Use predictive deconvolution to get prediction error coefficients #to get the inverse of the wavelet #pd = PredDecon(wn.applyNmo(hp),na,ka) #pd = PredDecon(hp,na,ka) #apred = pd.getPredErrorCoef() #print "predictive decon nmo inverse coefficients" dump(apred)
def goEstimateWaveletFromSynthetic_More3NA_PEF(na, ka, nh, kh, nref): #Input data 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 = nref,2.0 # number of reflectors and NMO velocity freq,decay = 30.0,0.1 # peak frequency and decay for wavelet p = makeCmpReflections(vnmo,1,st,sx) # cmp gather without wavelet hp = addArWavelet(freq,decay,st,sx,p) # cmp gather with wavelet plotGather(st,sx,hp,0,2,100,"CMP gather") na,ka = na,ka # sampling for inverse wavelet a nh,kh = nh,kh # sampling for wavelet h wn = WaveletNmo(st,sx,vnmo) a = wn.getInverseA(na,ka,hp) # estimate inverse wavelet h = wn.getWaveletH(na,ka,a,nh,kh); # estimate wavelet g = wn.applyHNmoA(na,ka,a,nh,kh,h,hp) #convolve inverse, apply NMO, convolve wavelet pd = PredDecon(hp,na,ka) apred = pd.getPredErrorCoef() hpred = wn.getWaveletH(na,ka,apred,nh,kh); # estimate wavelet tmin,tmax,perc = 0.0,2,100.0 #plotGather(st,sx,d,tmin=tmin,tmax=tmax,perc=perc,title="Difference") #plotGather(st,sx,g,tmin=tmin,tmax=tmax,perc=perc,title="improved NMO") #plotGather(st,sx,e,tmin=tmin,tmax=tmax,perc=perc,title="conventional NMO") #plotGather(st,sx,hp,tmin=tmin,tmax=tmax,perc=perc,title="input gather") sa = Sampling(na,st.delta,ka*st.delta) sh = Sampling(nh,st.delta,kh*st.delta) plot2Sequences(sa,sa,a,apred,title="inverse") plot2Sequences(sh,sh,normalize(h),normalize(hpred),title="estimated wavelet")
def testInverseCalcSynthetic(na,ka,nref): #################### Build wavelet and CMP gather with const v########## 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 = nref,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 hp = addArWavelet(freq,decay,st,sx,p) # cmp gather with wavelet 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 print "known inverse coefficients" dump(ak) wn = WaveletNmo(st,sx,vnmo) fa = zerofloat(nt,nx) plotGather(st,sx,hp,0,2,100) for x in range(0,nx): conv(na,0,ak,nt,0,hp[x],nt,0,fa[x]) nmofa = wn.applyNmo(fa) print PredDecon.semblance(nmofa) test = zerofloat(nt,nx) for i in range(0,nx): test[i][125] = 2.0 plotGatherPNG(st,sx,test,"test zoom",.4,.6) plotGatherPNG(st,sx,nmofa,"nmofa zoom",.4,.6) print PredDecon.semblance(test) plotGather(st,sx,fa,0,2,100) plotGather(st,sx,nmofa,0,2,100) #plotGather(st,sx,fa,0,2,100) #################### Enhanced NMO Estimation ######################### aenha = wn.getInverseA(na,ka,hp) # estimate inverse wavelet print "enhance nmo inverse coefficients" dump(aenha) pd = PredDecon(hp,na,ka) apredC = pd.getPredErrorCoef() apredD = pd.getInverseAPef(na, 0, hp) print "Chris predictive decon inverse coefficients" dump(apredC) print "predictive decon inverse coefficients" dump(apredD) fa = zerofloat(nt,nx) for x in range(0,nx): conv(na,0,apred,nt,0,hp[x],nt,0,fa[x])
def goEstimateWaveletFromSyntheticPEF(na, ka, nh, kh, nref): #Input data 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 = nref,2.0 # number of reflectors and NMO velocity freq,decay = 30.0,0.1 # peak frequency and decay for wavelet p = makeCmpReflections(vnmo,1,st,sx) # cmp gather without wavelet hp = addArWavelet(freq,decay,st,sx,p) # cmp gather with wavelet plotGather(st,sx,hp,0,2,100,"CMP gather") na,ka = na,ka # sampling for inverse wavelet a nh,kh = nh,kh # sampling for wavelet h 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 = zerofloat(na) # array for the known inverse wavelet a ak[0-ka] = 1.0 ak[1-ka] = a1 ak[2-ka] = a2 wn = WaveletNmo(st,sx,vnmo) a = wn.getInverseA(na,ka,hp) # estimate inverse wavelet h = wn.getWaveletH(na,ka,a,nh,kh); # estimate wavelet g = wn.applyHNmoA(na,ka,a,nh,kh,h,hp) #convolve inverse, apply NMO, convolve wavelet #apply NMO to original data e = wn.applyNmo(hp) hk = wn.getWaveletH(na,ka,ak,nh,kh); # estimate wavelet pd = PredDecon(hp,na,ka) apred = pd.getPredErrorCoef() hpred = wn.getWaveletH(na,ka,apred,nh,kh); # estimate wavelet tmin,tmax,perc = 0.0,2,100.0 #plotGather(st,sx,d,tmin=tmin,tmax=tmax,perc=perc,title="Difference") #plotGather(st,sx,g,tmin=tmin,tmax=tmax,perc=perc,title="improved NMO") #plotGather(st,sx,e,tmin=tmin,tmax=tmax,perc=perc,title="conventional NMO") #plotGather(st,sx,hp,tmin=tmin,tmax=tmax,perc=perc,title="input gather") sa = Sampling(na,st.delta,ka*st.delta) sh = Sampling(nh,st.delta,kh*st.delta) plot3Sequences(sa,sa,sa,ak,a,apred,title="inverse") plot3Sequences(sh,sh,sh,normalize(hk),normalize(h),normalize(hpred),title="estimated wavelet")
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")