def inverseAndWaveletCalc(sx,st,f,vnmo,smax,fmin,fmax,sfac, na,ka,nh,kh,tmin,tmax,perc,w=None): tmino = 0 tmaxo = 3 hmax = 5 nt,nx = st.count,sx.count dt,dx = st.delta,sx.delta ft,fx = st.first,sx.first nmo = NormalMoveout() nmo.setStretchMax(smax) if w: wn = WaveletNmo(nmo,w) else: 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); title = "Estimated Wavelets "+str(tmin)+" s to "+str(tmax)+" s" plotWavelets(Sampling(nh,st.delta,kh*st.delta),[hnmo,hpef],hmax, title=title,pngDir=pngDir) title = "Input Gather "+str(tmin)+" s to "+str(tmax)+" s" plotGather(st,sx,f,tmin=tmin,tmax=tmax,perc=perc,title=title,pngDir=pngDir) title = "Conventional NMO "+str(tmin)+" s to "+str(tmax)+" s" plotGather(st,sx,e,tmin=tmino,tmax=tmaxo,perc=perc,title=title,pngDir=pngDir) 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) title = t+" improved NMO "+str(tmin)+" s to "+str(tmax)+" s" plotGather(st,sx,g,tmin=tmino,tmax=tmaxo,perc=perc,title=title,pngDir=pngDir) #plotGather(st,sx,e,tmin=tmin,tmax=tmax,perc=perc, # title=t+": stack error") #plotSequence(Sampling(na,st.delta,ka*st.delta),normalize(a), # title="inverse wavelet") #plotSequence(Sampling(nah,st.delta,kah*st.delta),normalize(ah), # title="unit impulse") #d = wn.getDifferenceGathers(na,ka,st,sx,vnmo,f) #for ia in range(na): # plotGather(st,sx,d[ia], # tmin=tmin,tmax=tmax,perc=perc,title="lag="+str(ka+ia)) return hpef,hnmo
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 goNmoVigGather(): """ Applies NMO correction to 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.475,nt) vnmo = vnmoM texp,tbal,smax = 2.0,100,9.00 tmin,tmax,perc = 0.4,2.4,98.0 #f = tpow(texp,st,f) if tbal>0: f = balance(tbal,f) nmo = NormalMoveout() nmo.setStretchMax(smax) g = nmo.apply(st,sx,vnmo,f) h = nmo.stackAndReplicate(g) plotGather(st,sx,f,tmin=tmin,tmax=tmax,perc=perc,title="input"); plotGather(st,sx,g,tmin=tmin,tmax=tmax,perc=perc,title="output"); plotGather(st,sx,h,tmin=tmin,tmax=tmax,perc=perc,title="stack");
def inverseAndWaveletCalc(icdp,smax,fmin,fmax,texp,tbal,sfac, na,ka,nh,kh,tmin,tmax,perc): """ Estimates wavelet from a gather sampled in time and offset """ tmino = 0 tmaxo = 3 hmax = 5 st,sx,f = getVikingGrabenCDP(icdp) nt,nx = st.count,sx.count dt,dx = st.delta,sx.delta ft,fx = st.first,sx.first #ts = [0.0380,0.475,0.950,1.758,2.338,3.546,4.354,5.685] #vs = [1.505,1.524,1.792,2.040,2.289,2.451,2.656,2.699] 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 = vnmoP #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); title = "Estimated Wavelets CDP "+str(icdp) plotWavelets(Sampling(nh,st.delta,kh*st.delta),[hnmo,hpef],hmax, title=title,pngDir=pngDir) title = "Input Gather CDP "+str(icdp) plotGather(st,sx,f,tmin=tmin,tmax=tmax,perc=perc,title=title,pngDir=pngDir) title = "Conventional NMO CDP "+str(icdp) plotGather(st,sx,e,tmin=tmino,tmax=tmaxo,perc=perc,title=title,pngDir=pngDir) 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) title = t+" improved NMO CDP "+str(icdp) plotGather(st,sx,g,tmin=tmino,tmax=tmaxo,perc=perc, title=title,pngDir=pngDir) #plotGather(st,sx,e,tmin=tmin,tmax=tmax,perc=perc, # title=t+": stack error") #plotSequence(Sampling(na,st.delta,ka*st.delta),normalize(a), # title="inverse wavelet") #plotSequence(Sampling(nah,st.delta,kah*st.delta),normalize(ah), # title="unit impulse") #d = wn.getDifferenceGathers(na,ka,st,sx,vnmo,f) #for ia in range(na): # plotGather(st,sx,d[ia], # tmin=tmin,tmax=tmax,perc=perc,title="lag="+str(ka+ia)) return hpef,hnmo,st