Example #1
0
run(duration)

#Plot results

for i in range(N):
    plot(trace.t / second, 1000 * diff_V(trace[i].v, 0), label='V' + str(i))

xlabel('Time (s)')
ylabel('V (mV)')
legend(loc='upper right')
show()
for i in range(N):
    plot((trace.t / second)[4:], trace[i].s[4:], label='s' + str(i))

xlabel('Time (s)')
ylabel('s')
legend(loc='upper right')
show()

sys.exit()
name = "K_5neuron_iconst_" + str(
    time_step / ms) + "_I" + str(Imax) + "_dur" + str(int(duration / second))
head = "t (s) \t I (pA) \t V0 (mV) \t V1 (mV) \t V2 (mV) \t V3 (mV) \t V4 (mV)"
head += " \t s0 \t s1 \t s2 \t s3 \t s4"
save_plot(name, head, trace.t, I_shape, 1000 * diff_V(trace[0].v, 0),
          1000 * diff_V(trace[1].v, 0), 1000 * diff_V(trace[2].v, 0),
          1000 * diff_V(trace[3].v, 0), 1000 * diff_V(trace[4].v, 0),
          trace[0].s, trace[1].s, trace[2].s, trace[3].s, trace[4].s)
print("Written data in: ", name)
S.w[0,1] = '2.5'
S.w[1,1] = '3'
S.w[1,2] = '2.5' #1.5 exponential, 2.5 periodic
S.w[2,2] = '3.0'
S.w[2,0] = '-18.3'

trace = StateMonitor(neurons, 'v', record=[0, 1, 2])


#gap junction connections
GapJ = Synapses(neurons, neurons, gap_jun_eqs)
# GapJ.connect()
# GapJ.g = .02

run(duration)

plot(trace.t/ms, trace[0].v, label = '0')
plot(trace.t/ms, trace[1].v, label = '1')
plot(trace.t/ms, trace[2].v, label = '2')
save_plot("3_neuron_"+"%0.4f"%(abs(duration/ms*mean(S.w))), 
          "t (ms) \t V_as \t V_da \t V_db",
          trace.t/ms,trace[0].v,trace[1].v,trace[2].v)
xlabel('Time (ms)')
ylabel('v')
legend(loc='upper right');
show()

sys.exit()


visualise_connectivity(S)
Example #3
0
    I_recorded = TimedArray((trimmed_rectangle_tail(duration*0.1/ms, I, duration)), dt=defaultclock.dt)
    restore()
    run(duration)
    trazas_V.append(trace.v[0])
    trazas_I.append(trace.I_i[0])
    
    subplot(211)
    plot(trace.t/ms, trace.v[0], label = 'v_'+str(I))
    
    subplot(212)
    plot(trace.t/ms, trace.I_i[0], label = 'I_'+str(I))

t_recorded = arange(int(duration/defaultclock.dt))*defaultclock.dt
xlabel('Time (ms)')
ylabel('i')
#legend(loc='upper right');
show()
sys.exit()


#plot(t_recorded, trace.v[0], label = 'v0')

save_plot("AVA_rectangle_"+str(duration),"t (ms) \t V_i \t I_i",t_recorded/ms,
          trazas_V[0],trazas_I[0],trazas_V[1],trazas_I[1],trazas_V[2],trazas_I[2],
          trazas_V[3],trazas_I[3],trazas_V[4],trazas_I[4],trazas_V[5],trazas_I[5],
          trazas_V[6],trazas_I[6],trazas_V[7],trazas_I[7],trazas_V[8],trazas_I[8],
          trazas_V[9],trazas_I[9])


sys.exit()
neurons.active_ = 0
neurons.active_[0] = 1
neurons.tau_i = 0.05 * second
neurons.bias_i = -3.4

trace = StateMonitor(neurons, variables=True, record=0)

#chemical synapses
S = Synapses(neurons, neurons, model=syn_eqs)
S.connect(i=[0], j=[0])
S.w[0, 0] = '8.1'

#gap junction connections
#GapJ = Synapses(neurons, neurons, gap_jun_eqs)
# GapJ.connect()
# GapJ.g = .02

run(duration)

plot(trace.t / ms, trace.v[0], label='v0')
plot(trace.t / ms, trace.I_i[0], label='I')

xlabel('Time (ms)')
ylabel('v')
legend(loc='upper right')
show()

sys.exit()

save_plot("RMD_triangle_" + "i" + str(Imax) + "_" + str(duration),
          "t (ms) \t V \t I", trace.t / ms, trace.v[0], trace.I_i[0])