本文整理汇总了Python中Simulation.add_cell方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.add_cell方法的具体用法?Python Simulation.add_cell怎么用?Python Simulation.add_cell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulation
的用法示例。
在下文中一共展示了Simulation.add_cell方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InternalModel
# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import add_cell [as 别名]
# diffusion testing
IM = InternalModel()
IM.add_node('a') # no degradation
IM2 = InternalModel()
IM2.add_node('a','linear',params=[0.5])
IM2.add_node('b','linear',params=[1])
eid = IM2.add_edge('b','b','hill_activ',params=[1,1,2])
IM2.add_edge('a',eid,'lin_activ',is_mod=True,mod_type='mult',params=[5])
cell1 = Cell([0])
cell2 = Cell([1])
cell3 = Cell([3])
sim = Simulation()
sim.add_cell(cell1)
sim.add_cell(cell2)
sim.add_cell(cell3)
im_id = sim.add_internal_model(IM)
im_id2 = sim.add_internal_model(IM2)
connections = np.array([[True,True,False],[True,True,True],[False,True,True]])
sim.set_internal_model([0,1],im_id)
sim.set_internal_model([2],im_id2)
sim.add_interaction('a','a','diffusion',connections,params=[1])
sim.set_initial_conditions([0],{'a':0})
sim.set_initial_conditions([1],{'a':6})
sim.set_initial_conditions([2],{'a':0,'b':1})
示例2: Simulation
# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import add_cell [as 别名]
# mystery species m things
# u -> m
IM.add_edge('u','m','hill_activ',params=[1.0/Tm,4e-6,6])
# m -| yan
IM.add_edge('m',uy_edge,'hill_inactiv',is_mod=True,mod_type='mult',params=[1.0,1.0,0.7,3])
# need to make some cells
# the 1d case is easy:
# in our 'lattice', all the cells are distance 1 apart
NCells = 60
cells = [Cell([x]) for x in np.linspace(1,NCells,NCells)]
# add these cells to the simulation
sim = Simulation()
for i in xrange(NCells):
sim.add_cell(cells[i])
im_id = sim.add_internal_model(IM)
# set all cells to have the same internal model
sim.set_internal_model(range(NCells),im_id)
# set boundary conditions before setting intercellular interactions
sim.set_boundary_conditions([0],'ref_on')
# cells adjacent to one another are connected
# for diffusion we include main diagonal
# equivalent to 3 wide diagonal
diff_connections = (np.eye(NCells,k=-1) + np.eye(NCells,k=0) + np.eye(NCells,k=1)) > 0
# add diffusion to h and u
示例3: InternalModel
# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import add_cell [as 别名]
from Simulation import *
import matplotlib.pyplot as plt
# exclusive bistability test:
# two nodes inhibiting one another
IM = InternalModel()
IM.add_node('a','linear',[0.2])
IM.add_node('b','linear',[0.2])
IM.add_edge('a','b','hill_inactiv',params=[2.0,2.0,2.0,2])
IM.add_edge('b','a','hill_inactiv',params=[2.0,2.0,2.0,2])
cell = Cell()
sim = Simulation()
sim.add_cell(cell)
im_id = sim.add_internal_model(IM)
sim.set_internal_model([0],im_id)
sim.set_initial_conditions([0],{'a':5.0,'b':4.0})
t = np.linspace(0,100,1000)
cdata = sim.simulate(t)
plt.plot(t,cdata[0])
plt.legend(['a','b'])
plt.show()