当前位置: 首页>>代码示例>>Python>>正文


Python Simulation.set_internal_model方法代码示例

本文整理汇总了Python中Simulation.set_internal_model方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.set_internal_model方法的具体用法?Python Simulation.set_internal_model怎么用?Python Simulation.set_internal_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Simulation的用法示例。


在下文中一共展示了Simulation.set_internal_model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Simulation

# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import set_internal_model [as 别名]
# 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
sim.add_interaction('h','h','diffusion',diff_connections,params=[Dh/Th])
sim.add_interaction('u','u','diffusion',diff_connections,params=[Du/Tu])

# spi diffusion
sim.add_interaction('sp','sp','diffusion',diff_connections,params=[5.0/Tsp])
开发者ID:gyftdresaw,项目名称:simulation_framework,代码行数:32,代码来源:ysp_sm_1d.py

示例2: InternalModel

# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import set_internal_model [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()
开发者ID:gyftdresaw,项目名称:simulation_framework,代码行数:28,代码来源:bistability.py

示例3: InternalModel

# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import set_internal_model [as 别名]
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})

t = np.linspace(0,10,100)
cdata = sim.simulate(t)
开发者ID:gyftdresaw,项目名称:simulation_framework,代码行数:32,代码来源:diffusion_test.py

示例4: Simulation

# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import set_internal_model [as 别名]
# can add noise to centers
# centers += np.random.normal(0.0,0.15,(NCells,2))        

# place each cell at these vertices
cells = [Cell(c) for c in centers]

# add these cells to the simulation
sim = Simulation()
for i in xrange(NCells):
    sim.add_cell(cells[i])

im_source_id = sim.add_internal_model(IM_source)
im_id = sim.add_internal_model(IM)

# set all first row cells to have source internal model
sim.set_internal_model(range(ncolumns),im_source_id) # modified
# set all cells but first row to have the same internal model
sim.set_internal_model(range(ncolumns,NCells),im_id) # modified to source also

##########################################################################
# ORDERING BETWEEN ADDING AND SETTING INTERNAL MODELS MUST BE CONSISTENT #
# THIS NEEDS TO BE FIXED                                                 #
##########################################################################

# set up reflecting boundary conditions at bottom edge
# sim.set_boundary_conditions(range(ncolumns),'ref_on')
sim.set_boundary_conditions(range((nrows-1)*ncolumns,nrows*ncolumns),'abs_on')

# need to figure out which cells are connect to which
connections = lattice.get_connections(nrows,ncolumns,periodic=True)
# for sourcing h, we're going to eliminate diffusion out of the first row
开发者ID:gyftdresaw,项目名称:simulation_framework,代码行数:33,代码来源:l2d_const.py


注:本文中的Simulation.set_internal_model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。