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. t = numpy.linspace(-0.05,len(h) + 0.05,1000)
  19.  
  20. def box(x):
  21. """box function"""
  22. if(x >= 0 and x<=1):
  23. return 1
  24. return 0
  25.  
  26.  
  27. phi = map(box, t)
  28.  
  29.  
  30. def refinement(x):
  31. """Refinement function"""
  32. i = t.tolist().index(x)
  33. newphi = 0
  34. counter = 0
  35. for value in h:
  36. newphi += value * phi_func(2*x - counter)
  37. counter += 1
  38. return max(min(2 * newphi, 10), -10)
  39.  
  40. def phi_func(x):
  41.  
  42. for item in t:
  43. if item > x:
  44. break
  45. return phi[t.tolist().index(item)]
  46.  
  47. ion ()
  48. hold(False)
  49. diff = 1
  50. try:
  51. while True:
  52. # plot(t,phi)
  53. # draw ()
  54. print "diff = %f" % diff
  55. # time.sleep (0.25)
  56. newphi = map(refinement, t)
  57. diff = numpy.linalg.norm(numpy.array(newphi) - numpy.array(phi))
  58. phi = newphi
  59. except KeyboardInterrupt:
  60.  
  61. plot(t,phi)
  62. draw()
  63. raw_input()
  64.  
  65. f = open("phi.txt", "w")
  66. for value in phi:
  67. f.write("%s\n" % value)
  68. f.close ()
  69.  
  70.  
  71.