Exemple #1
0
def CMP2D(L,v,d,seed, tot_time, pace_rate, refractory_period):   
    # creates the array
    Neighbours_up, Neighbours_down, Neighbours_right, Neighbours_left, Phases, Functionality, Atrium, index  = CA.CreateAtrium(L,v,d,seed,refractory_period)
    t = 0
    while t < tot_time:
        # runs the time step change
        CMP2d_1step(seed, tot_time, pace_rate, refractory_period,t,Neighbours_up, Neighbours_down, Neighbours_right, Neighbours_left, Phases, Functionality, Atrium, index)
        t += 1
Exemple #2
0
def CMP2D(L, v, d, seed, tot_time, pace_rate, refractory_period):
    Neighbours_up, Neighbours_down, Neighbours_right, Neighbours_left, Phases, Functionality, Atrium, index = CA.CreateAtrium(
        L, v, d, seed, refractory_period)
    t = 0
    #print(Phases)
    while t < tot_time:
        #print(t)
        TempPhases1 = Phases.copy()
        #print(TempPhases1)
        if t in np.arange(0, tot_time, pace_rate):
            SinusRhythm(TempPhases1, Phases, e, Functionality)
        if np.all(TempPhases1) == False:
            Excite(TempPhases1, Phases, Neighbours_up, Neighbours_down,
                   Neighbours_right, Neighbours_left, Functionality, e,
                   refractory_period)
        Relaxing(TempPhases1, Phases, refractory_period)

        #print(Phases.reshape([L,L]))
        t += 1
    return Phases
Exemple #3
0
            for j in range(len(cells_x))
        ])
    return potential


""" 
pr = cProfile.Profile()
pr.enable()
CMP2D(L,v,d,seed1, tot_time, pace_rate, refractory_period)
print('Atrium')
pr.disable()
sortby = 'cumulative'
ps = pstats.Stats(pr).sort_stats(sortby)
ps.print_stats()
"""
Neighbours_up, Neighbours_down, Neighbours_right, Neighbours_left, Phases, Functionality, Atrium, index = CA.CreateAtrium(
    L, v, d, seed2, refractory_period)
#print(Neighbours_up.reshape(L,L))
voltages = []
times = []
fig = plt.figure(figsize=[10, 10])
ax = plt.subplot()
ax.set_axis_off()
mat = ax.matshow(Phases.reshape([L, L]), cmap=plt.cm.gray_r)
mat.set_clim(0, refractory_period)
#plt.colorbar(mat)
ani = animation.FuncAnimation(fig,
                              update,
                              frames=tot_time,
                              fargs=(mat, seed2, pace_rate, refractory_period,
                                     Neighbours_up, Neighbours_down,
                                     Neighbours_right, Neighbours_left, Phases,