Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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")
Ejemplo n.º 4
0
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])
Ejemplo n.º 5
0
def makeObjectFunctPlotReal():
  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/cdp=1301.strip"
  
  hp = SUDataGrabber.grab2DFile(cmp, nx, nt)
  hp = tpow(3.0,st,hp)
  
  #tnmo =     [0.0380286,0.475358,0.950715,1.25,1.75882,2.33876,3.54617,4.35428,5.68528]
  #vnmo =     [1.50597  ,1.52462 ,1.79203 ,1.87,2.0,2.28953,2.45122,2.65644,2.69997]
  #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
  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,2.105,2.446,2.735
  vnmoInterp = interpolateVel(ts,st,vs)
  sp = SimplePlot(SimplePlot.Origin.UPPER_LEFT)
  sp.addPoints(st, vnmoInterp)

  wn = WaveletNmo(st,sx,vnmoInterp)
  na = 3
  ka = 0
  pd = PredDecon(hp,na,ka)
  apred = pd.getPredErrorCoef()
  fa1 = apred[1]
  fa2 = apred[2]
  sa1 = Sampling(1,.1,fa1)
  sa2 = Sampling(1,.1,fa2)

  #nmo corrected gather
  wn = WaveletNmo(st,sx,vnmoInterp)
  ojgnmo = ObjectiveFunction.PEFGather(hp,sa1,sa2,sx,st,wn,vnmo)

  #weird "semblance" term
  ojgnmosem = ObjectiveFunction.SemblanceGather(hp,sa1,sa2,sx,st,wn,vnmo)
  
  
  plotObjectiveFunctWa(sa1,sa2,ojgnmo,"VG Obj. Function PEF Term",apred)
  plotObjectiveFunctWa(sa1,sa2,ojgnmosem,"VG Obj. Function Semblance Term",apred)
  fa = zerofloat(nt,nx)
  for x in range(0,nx):
    conv(na,0,apred,nt,0,hp[x],nt,0,fa[x])
  nmofa = wn.applyNmo(fa)
  plotGatherPNG(st,sx,hp,0,6,100,"Viking Graben CDP 1300")  
  plotGather(st,sx,fa,0,6,100)  

  plotGather(st,sx,nmofa,0,6,100)
Ejemplo n.º 6
0
def makeObjectFunctPlotSynthetic(nref):
  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
  na,ka = 3,0 # 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
  print "known inverse coefficients"
  dump(ak)
  fa1 = a1-2.5
  fa2 = a2-2.5
  sa1 = Sampling(50,.1,fa1)
  sa2 = Sampling(50,.1,fa2)
  #ojg = PredDecon.constructPEFGatherObjFunction(hp,sa1,sa2,sx,st)
 

  #nmo corrected gather
  wn = WaveletNmo(st,sx,vnmo)
  ojgnmo = ObjectiveFunction.PEFGather(hp,sa1,sa2,sx,st,wn,vnmo)

  #weird "semblance" term
  ojgnmosem = ObjectiveFunction.SemblanceGather(hp,sa1,sa2,sx,st,wn,vnmo)
  fa = zerofloat(nt,nx)
  for x in range(0,nx):
    conv(na,0,ak,nt,0,hp[x],nt,0,fa[x])
  nmofa = wn.applyNmo(fa)
  plotGatherPNG(st,sx,hp,0,2,100,"Synthetic Gather")  
  plotGather(st,sx,fa,0,2,100)
  plotGather(st,sx,nmofa,0,2,100)
  
  print ak
  #plotObjectiveFunct(sa1,sa2,ojg,"Synth Gather objective function",ak)
  plotObjectiveFunctWa(sa1,sa2,ojgnmo,"Synth. Obj. Function PEF Term",ak)
  plotObjectiveFunctWa(sa1,sa2,ojgnmosem,"Synth. Obj. Function Semblance Term",ak)
Ejemplo n.º 7
0
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")
Ejemplo n.º 8
0
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")
Ejemplo n.º 9
0
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")
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
def inverseAndWaveletCalc(sx,st,f,vnmo,fmin,fmax,sfac,
    na,ka,nh,kh,hsyn,tmin,tmax,uncert,w=None):
  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)
  if w:
    wn = WaveletNmo(nmo,w)
  else:
    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)
  title = "Estimated Wavelets "+str(uncert)+" "+str(tmin)+" s to "+str(tmax)+" s"
  plotWavelets(Sampling(nh,st.delta,kh*st.delta),[hnmo,hpef,hsyn],
               title=title,pngDir=pngDir)
  title = "Input Gather "+str(uncert)+" "+str(tmin)+" s to "+str(tmax)+" s"
  plotGather(st,sx,f,tmin=tmin,tmax=tmax,title=title,pngDir=pngDir)
  title = "Conventional NMO "+str(uncert)+" "+str(tmin)+" s to "+str(tmax)+" s"
  plotGather(st,sx,e,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 t+" epef =",epef," enmo =",enmo," enor =",enor
    print " a ="; dump(a)
    title = t+" improved NMO "+str(uncert)+" "+str(tmin)+" s to "+str(tmax)+" s"
    plotGather(st,sx,g,tmin=tmin,tmax=tmax,title=title,pngDir=pngDir)
  return hpef,hnmo
Ejemplo n.º 12
0
Archivo: nmo.py Proyecto: BKJackson/idh
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")
Ejemplo n.º 13
0
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")
Ejemplo n.º 14
0
Archivo: nmo.py Proyecto: cgraziano/cg
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 = False # 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)
  f = zerofloat(nt,nx)
  p = makeCmpReflections(vnmo,nref,st,sx,random=tran,thinBeds=tbed)
  f = addArWavelet(freq,decay,st,sx,p,zp)
  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"]
  
  directory = "./thesisFiguresSlides/nmo/"
  fracWidth,fracHeight,aspectRatio = 0.9,0.8,16.0/9.0
  pngDir = directory
  #pngDir = None
  title= "Nmo correction" 
  print title
  vmin,vmax = tmin,tmax
  vlabel,vminmax,vint = "Time (s)",[vmin,vmax],0.5
  hlabel = ["Offset (km)","Offset (km)"]
  hminmax = None
  hint = 0.5
  tilespacing = None
  clip = 3.0
  plotting.plotImagesSideBySideNMO(st,sx,[e],\
  vlabel=vlabel,vminmax=vminmax,vint=vint,\
  hlabel=hlabel,hminmax=hminmax,hint=hint,\
  clip = clip,\
  tilespacing = tilespacing,\
  title=title,pngDir=pngDir,\
  slide=True,fracWidth=fracWidth,fracHeight=fracHeight,aspectRatio=aspectRatio)


  directory = "./thesisFiguresSlides/nmo/"
  fracWidth,fracHeight,aspectRatio = 0.9,0.8,16.0/9.0
  pngDir = directory
  #pngDir = None
  title= "Nmo cmp" 
  print title
  vmin,vmax = tmin,tmax
  vlabel,vminmax,vint = "Time (s)",[vmin,vmax],0.5
  hlabel = ["Offset (km)","Offset (km)"]
  hminmax = None
  hint = 0.5
  tilespacing = None
  clip = 3.0
  plotting.plotImagesSideBySideNMO(st,sx,[f],\
  vlabel=vlabel,vminmax=vminmax,vint=vint,\
  hlabel=hlabel,hminmax=hminmax,hint=hint,\
  clip = clip,\
  tilespacing = tilespacing,\
  title=title,pngDir=pngDir,\
  slide=True,fracWidth=fracWidth,fracHeight=fracHeight,aspectRatio=aspectRatio)


  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")
Ejemplo n.º 15
0
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