Ejemplo n.º 1
0
def setup(sim):
    dim = (32,32,4)
    size = (5,5,5)
    orig = (-0.5*(dim[0]-1)*size[0],-0.5*(dim[1]-1)*size[1],-0.5*(dim[2]-1)*size[2])
    # Set biophysics, signalling, and regulation models
    sig = GridDiffusion(sim, 2, dim, size, orig, [1e-1,1e-1], [1.0,1.0])
    #integ = ScipyODEIntegrator(sim, 0, 3, max_cells, sig, True)
    integ = CLCrankNicIntegrator(sim, 2, 3, max_cells, sig)
    #integ = CrankNicIntegrator(sim, 2, 3, max_cells, sig)

    biophys = CLBacterium(sim, max_cells=max_cells, max_contacts=32, max_sqs=64**2)
    biophys.addPlane((0,0,-0.5), (0,0,1), 0.75)
    biophys.addPlane((0,0,0.5), (0,0,-1), 1e-2)

    regul = ModuleRegulator(sim, __file__)	# use this file for reg too

    sim.init(biophys, regul, sig, integ)

    sim.addCell(cellType=0, pos=(-20,1,0))
    sim.addCell(cellType=1, pos=(20,0,1))

    # Add some objects to draw the models
    sigrenderer = Renderers.GLGridRenderer(sig, integ)
    therenderer = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(sigrenderer)
    sim.addRenderer(therenderer)
def setup(sim):
    sig = GridDiffusion(sim, 1, grid_dim, grid_size, grid_orig, [10.0])
    #integ = ScipyODEIntegrator(sim, 1, 4, max_cells, sig, True)
    integ = CLCrankNicIntegrator(sim, 1, 5, max_cells, sig, boundcond='reflect')
    biophys = CLBacterium(sim, max_cells=max_cells, max_contacts=32, max_sqs=64*64, jitter_z=True, reg_param=2, gamma=5.0)
    biophys.addPlane((0,0,-0.5), (0,0,1), 1.0)
    biophys.addPlane((0,0,0.5), (0,0,-1), 5e-4)
    reg = ModuleRegulator(sim, __file__)

    sim.init(biophys, reg, sig, integ)

    sigrend = Renderers.GLGridRenderer(sig, integ)
    therend = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(sigrend)
    sim.addRenderer(therend)

    #for i in range(4):
    #    for j in range(4):
    #        sim.addCell(cellType=0, pos=(i*16-32,j*16-32,0))
    #        sim.addCell(cellType=1, pos=(i*16-32-8,j*16-32-8,0))

    sim.addCell(cellType=1, pos=(-20.0,0,0), len=2.0)
    sim.addCell(cellType=0, pos=(20.0,0,0), len=2.0)

    sim.pickleSteps = 10
Ejemplo n.º 3
0
def setup(sim):
    # Set biophysics, signalling, and regulation models
    biophys = CLBacterium(sim, jitter_z=False, 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/4 for i in range(8)]
    for a in angs:
        x = math.cos(a)
        y = math.sin(a)
        p = (50*x,50*y,0)
        n = (-x,-y,0)
        biophys.addPlane(p,n, 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,-10,0), color=(1,0,0)) #x*40,y*40,0))
    sim.addCell(cellType=1, pos=(0,10,0), color=(0,0,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 = 1
Ejemplo n.º 4
0
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])

    # Here we set up the numerical integration:
    # Crank-Nicholson method:
    #integ = CLCrankNicIntegrator(sim, 1, 2, max_cells, sig, boundcond='reflect')
    # Alternative is to use the simple forward Euler method:
    integ = CLEulerSigIntegrator(sim, 1, 2, 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=(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)
        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)
 
    # 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, 1, 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=(0,0,0)) 

    # 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 = 10
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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):
    sig = GridDiffusion(sim, 1, grid_dim, grid_size, grid_orig, [1.0])
    integ = CLCrankNicIntegrator(sim, 1, 5, max_cells, sig)
    biophys = CLBacterium(sim, max_cells=max_cells, max_contacts=32, max_sqs=64**2, jitter_z=False, reg_param=2)
    biophys.addPlane((0,-16,0),(0,1,0),0.2)
    biophys.addPlane((0,16,0),(0,-1,0),0.2)
    reg = ModuleRegulator(sim, __file__)

    sim.init(biophys, reg, sig, integ)

    sigrend = Renderers.GLGridRenderer(sig, integ)
    therend = Renderers.GL2DBacteriumRenderer(sim)
    sim.addRenderer(sigrend)
    sim.addRenderer(therend)

    sim.addCell(pos=(0,0,0), len=2.0)
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."
Ejemplo n.º 10
0
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)
Ejemplo n.º 11
0
def setup(sim):
    # Set biophysics, signalling, and regulation models
    biophys = CLBacterium(sim, jitter_z=True)

    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))
    biophys.addPlane((0,0,0),(0,0,-1),1.0)
    biophys.addPlane((0,0,0),(0,0,1),5e-2)

    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
Ejemplo n.º 12
0
def setup(sim):
    sig = GridDiffusion(sim, 1, grid_dim, grid_size, grid_orig, [10.0], initLevels=[5e-3])
    #integ = ScipyODEIntegrator(sim, 1, 4, max_cells, sig, True)
    integ = CLCrankNicIntegrator(sim, 1, 5, max_cells, sig)
    biophys = CLBacterium(sim, max_cells=max_cells, max_contacts=32, max_sqs=32**2, jitter_z=True, reg_param=2)
    biophys.addPlane((0,0,-0.5), (0,0,1), 0.2)
    biophys.addPlane((0,0,0.5), (0,0,-1), 1e-3)

    reg = ModuleRegulator(sim, __file__)

    sim.init(biophys, reg, sig, integ)

    sigrend = Renderers.GLGridRenderer(sig, integ)
    therend = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(sigrend)
    sim.addRenderer(therend)


    sim.addCell(cellType=0, pos=(0,0,0))
Ejemplo n.º 13
0
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
Ejemplo n.º 14
0
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=100**2,
                          jitter_z=True,
                          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

    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=type,
                len=length,
                rad=radius,
                pos=(0, 0, radius),
                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."
Ejemplo n.º 15
0
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=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
Ejemplo n.º 17
0
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])

    # Here we set up the numerical integration:
    # Crank-Nicholson method:
    #integ = CLCrankNicIntegrator(sim, 1, 2, max_cells, sig, boundcond='reflect')
    # Alternative is to use the simple forward Euler method:
    integ = CLEulerSigIntegrator(sim,
                                 1,
                                 2,
                                 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=(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)
        sigrend = Renderers.GLGridRenderer(sig, integ)  # Add
        sim.addRenderer(sigrend)  #Add

    sim.pickleSteps = 10
Ejemplo n.º 18
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
Ejemplo n.º 19
0
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))

    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
Ejemplo n.º 20
0
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
Ejemplo n.º 21
0
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. 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 0 - NO NUTRIENTS """
    solverParams = None

    # 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."
Ejemplo n.º 23
0
def setup(sim):
    # Set biophysics, signalling, and regulation models
    biophys = CLBacterium(sim, max_cells=max_cells, max_contacts=32, max_sqs=64**2, jitter_z=False, reg_param=2)
    
    regul = ModuleRegulator(sim, __file__)	# use this file for reg too

    sim.init(biophys, regul, None, None)
    
    # load from pickle file
    import pickle
    (cs, lineage) = pickle.load(open('data/biophysCL-01-03-13-04-12/step-02450.pickle','r'))
    print "Loading %i cells..."%len(cs)
    sim.setCellStates(cs)
    biophys.load_from_cellstates(cs)

    #for (i,cell) in sim.cellStates.items():
    #    cell.color = [0.1, 0.1+1000.0*cell.species[3], 
    #    0.1+200.0*cell.species[4]]
#    for (i,cell) in sim.cellStates.items():
#        cell.color = [0.1, cell.species[3]*0.1, cell.species[4]*0.1]

    # Add some objects to draw the models
    therenderer = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(therenderer)
Ejemplo n.º 24
0
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
Ejemplo n.º 25
0
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
Ejemplo n.º 26
0
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
Ejemplo n.º 27
0
def setup(sim):
    # Set biophysics module
    biophys = CLBacterium(sim, jitter_z=False, max_cells=50000,gamma=10.0, 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
Ejemplo n.º 28
0
def setup(sim):
    # Set biophysics, signalling, and regulation models
    biophys = CLBacterium(sim, jitter_z=True, gamma = 20, max_planes=5)

    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)

    # 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.5))

    # Add some objects to draw the models
    therenderer = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(therenderer)
    sim.pickleSteps = 20
Ejemplo n.º 29
0
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
Ejemplo n.º 30
0
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
Ejemplo n.º 31
0
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
Ejemplo n.º 32
0
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, __file__)	# use this file for reg too
    # Only biophys and regulation
    sim.init(biophys, regul, None, None)

    #sim.addCell(cellType=0, pos=(0,0,0))

    #load data from pickle file
    import cPickle
    data = cPickle.load(open('data/BiofilmWallLessCrash_no_alternation_9-12-56-25-09-12/step-00700.pickle','r'))
    cellStates = data[0]
    print "Loading %i cells"%len(cellStates)
    sim.cellStates = cellStates
    regul.cellStates = cellStates
    biophys.load_from_cellstates(cellStates)
    idx_map = {}
    for id,state in sim.cellStates.iteritems():
        idx_map[state.id] = state.idx
    sim.idToIdx = idx_map

#    parents = data[1]
#    for id,state in sim.cellStates.iteritems():
#        p = lineage(parents, [1,2], id)
#        if p == 1: state.color = [0, 1, 0]
#        elif p == 2: state.color = [0, 0, 1]

    #import numpy.random
    #cellcols = numpy.random.uniform(0,1,81*3)
    #cellcols.shape = (81,3)
    #for id,state in sim.cellStates.iteritems():
    #    state.color = list(cellcols[state.cellType,:])

    # Add some objects to draw the models
    therenderer = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(therenderer)
Ejemplo n.º 33
0
def setup(sim):
    # Set biophysics, signalling, and regulation models
    biophys = CLBacterium(sim, jitter_z=True, gamma = 20, max_planes=5)

    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)

    # 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.5))

    # Add some objects to draw the models
    therenderer = Renderers.GLBacteriumRenderer(sim)
    sim.addRenderer(therenderer)
    sim.pickleSteps = 20
Ejemplo n.º 34
0
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
Ejemplo n.º 35
0
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
Ejemplo n.º 36
0
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