def goDTWR(nf,ng,f0,f,g): nl = ng-nf+1 dr = 0.5 dt = 0.01 dst = dt sf = Sampling(nf,dt,0.0) sg = Sampling(ng,dt,0.0) #guess g0 sl = Sampling(nl,dt,0.0) rmin = -1.0 rmax = 1.0 print 'kmax=',int(ceil(rmax/dr)) print 'kmin=',int(floor(rmin/dr)) dw = DynamicWarpingWT(nl,rmin,rmax,dr) e = dw.computeErrors(f,g) u = dw.findShiftsR(e) h = dw.applyShifts(u,f) u = mul(u,dt) sh = Sampling(len(h),dt,u[0]) plotu(u) plotSequences(g,f,sg,sf) plotSequences(g,h,sg,sh) plotMatrix(etran(e),sf,sl) plotMatrix(etran(e),sf,sl,u=u)