def Plot(monitor, number): #pudb.set_trace() br.plot(211) if type(monitor) == list or type(monitor) == tuple: br.plot(monitor[0].t/br.ms,monitor[0].v[0]/br.mV, label='v') #br.plot(monitor[1].t/br.ms,monitor[1].u[0]/br.mV, label='u') #br.plot(monitor[2].t/br.ms,monitor[0].ge[0]/br.mV, label='v') else: br.plot(monitor.t/br.ms,monitor.v[0]/br.mV, label='v') #br.plot(monitor[0].t/br.ms,monitor[0].u[0]/br.mV, label='u') #br.plot((monitor[2].t)/br.ms,(monitor[2][0]/br.mV), label='ge') br.legend() br.show()
def Plot(monitor, number): #pudb.set_trace() br.plot(211) if type(monitor) == list or type(monitor) == tuple: br.plot(monitor[0].t / br.ms, monitor[0].v[0] / br.mV, label='v') #br.plot(monitor[1].t/br.ms,monitor[1].u[0]/br.mV, label='u') #br.plot(monitor[2].t/br.ms,monitor[0].ge[0]/br.mV, label='v') else: br.plot(monitor.t / br.ms, monitor.v[0] / br.mV, label='v') #br.plot(monitor[0].t/br.ms,monitor[0].u[0]/br.mV, label='u') #br.plot((monitor[2].t)/br.ms,(monitor[2][0]/br.mV), label='ge') br.legend() br.show()
r0 = net['r0'] rI = net['rI'] # ri1 = net['ri1'] # ri2 = net['ri2'] b2.plot( r1.smooth_rate(width=conv_width)[:-leaveout_steps] / b2.Hz, r2.smooth_rate(width=conv_width)[:-leaveout_steps] / b2.Hz) ymin, ymax = b2.ylim() xmin, xmax = b2.xlim() b2.ylim([min(xmin, ymin), max(xmax, ymax)]) b2.xlim([min(xmin, ymin), max(xmax, ymax)]) b2.figure() b2.plot(r1.t[:-leaveout_steps] / b2.ms, r1.smooth_rate(width=conv_width)[:-leaveout_steps] / b2.Hz, label='1') b2.plot(r2.t[:-leaveout_steps] / b2.ms, r2.smooth_rate(width=conv_width)[:-leaveout_steps] / b2.Hz, label='2') b2.plot(r0.t[:-leaveout_steps] / b2.ms, r0.smooth_rate(width=conv_width)[:-leaveout_steps] / b2.Hz, label='0') b2.plot(rI.t[:-leaveout_steps] / b2.ms, rI.smooth_rate(width=conv_width)[:-leaveout_steps] / b2.Hz, label='I') # b2.plot(ri1.t/b2.ms, ri1.smooth_rate(width=10*b2.ms)/b2.Hz, label='i1') # b2.plot(ri2.t/b2.ms, ri2.smooth_rate(width=10*b2.ms)/b2.Hz, label='i2') b2.legend(title='pop.') b2.show()
#Ni = br.NeuronGroup(3, '''dv/dt = (vt - vr)/period : volt (unless refractory) # period: second # fire_once: boolean''', \ # threshold='v>vt', reset='v=vr', # refractory='fire_once') #Ni.period = [1, 1, 7] * br.ms #Ni.fire_once[:] = [True] * 3 indices = np.asarray([0]) times = np.asarray([6]) * br.ms Ni = br.SpikeGeneratorGroup(3, indices=indices, times=times) #Nh = br.NeuronGroup(1, model="""dv/dt=(gtot-v)/(10*ms) : 1 # gtot : 1""") Nh = br.NeuronGroup(1, model="""v = I :1 I : 1""") S = br.Synapses(Ni, Nh, model='''tl : second alpha=exp((tl - t)/tau1) - exp((tl - t)/tau2) : 1 w : 1 I_post = w*alpha : 1 (summed) ''', pre='tl+=t - tl') S.connect('True') S.w[:, :] = '(80+rand())' S.tl[:, :] = '0*second' M = br.StateMonitor(Nh, 'v', record=True) br.run(20*br.ms) br.plot(M[0].t, M[0].v) br.show()
r[l_idx] = la r[r_idx] = ra return r * b.Hz b.defaultclock.dt = 1 * b.ms b.prefs.codegen.target = 'numpy' num_parts = 3 theta_max = 25.0 e = env.WormFoodEnv((2, 3), num_parts=num_parts, theta_max=theta_max) N_i = num_parts * 4 N_h = 200 N_o = num_parts * 4 inp_eq = 'rates: Hz ' inp_th = 'rand() < rates*dt' inp_group = b.NeuronGroup(N_i, inp_eq, threshold=inp_th) inp_group.run_regularly('rates=inp_rates(i)', dt=b.defaultclock.dt) M = b.StateMonitor(inp_group, 'rates', record=True) b.run(100 * b.ms) for ri in M.rates: b.plot(M.t / b.ms, ri / b.Hz) b.show()
brian_plot(connections['XeAe'].w) subplot(3,1,2) brian_plot(connections['AeAi'].w) subplot(3,1,3) brian_plot(connections['AiAe'].w) plt.figure(6) subplot(3,1,1) brian_plot(connections['XeAe'].delay) subplot(3,1,2) brian_plot(connections['AeAi'].delay) subplot(3,1,3) brian_plot(connections['AiAe'].delay) b2.ioff() b2.show()
# fire_once: boolean''', \ # threshold='v>vt', reset='v=vr', # refractory='fire_once') #Ni.period = [1, 1, 7] * br.ms #Ni.fire_once[:] = [True] * 3 indices = np.asarray([0]) times = np.asarray([6]) * br.ms Ni = br.SpikeGeneratorGroup(3, indices=indices, times=times) #Nh = br.NeuronGroup(1, model="""dv/dt=(gtot-v)/(10*ms) : 1 # gtot : 1""") Nh = br.NeuronGroup(1, model="""v = I :1 I : 1""") S = br.Synapses(Ni, Nh, model='''tl : second alpha=exp((tl - t)/tau1) - exp((tl - t)/tau2) : 1 w : 1 I_post = w*alpha : 1 (summed) ''', pre='tl+=t - tl') S.connect('True') S.w[:, :] = '(80+rand())' S.tl[:, :] = '0*second' M = br.StateMonitor(Nh, 'v', record=True) br.run(20 * br.ms) br.plot(M[0].t, M[0].v) br.show()