Exemple #1
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
Exemple #2
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")
Exemple #3
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
Exemple #4
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")
Exemple #5
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")
Exemple #6
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 = 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")
Exemple #7
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