Ejemplo n.º 1
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.º 2
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)