def setup(sim): # Set biophysics, signalling, and regulation models #max_sqr #biophys = CLBacterium(sim, max_cells=max_cells, jitter_z=False, max_sqs=256**2) biophys = CLBacterium(sim, max_cells=max_cells, jitter_z=False, max_spheres=1, gamma=100.) # use this file for reg too regul = ModuleRegulator(sim) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(0, 0, 0)) biophys.addSphere((0, 0, 0), 10, 1.0, -1) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 5
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, \ max_cells=max_cells, \ max_contacts=32, \ max_sqs=128**2, \ jitter_z=False, \ reg_param=2, \ gamma=10) biophys.addPlane((0, 0, -0.5), (0, 0, 1), 0.2) biophys.addPlane((0, 0, 0.5), (0, 0, -1), 1e-4) regul = ModuleRegulator(sim, sim.moduleName) # use this file for reg too # Only biophys and regulation sim.init(biophys, regul, None, None) #load data from pickle file dataFileName = '' # Edit to include your filename here # Or pop up a dialog to choose a pickle if dataFileName == '': print "Please edit the model file to specify a pickle file." print " -- No data was loaded and there are no cells in this simulation!" else: # Import the data and load into Simulator print "Loading data from pickle file: %s" % (dataFileName) import cPickle data = cPickle.load(open(dataFileName, 'r')) sim.loadFromPickle(data) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer)
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=True, gamma=20, max_planes=5, max_cells=500000) biophys.addPlane((0, 0, 0), (0, 0, 1), 1.0) #base plane biophys.addPlane((gridsize / 2, 0, 0), (-1, 0, 0), 1.0) biophys.addPlane((-gridsize / 2, 0, 0), (1, 0, 0), 1.0) biophys.addPlane((0, gridsize / 2, 0), (0, -1, 0), 1.0) biophys.addPlane((0, -gridsize / 2, 0), (0, 1, 0), 1.0) # use this file for reg too regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addPillars(dist, gridsize, rad) sim.addLawn(gridsize, cell_lens, 1.1) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 20
def setup(sim): biophys = CLBacterium(sim, max_cells=max_cells, jitter_z=False, compNeighbours=True) regul = ModuleRegulator(sim, __file__) sim.init(biophys, regul, None, None) heap.clean() # randomly in a circle for i in xrange(type_0_cells): r = random.uniform(0.0, math.pi) x, y = circleRandPoint(0, 0, 200) sim.addCell(cellType=0, length=random.uniform(2, 5.8), pos=(x, y, 0.5), dir=(math.sin(r), math.cos(r), 0)) for i in xrange(type_3_cells): r = random.uniform(0.0, math.pi) x, y = circleRandPoint(0, 0, 200) sim.addCell(cellType=3, length=random.uniform(2, 5.8), pos=(x, y, 0.5), dir=(math.sin(r), math.cos(r), 0)) heap.addElement(dt, "step") if sim.is_gui: therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) else: print "Running in batch mode: no display will be output" sim.savePickle = True sim.pickleSteps = 100
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=True, gamma=10, max_planes=6) biophys.addPlane((0, 0, 0), (0, 0, 1), 1.0) #Base plane biophys.addPlane((10, 0, 0), (-1, 0, 0), 1.0) biophys.addPlane((-10, 0, 0), (1, 0, 0), 1.0) biophys.addPlane((0, 10, 0), (0, -1, 0), 1.0) biophys.addPlane((0, -10, 0), (0, 1, 0), 1.0) biophys.addPlane((0, 0, 10), (0, 0, -1), 1.0) # use this file for reg too regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(-5, -1, 0.5), dir=(-1, 0, 0), rad=0.4) sim.addCell(cellType=0, pos=(6, 8, 0.5), dir=(-0.5, 0.2, 0), rad=0.4) sim.addCell(cellType=0, pos=(-1, -7, 1), dir=(0, 0, 0), rad=0.4) #sim.addCell(cellType=0, pos=(1,11,0.5), dir=(1,0.4,0), rad=0.4) #sim.addCell(cellType=0, pos=(-1,7,0.5), dir=(1,1,0), rad=0.4) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False) # add the planes to set physical boundaries of cell growth biophys.addPlane((0,-16,0), (0,1,0), 1) biophys.addPlane((0,16,0), (0,-1,0), 1) sig = GridDiffusion(sim, 1, grid_dim, grid_size, grid_orig, [10.0]) integ = CLCrankNicIntegrator(sim, 1, 3, max_cells, sig, boundcond='reflect') # use this file for reg too regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, sig, integ) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(-10.0,0,0)) #Add sim.addCell(cellType=1, pos=(10.0,0,0)) #Add if sim.is_gui: # Add some objects to draw the models from CellModeller.GUI import Renderers therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sigrend = Renderers.GLGridRenderer(sig, integ) # Add sim.addRenderer(sigrend) #Add sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models # biophys = CLBacterium(sim, jitter_z=False, periodic=True, N_x = 10, N_y = 10, max_cells = 2**13, max_contacts = 16) # add some planes to coral cells planeWeight = 1.0 #biophys.addPlane((0,0,0), (+1,0,0), planeWeight) # left side #biophys.addPlane((0,0,0), (0,+1,0), planeWeight) # front side #biophys.addPlane((15.0, 0, 0), (-1,0,0), planeWeight) # right side #biophys.addPlane((0, 15.0, 0), (0,-1,0), planeWeight) # rear side #biophys.addPlane((0,0,0), (0,0,+1), planeWeight) # base # use this file for reg too regul = ModuleRegulator(sim) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(15, 25, 0)) sim.addCell(cellType=1, pos=(35, 25, 0)) if sim.is_gui: # Add some objects to draw the models from CellModeller.GUI import Renderers therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics module biophys = CLBacterium(sim, jitter_z=False, max_cells=50000, gamma=10.0, reg_param=0.1, cgs_tol=1E-5, compNeighbours=True) # Set up regulation module regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(-5, 0, 0), dir=(1, 0, 0), length=delta, rad=0.4) #acceptor sim.addCell(cellType=1, pos=(5, 0, 0), dir=(1, 0, 0), length=delta, rad=0.4) #donor # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) # Specify how often data is saved sim.pickleSteps = 50
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, max_planes=9) sim.dt = 0.025 #biophys.addPlane((0,0,-0.5), (0,0,1), 1.0) #biophys.addPlane((0,0,0.5), (0,0,-1), math.sqrt(7.5e-4)) ''' angs = [i*math.pi/8 for i in range(8)] for a in angs: x = math.cos(a) y = math.sin(a) p = (30*x,30*y,0) n = (-x,-y,0) biophys.addPlane(p,n, 1.0) ''' biophys.addPlane((0,0,0),(0,0,-1),1.0) regul = ModuleRegulator(sim) # use this file for reg too # Only biophys and regulation sim.init(biophys, regul, None, None) #ct = 0 #for x in range(-4,5): # for y in range(-4,5): sim.addCell(cellType=0, pos=(0,0,-5), color=(1,1,1)) #x*40,y*40,0)) # ct += 1 #sim.addCell(cellType=1, pos=(20,0,0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models. Add dolfin solver if used. biophys = CLBacterium(sim, max_substeps=8, max_cells=max_cells, max_contacts=32, max_sqs=Num_x * Num_y, jitter_z=False, reg_param=0.04, gamma=500, periodic=False, grid_spacing=meshParam, L_x=Len_x, L_y=Len_y) # add mechanical planes planeWeight = 1.0 biophys.addPlane((0, 0, 0), (0, 1, 0), planeWeight) # base of box # what happens if we add some sides? biophys.addPlane((0, 0, 0), (+1, 0, 0), planeWeight) # left side biophys.addPlane((Len_x, 0, 0), (-1, 0, 0), planeWeight) # right side regul = ModuleRegulator(sim, __file__) # use this file for reg too # compile a list of solver parameters (using scaled values) """ CASE 1 - HIGH NUTRIENTS """ solverParams = dict(h=0.5 * meshParam, origin=[0.0, 0.0, 0.0], N_x=2 * Num_x, L_x=Len_x, u0=1.0, K=0.0033, mu_eff=0.001, pickleSteps=10, rel_tol=1e-6, mesh_type='crossed', delta=40.0) # add biophysics, regulation, [solver], objects to simulator sim.init(biophys, regul, None, None, solverParams) # randomly initialise a line of cells along the bottom RandomSeedOnLine(sim, Len_x, num_initial_cells, initialVola, initialVola, radius) # Add some objects to draw the models mainRenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(mainRenderer) # How often should we output data? sim.renderEveryNSteps = 1 #sim.savePickle = True sim.pickleSteps = saveEvery print "Ready."
def setup(sim): biophys = CLBacterium(sim, jitter_z=False) reg = ModuleRegulator(sim, sim.moduleName) sim.init(biophys, reg, None, None) therend = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therend) sim.addCell(cellType=0, pos=(0, 0, 0), len=2.0)
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False, max_cells=30000,max_sqs=192**2) regul = ModuleRegulator(sim, sim.moduleName) # use this file for reg too # Only biophys and regulation sim.init(biophys, regul, None, None) sim.addCell(cellType=0, pos=(0,0,0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models. Add dolfin solver if used. biophys = CLBacterium(sim, max_substeps=8, max_cells=max_cells, max_contacts=32, max_sqs=50**2, jitter_z=False, reg_param=0.04, gamma=500, periodic=False, grid_spacing=10.0) # add mechanical planes planeWeight = 1.0 biophys.addPlane((0, 0, 0), (0, 1, 0), planeWeight) # base of box #biophys.addPlane((0,0,-radiusD/2.0), (0,0,+1), planeWeight) # front of box #biophys.addPlane((0,0,+radiusD/2.0), (0,0,-1), planeWeight) # back of box regul = ModuleRegulator(sim, __file__) # use this file for reg too # compile a list of solver parameters (using scaled values) solverParams = None # add biophysics, regulation, [solver], objects to simulator sim.init(biophys, regul, None, None, solverParams) # initialise 2 cells with different lengths, radii sim.addCell(cellType=0, len=lengthD, rad=radiusD, pos=(+init_sep / 2.0, radiusD, 0), dir=(1, 0, 0)) sim.addCell(cellType=1, len=lengthD, rad=radiusD, pos=(-init_sep / 2.0, radiusD, 0), dir=(1, 0, 0)) # Add some objects to draw the models mainRenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(mainRenderer) # How often should we output data? sim.renderEveryNSteps = 1 sim.savePickle = True sim.pickleSteps = saveEvery print "Ready."
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False) regul = ModuleRegulator(sim) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(0, 0, 0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False) regul = ModuleRegulator(sim, sim.moduleName) # use this file for reg too # Only biophys and regulation sim.init(biophys, regul, None, None) sim.addCell(cellType=0, pos=(0, 0, 0)) if sim.is_gui: # Add some objects to draw the models from CellModeller.GUI import Renderers therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics module biophys = CLBacterium(sim, jitter_z=False) # Set up regulation module regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(0, 0, 0), dir=(1, 0, 0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) # Specify how often data is saved sim.pickleSteps = 100
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, max_cells=max_cells, jitter_z=False) integ = CLEulerIntegrator(sim, 2, max_cells) # use this file for reg too regul = ModuleRegulator(sim) # Only biophys and regulation sim.init(biophys, regul, None, integ) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(0, 0, 0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 20
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False) integ = CLEulerIntegrator(sim, 2, max_cells) regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, integ) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(0, 0, 0)) if sim.is_gui: # Add some objects to draw the models from CellModeller.GUI import Renderers therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False) # use this file for reg too regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(0,0,0), dir=(1,0,0)) # Add some objects to draw the models if sim.is_gui: therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) else: print "Running in batch mode: no display will be output" sim.pickleSteps = 10 sim.saveOutput = True
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False, periodic=True, N_x=1, N_y=1, grid_spacing=15.0, max_cells=8, max_contacts=8) # add some planes to make the system 1-D planeWeight = 1.0 biophys.addPlane((0, 7.0, 0), (0, +1, 0), planeWeight) # bottom channel boundary biophys.addPlane((0, 8.0, 0), (0, -1, 0), planeWeight) # top channel boundary # temporarily add some planes to stop cells leaving the domain biophys.addPlane((0, 0, 0), (+1, 0, 0), planeWeight) # left channel boundary biophys.addPlane((15.0, 0, 0), (-1, 0, 0), planeWeight) # right channel boundary # use this file for reg too regul = ModuleRegulator(sim) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(5, 7.5, 0)) sim.addCell(cellType=1, pos=(10, 7.5, 0)) if sim.is_gui: # Add some objects to draw the models from CellModeller.GUI import Renderers therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False) sig = GridDiffusion(sim, n_signals, grid_dim, grid_size, grid_orig, [1.0, 1.0]) integ = CLCrankNicIntegrator(sim, n_signals, n_species, max_cells, sig) # use this file for reg too regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, sig, integ) # Specify the initial cell and its location in the simulation sim.addCell(cellType=0, pos=(-3.0,0,0)) #Add sim.addCell(cellType=1, pos=(3.0,0,0)) #Add # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sigrend = Renderers.GLGridRenderer(sig, integ) # Add sim.addRenderer(sigrend) #Add sim.pickleSteps = 20
def setup(sim): biophys = CLBacterium(sim, jitter_z=False, gamma=10, max_planes=3) #gamme is how the external pressure makes them stop growing (high means they keep growing) # Set certin planes that limit the simulation biophys.addPlane( (0, 0, 0), (0, 1, 0), 1.0) biophys.addPlane( (-8, 0, 0), (1, 0, 0), 1.0) biophys.addPlane( (8, 0, 0), (-1, 0, 0), 1.0) # use this file for reg too regul = ModuleRegulator(sim, sim.moduleName) # Only biophys and regulation sim.init(biophys, regul, None, None) # Specify the initial cell and its location in the simulation sim.addCell(cellType=int(random.getrandbits(1)), pos=(-7.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-6.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-5.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-4.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-3.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-2.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-1.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(-0.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(0.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(1.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(2.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(3.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(4.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(5.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(6.5,2,0), dir=(0,1,0)) sim.addCell(cellType=int(random.getrandbits(1)), pos=(7.5,2,0), dir=(0,1,0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 20
def setup(sim): sig = GridDiffusion(sim, 1, grid_dim, grid_size, grid_orig, [10.0]) integ = CLCrankNicIntegrator(sim, 1, 5, max_cells, sig, boundcond='reflect') biophys = CLBacterium(sim, max_cells=max_cells, jitter_z=False) biophys.addPlane((0, -16, 0), (0, 1, 0), 1) biophys.addPlane((0, 16, 0), (0, -1, 0), 1) reg = ModuleRegulator(sim) sim.init(biophys, reg, sig, integ) sim.addCell(cellType=1, pos=(-20.0, 0, 0), len=2.0) sim.addCell(cellType=0, pos=(20.0, 0, 0), len=2.0) sigrend = Renderers.GLGridRenderer(sig, integ) therend = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(sigrend) sim.addRenderer(therend) sim.pickleSteps = 10
def setup(sim): # Set biophysics, signalling, and regulation models biophys = CLBacterium(sim, jitter_z=False, gamma=100, max_cells=100000, max_planes=1) regul = ModuleRegulator(sim, sim.moduleName) # use this file for reg too # Only biophys and regulation sim.init(biophys, regul, None, None) #biophys.addPlane((0,0,0),(0,0,1),1.0) #Base plane #biophys.addPlane((10,0,0),(-1,0,0),1.0) #biophys.addPlane((-10,0,0),(1,0,0),1.0) #biophys.addPlane((0,10,0),(0,-1,0),1.0) #biophys.addPlane((0,-10,0),(0,1,0),1.0) sim.addCell(cellType=0, pos=(0, 0, 0)) # Add some objects to draw the models therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) sim.pickleSteps = 1
def setup(sim): """ This function is called when the simulation is initiated. It specifies which modules are to be used in the simulation, how cells are initially placed, and when to generate output. """ global TimeStep # Use biophys, regulation and T6SS modules biophys = CLBacterium(sim, jitter_z=False, max_cells=max_population) regul = ModuleRegulator(sim) sim.init(biophys, regul, None, None, CDKParams) # Specify initial cell locations in the simulation sim.addCell(cellType=0, pos=(-10, 0, 0)) sim.addCell(cellType=1, pos=(10, 0, 0)) # Add some objects to render the cells in the GUI therenderer = Renderers.GLBacteriumRenderer(sim) sim.addRenderer(therenderer) TimeStep = sim.dt # print output (pickle) files every 10 timesteps sim.pickleSteps = 10