def prepareSimulation(self): import CompuCellSetup # CompuCellSetup.setSimulationXMLFileName(self.xmlFileName) (self.sim, self.simthread) = CompuCellSetup.getCoreSimulationObjects() import CompuCell CompuCellSetup.initializeSimulationObjects(self.sim, self.simthread) CompuCellSetup.extraInitSimulationObjects(self.sim, self.simthread) self.simulationInitialized = True self.callingWidget.sim = self.sim
def prepareSimulation(self): import CompuCellSetup # CompuCellSetup.setSimulationXMLFileName(self.xmlFileName) (self.sim, self.simthread) = CompuCellSetup.getCoreSimulationObjects() import CompuCell CompuCellSetup.initializeSimulationObjects(self.sim, self.simthread) CompuCellSetup.extraInitSimulationObjects(self.sim, self.simthread) self.simulationInitialized=True self.callingWidget.sim=self.sim
import sys from os import environ from os import getcwd import string from PySteppablesExamples import SimulationFileStorage sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup sim, simthread = CompuCellSetup.getCoreSimulationObjects() # Create extra player fields here or add attributes CompuCellSetup.initializeSimulationObjects(sim, simthread) # Add Python steppables here steppableRegistry = CompuCellSetup.getSteppableRegistry() from helpfile_steppables_CellDraw import HelpfileCellDrawSteppable theHelpfileCellDrawSteppable = HelpfileCellDrawSteppable(_simulator=sim, _frequency=100) steppableRegistry.registerSteppable(theHelpfileCellDrawSteppable) # sfs=SimulationFileStorage(_simulator=sim,_frequency=10) # sfs.addFileNameToStore("examples_PythonTutorial/cellsort_2D_info_printer/cellsort_2D.xml") # sfs.addFileNameToStore("examples_PythonTutorial/cellsort_2D_info_printer/cellsort_2D_info_printer.py") # sfs.addFileNameToStore("examples_PythonTutorial/cellsort_2D_info_printer/cellsort_2D_steppables_info_printer.py") # steppableRegistry.registerSteppable(sfs)
import sys from os import environ import string python_module_path=os.environ["PYTHON_MODULE_PATH"] appended=sys.path.count(python_module_path) if not appended: sys.path.append(python_module_path) # sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup if not CompuCellSetup.simulationFileName=="": CompuCellSetup.setSimulationXMLFileName(CompuCellSetup.simulationFileName) sim,simthread = CompuCellSetup.getCoreSimulationObjects() import CompuCell #notice importing CompuCell to main script has to be done after call to getCoreSimulationObjects() #Create extra player fields here or add attributes or plugin: #PUT YOUR CODE HERE #PUT YOUR CODE HERE #PUT YOUR CODE HERE import XMLUtils steppableList=CompuCellSetup.cc3dXML2ObjConverter.root.getElements("Plugin") steppableListPy=XMLUtils.CC3DXMLListPy(steppableList) for element in steppableListPy: print "Element",element.name # ," name", element.getNumberOfChildren()
import sys from os import environ from os import getcwd import string sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup sim, simthread = CompuCellSetup.getCoreSimulationObjects() # add extra attributes here pyAttributeDictionaryAdder, dictAdder = CompuCellSetup.attachDictionaryToCells( sim) CompuCellSetup.initializeSimulationObjects(sim, simthread) # Definitions of additional Python-managed fields go here #Add Python steppables here steppableRegistry = CompuCellSetup.getSteppableRegistry() from bistabSwitch2Steppables import EMT_switch1Steppable steppableInstance = EMT_switch1Steppable(sim, _frequency=100) steppableRegistry.registerSteppable(steppableInstance) CompuCellSetup.mainLoop(sim, simthread, steppableRegistry)
try: from xml.parsers.expat import ExpatError import sys from os import environ import string import traceback python_module_path=os.environ["PYTHON_MODULE_PATH"] appended=sys.path.count(python_module_path) if not appended: sys.path.append(python_module_path) # sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup sim,simthread = CompuCellSetup.getCoreSimulationObjects(True) # this only parses xml to extract initial info. No CC3D object is created at this point if CompuCellSetup.simulationPaths.simulationPythonScriptName != "": # fileObj=file(CompuCellSetup.simulationPaths.simulationPythonScriptName,"r") # exec fileObj # fileObj.close() print "INSIDE IF CompuCellPythonSimulationNewPlayer \n\n\n" execfile(CompuCellSetup.simulationPaths.simulationPythonScriptName) print "COMPLETED execfile in CompuCellPythonSimulationNewPlayer \n\n\n" else: print "INSIDE ELSE CompuCellPythonSimulationNewPlayer \n\n\n" sim,simthread = CompuCellSetup.getCoreSimulationObjects() # here , once initial info has been extracted we starrt creating CC3D objects - e.g. Simulator is created in this Fcn call
import sys from os import environ from os import getcwd import string sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup sim,simthread = CompuCellSetup.getCoreSimulationObjects() # add extra attributes here pyAttributeDictionaryAdder,dictAdder=CompuCellSetup.attachDictionaryToCells(sim) CompuCellSetup.initializeSimulationObjects(sim,simthread) # Definitions of additional Python-managed fields go here #Add Python steppables here steppableRegistry=CompuCellSetup.getSteppableRegistry() from bistabSwitch2Steppables import EMT_switch1Steppable steppableInstance=EMT_switch1Steppable(sim,_frequency=100) steppableRegistry.registerSteppable(steppableInstance) CompuCellSetup.mainLoop(sim,simthread,steppableRegistry)
from xml.parsers.expat import ExpatError import sys from os import environ import string import traceback python_module_path = os.environ["PYTHON_MODULE_PATH"] appended = sys.path.count(python_module_path) if not appended: sys.path.append(python_module_path) # sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup sim, simthread = CompuCellSetup.getCoreSimulationObjects( True ) # this only parses xml to extract initial info. No CC3D object is created at this point if CompuCellSetup.simulationPaths.simulationPythonScriptName != "": # fileObj=file(CompuCellSetup.simulationPaths.simulationPythonScriptName,"r") # exec fileObj # fileObj.close() print "INSIDE IF CompuCellPythonSimulationNewPlayer \n\n\n" execfile(CompuCellSetup.simulationPaths.simulationPythonScriptName) print "COMPLETED execfile in CompuCellPythonSimulationNewPlayer \n\n\n" else: print "INSIDE ELSE CompuCellPythonSimulationNewPlayer \n\n\n" sim, simthread = ( CompuCellSetup.getCoreSimulationObjects() ) # here , once initial info has been extracted we starrt creating CC3D objects - e.g. Simulator is created in this Fcn call