Esempio n. 1
0
    def runTest(self):

        import time
        print '\nINFO: Testing progress bar...'
        for i in range(100):
            plotting.progress_bar(i/100.)
            time.sleep(.01)
        print '\n'
Esempio n. 2
0
 def write_frames(self, nframes):
     if nframes >= 1e6:
         raise Exception("Cannot handle movies with 1 million frames or more.")
     self.frame_directory = tempfile.mkdtemp(prefix='tmp_neurotools_visualization_')
     time_label = self.fig.text(0.01, 0.01, "t = 0 ms", horizontalalignment='left')
     for i in range(int(nframes)):
         for panel,obj in self.panels:
             assert self.frame_duration == obj.frame_duration, "%s != %s" % (self.frame_duration, obj.frame_duration)
             panel.lines = []; panel.images = []
             plot = getattr(panel, obj.plot_function)
             plot(*obj.next_frame(), **obj.kwargs)
             if obj.plot_function == "imshow" and i==0:
                 pos = panel.get_position()
                 try:
                     l,b,w,h = pos # older versions of Matplotlib
                 except TypeError:
                     l,b,w,h = pos.bounds # newer versions return a Bbox object
                 cb_panel = self.fig.add_axes([l+w, b, 0.05*w, h])
                 self.fig.colorbar(panel.images[0], cb_panel)
         time_label.set_text("t = %g ms" % (i*self.frame_duration,))
         self.canvas.print_figure(os.path.join(self.frame_directory, "frame%06d.png" % i))
         progress_bar(float(i)/nframes)