From 16d12ef1513fa9b4aee8601ffcc34b956b8c682b Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Wed, 10 Mar 2010 10:37:14 +0100 Subject: [PATCH] Prove sulla refinement equation. --- RefinementEquation/Iteration.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/RefinementEquation/Iteration.py b/RefinementEquation/Iteration.py index cc1c69d..c49c756 100755 --- a/RefinementEquation/Iteration.py +++ b/RefinementEquation/Iteration.py @@ -8,13 +8,14 @@ print " => Carico le librerie necessarie...", from pylab import * -import time, numpy +import time, numpy, Filtering print "ok" # Si comincia ad iterare h = numpy.array([0.125 , 0.25, 0.25, 0.25, 0.125]) - -t = numpy.linspace(-10,10,100) +h = Filtering.DaubechiesFilterBank.lowPassFilter.GetResponse() +h = Filtering.StrangFilterBank.lowPassFilter.GetResponse() +t = numpy.linspace(-0.05,len(h) + 0.05,1000) def box(x): """box function""" @@ -34,7 +35,7 @@ def refinement(x): for value in h: newphi += value * phi_func(2*x - counter) counter += 1 - return 2 * newphi + return max(min(2 * newphi, 10), -10) def phi_func(x): @@ -44,15 +45,27 @@ def phi_func(x): return phi[t.tolist().index(item)] ion () -for i in xrange(0,5): - plot(t,phi) - draw () - - time.sleep (1) - phi = map(refinement, t) +hold(False) +diff = 1 +try: + while True: + # plot(t,phi) + # draw () + print "diff = %f" % diff + # time.sleep (0.25) + newphi = map(refinement, t) + diff = numpy.linalg.norm(numpy.array(newphi) - numpy.array(phi)) + phi = newphi +except KeyboardInterrupt: + plot(t,phi) + draw() + raw_input() -raw_input () + f = open("phi.txt", "w") + for value in phi: + f.write("%s\n" % value) + f.close () -- 2.1.4