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])
# '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')