示例#1
0
文件: warpx.py 项目: cgraziano/idh
def goFakeErrors():
  dw = DynamicWarping(shiftMin,shiftMax)
  u = zerofloat(n1)
  for cs in [1.0,0.5]:
    e = dw.fakeErrors(cs,nl,n1)
    plotShifts(e)
    for ds in [1.0,0.1,0.01]:
      u[0] = 0.0
      esum = dw.findShiftsSmooth(ds,e,u)
      print "cs =",cs," ds=",ds," esum =",esum
      plotShifts(e,u)
示例#2
0
文件: warpx.py 项目: jyzhou/idh
def goFakeErrors():
    dw = DynamicWarping(shiftMin, shiftMax)
    u = zerofloat(n1)
    for cs in [1.0, 0.5]:
        e = dw.fakeErrors(cs, nl, n1)
        plotShifts(e)
        for ds in [1.0, 0.1, 0.01]:
            u[0] = 0.0
            esum = dw.findShiftsSmooth(ds, e, u)
            print "cs =", cs, " ds=", ds, " esum =", esum
            plotShifts(e, u)
示例#3
0
文件: sino2geop.py 项目: jyzhou/idh
def warp1(f, g):
    usmooth = 8.0
    strainMax1 = 0.125
    shiftMin = 0
    shiftMax = 160
    dw = DynamicWarping(shiftMin, shiftMax)
    dw.setErrorExtrapolation(DynamicWarping.ErrorExtrapolation.REFLECT)
    dw.setStrainMax(strainMax1)
    dw.setShiftSmoothing(usmooth, usmooth)
    e1 = dw.computeErrors1(f, g)
    d1 = dw.accumulateForward(e1)
    u1 = dw.backtrackReverse(d1, e1)
    nl = len(e1[0])

    def plotShifts():
        nl = len(e1[0])
        sp = SimplePlot()
        sp.setSize(1400, 500)
        sl = Sampling(nl, s1f.delta, shiftMin * s1f.delta)
        pv = sp.addPixels(s1f, sl, pow(transpose(e1), 1.0))
        pv.setInterpolation(PixelsView.Interpolation.NEAREST)
        pv.setColorModel(ColorMap.JET)
        pv.setPercentiles(2, 98)
        pv = sp.addPoints(s1f, mul(s1f.delta, u1))

    #plotShifts()
    u1 = dw.smoothShifts(u1)
    #plotShifts()
    n1, n2 = len(f[0]), len(f)
    h = zerofloat(n1, n2)
    u = zerofloat(n1, n2)
    for i2 in range(n2):
        copy(u1, u[i2])
        dw.applyShifts(u1, g[i2], h[i2])
    print "warp1: u min =", min(u), " max =", max(u)
    return u, h
示例#4
0
文件: sino2geop.py 项目: jyzhou/idh
def warp2(f, g):
    #esmooth,usmooth = 0,0.0
    esmooth, usmooth = 2, 8.0
    rsmooth = 101
    strainMax1 = 0.125
    strainMax2 = 0.125
    shiftMax = 10
    shiftMin = -shiftMax
    dw = DynamicWarping(shiftMin, shiftMax)
    dw.setErrorExtrapolation(DynamicWarping.ErrorExtrapolation.REFLECT)
    dw.setStrainMax(strainMax1, strainMax2)
    dw.setShiftSmoothing(usmooth)
    e = dw.computeErrors(f, g)
    for ismooth in range(esmooth):
        dw.smoothErrors(e, e)
    d = dw.accumulateForward1(e)
    u = dw.backtrackReverse1(d, e)
    u = dw.smoothShifts(u)
    h = dw.applyShifts(u, g)
    print "warp2: u min =", min(u), " max =", max(u)
    return u, h
示例#5
0
文件: sino2x.py 项目: BKJackson/idh
def warp1(f,g):
  usmooth = 8.0
  strainMax1 = 0.125
  shiftMin = 0
  shiftMax = 160
  dw = DynamicWarping(shiftMin,shiftMax)
  dw.setErrorExtrapolation(DynamicWarping.ErrorExtrapolation.REFLECT)
  dw.setStrainMax(strainMax1)
  dw.setShiftSmoothing(usmooth,usmooth)
  e1 = dw.computeErrors1(f,g)
  d1 = dw.accumulateForward(e1)
  u1 = dw.backtrackReverse(d1,e1)
  nl = len(e1[0])
  def plotShifts():
    nl = len(e1[0])
    sp = SimplePlot()
    sp.setSize(1400,500)
    sl = Sampling(nl,s1f.delta,shiftMin*s1f.delta)
    pv = sp.addPixels(s1f,sl,pow(transpose(e1),1.0))
    pv.setInterpolation(PixelsView.Interpolation.NEAREST)
    pv.setColorModel(ColorMap.JET)
    pv.setPercentiles(2,98)
    pv = sp.addPoints(s1f,mul(s1f.delta,u1))
  plotShifts()
  u1 = dw.smoothShifts(u1)
  plotShifts()
  n1,n2 = len(f[0]),len(f)
  h = zerofloat(n1,n2)
  u = zerofloat(n1,n2)
  for i2 in range(n2):
    copy(u1,u[i2])
    dw.applyShifts(u1,g[i2],h[i2])
  print "warp1: u min =",min(u)," max =",max(u)
  return u,h
示例#6
0
文件: sino2x.py 项目: BKJackson/idh
def warp2(f,g):
  #esmooth,usmooth = 0,0.0
  esmooth,usmooth = 2,8.0
  rsmooth = 101
  strainMax1 = 0.125
  strainMax2 = 0.125
  shiftMax = 10
  shiftMin = -shiftMax
  dw = DynamicWarping(shiftMin,shiftMax)
  dw.setErrorExtrapolation(DynamicWarping.ErrorExtrapolation.REFLECT)
  dw.setStrainMax(strainMax1,strainMax2)
  dw.setShiftSmoothing(usmooth)
  e = dw.computeErrors(f,g)
  for ismooth in range(esmooth):
    dw.smoothErrors(e,e)
  d = dw.accumulateForward1(e)
  u = dw.backtrackReverse1(d,e)
  u = dw.smoothShifts(u)
  h = dw.applyShifts(u,g)
  print "warp2: u min =",min(u)," max =",max(u)
  return u,h
示例#7
0
文件: sino2.py 项目: yongmayer/idh
def warp1(f, g):
    usmooth = 1.0
    strainMax1 = 0.125
    shiftMax = 80
    shiftMin = -shiftMax
    dw = DynamicWarpingX(-shiftMax, shiftMax)
    dw.setStrainMax(strainMax1)
    dw.setShiftSmoothing(usmooth)
    e = dw.computeErrors(f, g)
    nl, n1, n2 = len(e[0][0]), len(e[0]), len(e)
    e1 = zerofloat(nl, n1)
    for i2 in range(n2):
        add(e[i2], e1, e1)
    dw.normalizeErrors(e1)
    d1 = dw.accumulateForward(e1)
    u1 = dw.backtrackReverse(d1, e1)
    u1 = dw.smoothShifts(u1)
    if False:
        sp = SimplePlot()
        sp.setSize(1800, 500)
        sl = Sampling(nl, 1.0, shiftMin)
        s1 = Sampling(n1, 1.0, 0.0)
        pv = sp.addPixels(s1, sl, pow(transpose(e1), 0.25))
        pv.setInterpolation(PixelsView.Interpolation.NEAREST)
        pv.setColorModel(ColorMap.PRISM)
        pv = sp.addPoints(u1)
    h = zerofloat(n1, n2)
    u = zerofloat(n1, n2)
    for i2 in range(n2):
        copy(u1, u[i2])
        dw.applyShifts(u1, g[i2], h[i2])
    print "warp1: u min =", min(u), " max =", max(u)
    return u, h
示例#8
0
文件: sino2.py 项目: yongmayer/idh
def warp2(f, g):
    esmooth = 0
    usmooth = 0.0
    strainMax1 = 0.125
    strainMax2 = 0.125
    shiftMax = 5
    shiftMin = -shiftMax
    dw = DynamicWarpingX(-shiftMax, shiftMax)
    dw.setStrainMax(strainMax1, strainMax2)
    dw.setShiftSmoothing(usmooth)
    e = dw.computeErrors(f, g)
    for ismooth in range(esmooth):
        dw.smoothErrors(e, e)
    d = dw.accumulateForward1(e)
    u = dw.backtrackReverse1(d, e)
    u = dw.smoothShifts(u)
    h = dw.applyShifts(u, g)
    print "warp2: u min =", min(u), " max =", max(u)
    return u, h
示例#9
0
文件: sino2.py 项目: yongmayer/idh
def addShifts(u1, u2):
    dw = DynamicWarpingX(-1, 1)
    return add(u2, dw.applyShifts(u2, u1))