Пример #1
0
def test_wire (size_exponent = 10, factor_exponent = 2):
  import time

  print "declaring transforms"
  s = Supergram(size_exponent, factor_exponent)
  a = Audio(s.small_size)
  w = Wire()
  #v = Screen(s.super_size)

  print "declaring channels"
  c1 = Complexes()
  c2 = Reals()
  c3 = Reals()
  c4 = Complexes()

  print "connecting transforms via channels"
  a.reading(c1)
  s.stream_fwd(c1,c2)
  w.stream(c2,c3)
  #v.vertical_sweeping(c2)
  s.stream_bwd(c3,c4)
  a.writing(c4)

  print "validating"
  validate()

  duration = 3
  print "streaming for %g seconds..." % duration
  a.start()
  time.sleep(duration)
  a.stop()
  print "...done"

  stop_threads()
Пример #2
0
 def run_until_input (self):
   try:
     self.start()
     print "press ENTER to stop"
     raw_input()
     self.stop()
   finally:
     stop_threads()
Пример #3
0
 def thread_loop ():
   network.DEBUG("starting Supergram thread")
   try:
     while network.threads_alive():
       s.wait(False)
       if network.threads_alive():
         network.DEBUG("running Supergram")
         t.transform_fwd(self.__history[d], x)
       s.toggle()
   except Exception, e:
     network.stop_threads()
     raise e