def terminate(self): """ This method should be called when done with anim. """ self.update() fun.cleanMonitors(self.sim) if self.sim.anim: os.system("mencoder 'mf://animtemp//_tmp*.png' -mf type=png:fps=10 -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg") #only works if mencoder is installed and on linux. #remove files: if os.path.exists('animtemp'): shutil.rmtree('animtemp')
def update(self): print self.sim.now(), ",starts plotting procedure" G=self.G fig=self.fig p='undefined' fun.cleanMonitors(self.sim) for ax in [self.ax1,self.ax2,self.ax3,self.ax4]: if ax: ax.clear() #plot terrain self.update_world(self.ax1) #plot monitors: if self.ax2: #assumes that 3&4 are also given, but works anyway self.ax2=self.sim.plotMoni(self.ax2, 1) self.ax3=self.sim.plotMoni(self.ax3, 2) self.ax4=self.sim.plotMoni(self.ax4, 3) #show if self.sim.anim: fig.savefig('animtemp/_tmp%06d.png'%round(self.sim.now())) else: plt.draw() #not really needed, I think? done in run