def plot_performance(fig_num): num_evaluations = int(num_examples/update_interval) time_steps = range(0, num_evaluations) performance = np.zeros(num_evaluations) fig = b2.figure(fig_num, figsize = (5, 5)) fig_num += 1 ax = fig.add_subplot(111) im2, = ax.plot(time_steps, performance) #my_cmap b2.ylim(ymax = 100) b2.title('Classification performance') fig.canvas.draw() return im2, performance, fig_num, fig
def visualise_connectivity(S): Ns = len(S.source) Nt = len(S.target) b.figure(figsize=(10, 4)) b.subplot(121) b.plot(b.zeros(Ns), b.arange(Ns), 'ok', ms=10) b.plot(b.ones(Nt), b.arange(Nt), 'ok', ms=10) for i, j in zip(S.i, S.j): b.plot([0, 1], [i, j], '-k') b.xticks([0, 1], ['Source', 'Target']) b.ylabel('Neuron index') b.xlim(-0.1, 1.1) b.ylim(-1, max(Ns, Nt)) b.subplot(122) b.plot(S.i, S.j, 'ok') b.xlim(-1, Ns) b.ylim(-1, Nt) b.xlabel('Source neuron index') b.ylabel('Target neuron index')
leaveout_steps = int(conv_width / b2.defaultclock.dt) # leaveout_steps = 10 b2.figure() for trace in range(N_traces): net = run_model(net=net) r1 = net['r1'] r2 = net['r2'] 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,