viewgit/index.php:465 Only variables should be passed by reference [2048]

viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #
  5. # Consideriamo \phi_{0}(x) = box function
  6. # e iteriamo per cercare di ottenere la funzione
  7. # associata ad un filtro.
  8.  
  9. print " => Carico le librerie necessarie...",
  10. from pylab import *
  11. import time, numpy, Filtering
  12. print "ok"
  13.  
  14. # Si comincia ad iterare
  15. h = numpy.array([0.125 , 0.25, 0.25, 0.25, 0.125])
  16. h = Filtering.DaubechiesFilterBank.lowPassFilter.GetResponse()
  17. h = Filtering.StrangFilterBank.lowPassFilter.GetResponse()
  18. # h = Filtering.StrangFilterBank.lowPassFilter.GetResponse()
  19. t = numpy.linspace(-0.5,len(h) + 0.05,100)
  20.  
  21. def box(x):
  22. """box function"""
  23. if(x >= 0 and x<=1):
  24. return 1
  25. return 0
  26.  
  27.  
  28. phi = map(box, t)
  29.  
  30.  
  31. def refinement(x):
  32. """Refinement function"""
  33. i = t.tolist().index(x)
  34. newphi = 0
  35. counter = 0
  36. for value in h:
  37. newphi += value * phi_func(2*x - counter)
  38. counter += 1
  39. return max(min(2 * newphi, 10), -10)
  40.  
  41. def phi_func(x):
  42.  
  43. for item in t:
  44. if item > x:
  45. break
  46. return phi[t.tolist().index(item)]
  47.  
  48. ion ()
  49. hold(False)
  50. diff = 1
  51. try:
  52. while True:
  53. plot(t,phi)
  54. draw ()
  55. print "diff = %f" % diff
  56. time.sleep (1)
  57. newphi = map(refinement, t)
  58. diff = numpy.linalg.norm(numpy.array(newphi) - numpy.array(phi))
  59. phi = newphi
  60. except KeyboardInterrupt:
  61.  
  62. plot(t,phi)
  63. draw()
  64. raw_input()
  65.  
  66. f = open("phi.txt", "w")
  67. for value in phi:
  68. f.write("%s\n" % value)
  69. f.close ()
  70.  
  71.  
  72.