本文整理汇总了Python中Simulation.add_internal_model方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.add_internal_model方法的具体用法?Python Simulation.add_internal_model怎么用?Python Simulation.add_internal_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulation
的用法示例。
在下文中一共展示了Simulation.add_internal_model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Simulation
# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import add_internal_model [as 别名]
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
sim.add_interaction('h','h','diffusion',diff_connections,params=[Dh/Th])
sim.add_interaction('u','u','diffusion',diff_connections,params=[Du/Tu])
示例2: Simulation
# 需要导入模块: import Simulation [as 别名]
# 或者: from Simulation import add_internal_model [as 别名]
# 'center' of each cell on hexagonal lattice
centers = lattice.get_centers(nrows,ncolumns)
# 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')