from PySteppables import * import CompuCell import sys class InfoPrinterSteppable(SteppablePy): def __init__(self,_simulator,_frequency=10): SteppablePy.__init__(self,_frequency) self.simulator=_simulator self.inventory=self.simulator.getPotts().getCellInventory() self.cellList=CellList(self.inventory) self.f = open('workfile', 'w') def start(self): print "This function is called once before simulation" def step(self,mcs): print "This function is called every 10 MCS" for cell in self.cellList: print "CELL ID=",cell.id, " CELL TYPE=",cell.type," volume=",cell.volume self.f.write("CELL ID= %s CELL TYPE= %s volume= %s\n"%(cell.id,cell.type,cell.volume)) def finish(self): self.f.close()