Beispiel #1
0
def goSinoTraces():
  na,ka = 41,-20 # sampling for inverse A
  nh,kh = 41,-20 # sampling for wavelet H
  nt,dt,ft = 501,0.004,0.000 # used for plotting only
  #nx,dx,fx = 721,0.015,0.000
  sa = Sampling(na,dt,ka*dt)
  sh = Sampling(nh,dt,kh*dt)
  st = Sampling(nt,dt,ft)
  f,g,u = getSinoTraces(16) # PP trace f(t), PS trace g(u), and warping u(t)
  ww = WaveletWarpingAH()
  ww.setTimeRange(100,500) # PP time window
  ww.setStabilityFactor(0.001) # stability factor
  ww.setMaxIterations(100) # max Gauss-Newton iterations
  a,h = ww.getAHGaussNewton(na,ka,nh,kh,u,f,g)
  sg = ww.warp(u,g)
  ag = ww.convolve(na,ka,a,g)
  sag = ww.warp(u,ag)
  hsag = ww.convolve(nh,kh,h,sag)
  dump(a)
  g = copy(nt,g)
  sg = copy(nt,sg)
  sag = copy(nt,sag)
  hsag = copy(nt,hsag)
  fmhsag= sub(f,hsag)
  plotWavelets(sa,[a],title="A")
  plotWavelets(sh,[h],title="H")
  plotTraces(st,[f,hsag,fmhsag],labels=["f","HSAg","f-HSAg"])
Beispiel #2
0
def goTest():
  nt,ni = 981,500 # number of time samples; number of impulses
  ffreq,fdecay = 0.08,0.05 # peak frequency and decay for wavelet
  gfreq,gdecay = 0.08,0.05 # peak frequency and decay for wavelet
  na,ka = 11,-5 # sampling for inverse wavelet A
  nb,kb = 11,-5 # sampling for inverse wavelet B
  nc,kc = 181,-90 # sampling for wavelet C
  nd,kd = 181,-90 # sampling for wavelet D
  dt,ft = 0.004,0.000 # used for plotting only
  st = Sampling(nt,dt,ft)
  for mp in [False]: # True, for minimum-phase; False for mixed-phase
    ck = getWavelet(ffreq,fdecay,nc,kc,mp) # known wavelet C
    dk = getWavelet(gfreq,gdecay,nc,kc,mp) # known wavelet D
    normalizeMax(ck)
    normalizeMax(dk)
    #for r0,r1 in [(3.0,1.5),(2.0,2.0)]: # <1 for stretch; >1 for squeeze
    for r0,r1 in [(3.0,1.5)]: # <1 for stretch; >1 for squeeze
      title = "r0 = "+str(r0)+"  r1 = "+str(r1)
      u,p,q = logupq(r0,r1,nt,ni)
      f = addWavelet(ffreq,fdecay,p,mp)
      g = addWavelet(gfreq,fdecay,q,mp)
      ww = WaveletWarpingAH()
      ww.setTimeRange(0,nt/2)
      ww.setStabilityFactor(0.0001)
      ww.setMaxIterations(40)
      #bw,cw = ww.getAHSimple(nb,kb,nc,kc,u,f,g);
      bw,cw = ww.getAHNewton(nb,kb,nc,kc,u,f,g);
      #bw,cw = ww.getAHGaussNewton(nb,kb,nc,kc,u,f,g);
      print "rmse =",ww.rms(sub(f,ww.applyHSA(nb,kb,bw,nc,kc,cw,u,g)))
      dump(bw);
      dw = ww.getWavelet(nd,kd,nb,kb,bw)
      sg = ww.warp(u,g)
      bg = ww.convolve(nb,kb,bw,g)
      sbg = ww.warp(u,bg)
      csbg = ww.convolve(nc,kc,cw,sbg)
      normalizeMax(cw)
      normalizeMax(dw)
      plotSequences(st,[f,g],labels=["f","g"],title=title)
      plotSequences(st,[f,sg],labels=["f","Sg"],title=title)
      plotSequences(st,[f,csbg],labels=["f","CSBg"],title=title)
      plotWavelets(Sampling(nc,dt,kc*dt),[cw,ck],title=title+" C")
      plotWavelets(Sampling(nd,dt,kd*dt),[dw,dk],title=title+" D")
Beispiel #3
0
def goSinoImages():
  na,ka = 21,-10 # sampling for inverse A
  nh,kh = 81,-40 # sampling for wavelet H
  nt,dt,ft = 501,0.004,0.000 # used for plotting only
  #nx,dx,fx = 721,0.015,0.000
  nx,dx,fx = 101,0.015,0.000
  sa = Sampling(na,dt,ka*dt)
  sh = Sampling(nh,dt,kh*dt)
  st = Sampling(nt,dt,ft)
  sx = Sampling(nx,dx,fx)
  tmin,tmax = 100,500 # PP time window
  f,g,u = getSinoImages() # PP image, PS image, and warping u(t,x)
  ww = WaveletWarpingAH()
  ww.setTimeRange(100,400) # PP time window
  ww.setStabilityFactor(0.0001) # stability factor
  ww.setMaxIterations(20) # max Gauss-Newton iterations
  a,h = ww.getAHGaussNewton(na,ka,nh,kh,u,f,g)
  dump(a)
  sg = ww.warp(u,g)
  ag = ww.convolve(na,ka,a,g)
  sag = ww.warp(u,ag)
  hsag = ww.convolve(nh,kh,h,sag)
  normalizeRms(f)
  normalizeRms(sg)
  normalizeRms(hsag)
  plotImage(st,sx,f,zoom=True,png="f")
  plotWavelets(sa,[a],title="A")
  plotWavelets(sh,[h],title="H")
  plotImage(st,sx,sg,zoom=True,png="Sg")
  plotImage(st,sx,hsag,zoom=True,png="HSAg")
def goSinoTraces():
    na, ka = 41, -20  # sampling for inverse A
    nh, kh = 41, -20  # sampling for wavelet H
    nt, dt, ft = 501, 0.004, 0.000  # used for plotting only
    #nx,dx,fx = 721,0.015,0.000
    sa = Sampling(na, dt, ka * dt)
    sh = Sampling(nh, dt, kh * dt)
    st = Sampling(nt, dt, ft)
    f, g, u = getSinoTraces(
        16)  # PP trace f(t), PS trace g(u), and warping u(t)
    ww = WaveletWarpingAH()
    ww.setTimeRange(100, 500)  # PP time window
    ww.setStabilityFactor(0.001)  # stability factor
    ww.setMaxIterations(100)  # max Gauss-Newton iterations
    a, h = ww.getAHGaussNewton(na, ka, nh, kh, u, f, g)
    sg = ww.warp(u, g)
    ag = ww.convolve(na, ka, a, g)
    sag = ww.warp(u, ag)
    hsag = ww.convolve(nh, kh, h, sag)
    dump(a)
    g = copy(nt, g)
    sg = copy(nt, sg)
    sag = copy(nt, sag)
    hsag = copy(nt, hsag)
    fmhsag = sub(f, hsag)
    plotWavelets(sa, [a], title="A")
    plotWavelets(sh, [h], title="H")
    plotTraces(st, [f, hsag, fmhsag], labels=["f", "HSAg", "f-HSAg"])
def goTest():
    nt, ni = 981, 500  # number of time samples; number of impulses
    ffreq, fdecay = 0.08, 0.05  # peak frequency and decay for wavelet
    gfreq, gdecay = 0.08, 0.05  # peak frequency and decay for wavelet
    na, ka = 11, -5  # sampling for inverse wavelet A
    nb, kb = 11, -5  # sampling for inverse wavelet B
    nc, kc = 181, -90  # sampling for wavelet C
    nd, kd = 181, -90  # sampling for wavelet D
    dt, ft = 0.004, 0.000  # used for plotting only
    st = Sampling(nt, dt, ft)
    for mp in [False]:  # True, for minimum-phase; False for mixed-phase
        ck = getWavelet(ffreq, fdecay, nc, kc, mp)  # known wavelet C
        dk = getWavelet(gfreq, gdecay, nc, kc, mp)  # known wavelet D
        normalizeMax(ck)
        normalizeMax(dk)
        #for r0,r1 in [(3.0,1.5),(2.0,2.0)]: # <1 for stretch; >1 for squeeze
        for r0, r1 in [(3.0, 1.5)]:  # <1 for stretch; >1 for squeeze
            title = "r0 = " + str(r0) + "  r1 = " + str(r1)
            u, p, q = logupq(r0, r1, nt, ni)
            f = addWavelet(ffreq, fdecay, p, mp)
            g = addWavelet(gfreq, fdecay, q, mp)
            ww = WaveletWarpingAH()
            ww.setTimeRange(0, nt / 2)
            ww.setStabilityFactor(0.0001)
            ww.setMaxIterations(40)
            #bw,cw = ww.getAHSimple(nb,kb,nc,kc,u,f,g);
            bw, cw = ww.getAHNewton(nb, kb, nc, kc, u, f, g)
            #bw,cw = ww.getAHGaussNewton(nb,kb,nc,kc,u,f,g);
            print "rmse =", ww.rms(
                sub(f, ww.applyHSA(nb, kb, bw, nc, kc, cw, u, g)))
            dump(bw)
            dw = ww.getWavelet(nd, kd, nb, kb, bw)
            sg = ww.warp(u, g)
            bg = ww.convolve(nb, kb, bw, g)
            sbg = ww.warp(u, bg)
            csbg = ww.convolve(nc, kc, cw, sbg)
            normalizeMax(cw)
            normalizeMax(dw)
            plotSequences(st, [f, g], labels=["f", "g"], title=title)
            plotSequences(st, [f, sg], labels=["f", "Sg"], title=title)
            plotSequences(st, [f, csbg], labels=["f", "CSBg"], title=title)
            plotWavelets(Sampling(nc, dt, kc * dt), [cw, ck],
                         title=title + " C")
            plotWavelets(Sampling(nd, dt, kd * dt), [dw, dk],
                         title=title + " D")
def goSinoImages():
    na, ka = 21, -10  # sampling for inverse A
    nh, kh = 81, -40  # sampling for wavelet H
    nt, dt, ft = 501, 0.004, 0.000  # used for plotting only
    #nx,dx,fx = 721,0.015,0.000
    nx, dx, fx = 101, 0.015, 0.000
    sa = Sampling(na, dt, ka * dt)
    sh = Sampling(nh, dt, kh * dt)
    st = Sampling(nt, dt, ft)
    sx = Sampling(nx, dx, fx)
    tmin, tmax = 100, 500  # PP time window
    f, g, u = getSinoImages()  # PP image, PS image, and warping u(t,x)
    ww = WaveletWarpingAH()
    ww.setTimeRange(100, 400)  # PP time window
    ww.setStabilityFactor(0.0001)  # stability factor
    ww.setMaxIterations(20)  # max Gauss-Newton iterations
    a, h = ww.getAHGaussNewton(na, ka, nh, kh, u, f, g)
    dump(a)
    sg = ww.warp(u, g)
    ag = ww.convolve(na, ka, a, g)
    sag = ww.warp(u, ag)
    hsag = ww.convolve(nh, kh, h, sag)
    normalizeRms(f)
    normalizeRms(sg)
    normalizeRms(hsag)
    plotImage(st, sx, f, zoom=True, png="f")
    plotWavelets(sa, [a], title="A")
    plotWavelets(sh, [h], title="H")
    plotImage(st, sx, sg, zoom=True, png="Sg")
    plotImage(st, sx, hsag, zoom=True, png="HSAg")