예제 #1
0
def goSino():
  na,ka = 1,0 # sampling for inverse A of wavelet in PP image
  nb,kb = 1,0 # sampling for inverse B of wavelet in PS image
  nc,kc = 201,-100 # sampling for wavelet C in PP image
  nd,kd = 201,-100 # sampling for wavelet D in PS image
  nt,dt,ft = 501,0.004,0.000 # used for plotting only
  nx,dx,fx = 21,0.015,0.000
  #nx,dx,fx = 721,0.015,0.000
  sa = Sampling(na,dt,ka*dt)
  sb = Sampling(nb,dt,kb*dt)
  sc = Sampling(nc,dt,kc*dt)
  sd = Sampling(nd,dt,kd*dt)
  st = Sampling(nt,dt,ft)
  sx = Sampling(nx,dx,fx)
  tmin,tmax = 100,400 # PP time window
  sfac = 0.0 # stabilization factor
  f,g,u = getSinoImages() # PP image, PS image, and warping u(t,x)
  ww = WaveletWarpingAB()
  ww.setTimeRange(tmin,tmax)
  ww.setStabilityFactor(sfac)
  aw,bw = ww.getInverseAB(na,ka,nb,kb,u,f,g) # estimated inverses A & B
  dump(aw); dump(bw)
  cw = ww.getInverse(na,ka,aw,nc,kc) # estimated wavelet C
  dw = ww.getInverse(nb,kb,bw,nd,kd) # estimated wavelet D
  sg = ww.warp(u,g)
  af = ww.convolve(na,ka,aw,f)
  bg = ww.convolve(nb,kb,bw,g)
  sbg = ww.warp(u,bg)
  csbg = ww.convolve(nc,kc,cw,sbg)
  plotImage(st,sx,f,zoom=True,png="f")
  plotImage(st,sx,sg,zoom=True,png="sg")
  plotImage(st,sx,csbg,zoom=True,png="csbg")
  plotWaveletsPpPs(sc,cw,dw,png="cd")
예제 #2
0
def goSimpleTest():
  nt,ni = 981,50 # number of time samples; number of impulses
  freq,decay = 0.08,0.05 # peak frequency and decay for wavelet
  na,ka = 3,0 # sampling for inverse wavelet A
  nb,kb = 3,0 # 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
  tmin,tmax = 0,nt-1
  st = Sampling(nt,dt,ft)
  for mp in [True]: # True, for minimum-phase; False for other
    ck = getWavelet(freq,decay,nc,kc,mp) # known wavelet C
    dk = getWavelet(freq,decay,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)
      if r0>1.0:
        u,p,q = logupq(r0,r1,nt,ni)
      else:
        u,p,q = nmoupq(r0,r1,nt,ni)
      f = addWavelet(freq,decay,p,mp)
      g = addWavelet(freq,decay,q,mp)
      ww = WaveletWarpingAB()
      ww.setTimeRange(tmin,tmax)
      aw,bw = ww.getInverseAB(na,ka,nb,kb,u,f,g) # estimated inverses A & B
      ak = ww.getInverse(nc,kc,ck,na,ka) # known inverse wavelet A
      bk = ww.getInverse(nd,kd,dk,nb,kb) # known inverse wavelet B
      #dump(ak); dump(bk);
      dump(aw); dump(bw)
      cw = ww.getInverse(na,ka,aw,nc,kc) # estimated wavelet C
      dw = ww.getInverse(nb,kb,bw,nd,kd) # estimated wavelet D
      sg = ww.warp(u,g)
      af = ww.convolve(na,ka,aw,f)
      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,[af,bg],labels=["Af","Bg"],title=title)
      plotSequences(st,[af,sbg],labels=["Af","SBg"],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")