Esempio n. 1
0
ax.yaxis.set_ticklabels([])

ax = axes[1, 1]
for ps in ps_epoch1:
    y = ps
    # y = 10*np.log10(y)
    ax.plot(x, y, color='black', lw=1, alpha=.2)
y = np.nanmean(ps_epoch1, 0)
# y= 10*np.log10(y)
ax.plot(x, y, color='red', lw=1)
ax.set_xlim(0, 100)
ax_spines.set_default(ax)
ax.set_xlabel('Frequency [Hz]')

axes[1, 0].set_xticks([0, 50, 100])
axes[1, 1].set_xticks([0, 50, 100])

axes[1, 0].set_yticks([0., 0.05, .1])
axes[1, 1].set_yticks([0., 0.05, .1])

panel_label(axes[0, 0], 'a', x=-.3)
panel_label(axes[0, 1], 'b', x=-.15)
panel_label(axes[1, 0], 'c', x=-.3)
panel_label(axes[1, 1], 'd', x=-.15)

filename = 'sequence_EI_networks_spectrogram'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')

pl.show()
axI2 = pl.subplot2grid((2, 4), (0, 2))
axI3 = pl.subplot2grid((2, 4), (0, 3))
axEI1 = pl.subplot2grid((2, 4), (1, 0), colspan=2)
axEI2 = pl.subplot2grid((2, 4), (1, 2))
axEI3 = pl.subplot2grid((2, 4), (1, 3))

plot_clustered_activity([axI1, axI2, axI3], simulationI, 100, 100,
                        np.arange(1000., 4000.1, 10.), 3, 20, [50, 50], 10)
plot_clustered_activity([axEI1, axEI2, axEI3], simulationEI, 120, 120,
                        np.arange(2000., 3000.1, 10.), 3, 3, [60, 60], 10)

axI1.set_xlim([1, 4])
axEI1.set_xlim([2, 3])

axEI1.set_xlabel('Time [s]')
axEI2.set_xlabel('Time [s]')

x = -.15
panel_label(axI1, 'a', x=-.2)
panel_label(axI2, 'b', x=x)
panel_label(axI3, 'c', x=x)
panel_label(axEI1, 'd', x=-.2)
panel_label(axEI2, 'e', x=x)
panel_label(axEI3, 'f', x=x)

filename = 'sequence_networks_cluster_activity'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')

pl.show()
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar0 = pl.colorbar(im0, cax=cax)
cbar0.set_ticks([0, 7, 14])
cbar0.set_label('Firing rate [spikes/s]', fontsize=6)
divider = make_axes_locatable(ax[0, 1])
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar1 = pl.colorbar(im1, cax=cax)
cbar1.set_ticks([0, 50, 100])
cbar1.set_label('Number of clusters per seconds', fontsize=6)
divider = make_axes_locatable(ax[0, 2])
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar2 = pl.colorbar(im2, cax=cax)
cbar2.set_ticks([0, 0, 40, 80])
cbar2.set_label('Mean lifespan of cluster [ms]', fontsize=6)

panel_label(ax[0, 0], 'a', x=-.5)
panel_label(ax[0, 1], 'b', x=-.3)
panel_label(ax[0, 2], 'c', x=-.3)

for i in range(3):
    circle = patches.Circle((2, 7),
                            .5,
                            linewidth=1,
                            edgecolor=colors[1],
                            facecolor='none')
    ax[0, i].add_patch(circle)

im0 = ax[1, 0].imshow(np.array(re_spike_count).reshape(5, 5) / 5. / 120 / 120,
                      origin='bottom')
im1 = ax[1, 1].imshow(np.array(re_cluster_count).reshape(5, 5) / 5.,
                      origin='bottom')
Esempio n. 4
0
                        sharex=True,
                        sharey=True,
                        subplot_kw=subplot_kw,
                        dpi=300,
                        figsize=(5.6, 5.6 * .66))
fig.suptitle('Schematics of the asymmetric networks')

ax = axes[0, 0]
ax.plot(X, Y, 'o', ms=2, color='grey')
ax.plot(src, src, 'o', ms=4, color=cs)

ax.add_patch(Circle((src, src), 20, alpha=.3, color=c0))
ax.add_patch(Circle((src + 10, src + 10), 20, alpha=.3, color=c1))
ax.arrow(src + 2, src + 2, 4, 4, head_width=2, head_length=3, fc='k', ec='k')
ax_spines.set_default(ax)
panel_label(ax, 'a')

np.random.seed(0)

nrow = 100
ncol = 100
ncon = 10000
t = lcrn.lcrn_gamma_targets(5050, nrow, ncol, nrow, nrow, ncon, 4, 3)[0]

tx0 = t / nrow
ty0 = t % ncol

tx1 = tx0 + 5
ty1 = ty0 + 5

bins = np.arange(0, 101, 2)
ax_c.set_xlabel('Perlin scale')
ax_c.set_ylim(20, 70)
ax_c.set_ylabel('Number of sequences')

ax_da.set_theta_offset(np.pi / 2)
# ax_da.set_ylabel('Count')
ax_da.set_xlabel('Direction changing')
ax_spines.set_default(ax_da)
ax_da.locator_params(nbins=4)
ax_da.set_xticks([0, np.pi / 2, np.pi, np.pi * 3 / 2])
ax_da.set_xticklabels([0, '$\pi/2$', '$\pi$', '$-\pi/2$'])
ax_da.set_rticks([500, 1000, 1500])
ax_da.set_yticklabels([])
ax_da.set_rlabel_position(np.pi)

ax_s.set_ylabel('Probability')
ax_s.set_xlabel('Velocity [grid points / sec]')
ax_spines.set_default(ax_s)
ax_s.locator_params(nbins=3)

panel_label(ax1, 'a', x=-.84)
panel_label(ax_c, 'b', x=-.5)
panel_label(ax_s, 'c', x=-.5)
panel_label(ax_da, 'd', x=-.25)

filename = 'sequence_I_networks_perlin_size'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')

pl.show()
Esempio n. 6
0
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=.2)
    cbar = pl.colorbar(im[i], cax=cax)
    if i == 0:
        cax.remove()

    ax.xaxis.set_ticks_position('bottom')
    ax_spines.set_default(ax)
    ax.spines['left'].set_position('center')
    ax.spines['bottom'].set_position('center')

    ax.set_xlim(*lim)
    ax.set_ylim(*lim)

    ax.set_xticks(lim)
    ax.set_yticks(lim)

    ax.set_title(titles[i] + ' networks')

cbar.set_label('Change in the connection', fontsize=6)
cbar.set_ticks([-1, 0, 1])

panel_label(axes[0, 0], 'a', x=-.35)
panel_label(axes[1, 0], 'b', x=-.42)

filename = 'sequence_networks_connections'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')

pl.show()
    ax.set_xlim(0, 120)
    ax.set_ylim(0, 120)

handles, labels = ax1.get_legend_handles_labels()
ax2.legend(handles[::-1],
           labels[::-1],
           loc='upper right',
           bbox_to_anchor=(1.9, 1),
           fontsize=8)

ax1.set_title('')
ax1.set_xlabel('Real part')
ax1.set_ylabel('Imaginary part')
ax_spines.set_default(ax1)

ax2.set_xlabel('Effective length')
ax2.set_ylabel('Number of neurons')
ax2.set_ylim([0, 1600])
ax_spines.set_default(ax2)
ax2.locator_params(nbins=5)

panel_label(ax1, 'a', x=-.35)
panel_label(ax2, 'b', x=-.35)
panel_label(axes[1, 0], 'c', x=-.55)
panel_label(axes[2, 0], 'd', x=-.55)

filename = 'sequence_networks_mechanism'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar1 = pl.colorbar(im1, cax=cax)
cbar1.set_ticks([0, .5, 1.])
cbar1.set_label('Probability of evoked clusters', fontsize=5)
divider = make_axes_locatable(ax[1, 2])
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar2 = pl.colorbar(im2, cax=cax, extend='max')
cbar2.set_ticks([0, 10, 20, 30])
cbar2.set_label('Reaction time [ms]', fontsize=5)
divider = make_axes_locatable(ax[1, 3])
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar3 = pl.colorbar(im3, cax=cax, extend='max')
cbar3.set_ticks([0, 50, 100])
cbar3.set_label('Lifespan of cluster [ms]', fontsize=5)

panel_label(ax[1, 0], 'c', x=-.8)
panel_label(ax[1, 1], 'd', x=-.2)
panel_label(ax[1, 2], 'e', x=-.2)
panel_label(ax[1, 3], 'f', x=-.2)

for i in range(4):
    ax_spines.set_default(ax[1, i])

for i in range(4):
    ax[0, i].remove()

# axA = fig.add_subplot(2, 2, 1)
axA = pl.subplot2grid((2, 4), (0, 0), rowspan=1, colspan=2)
panel_label(axA, 'a', x=-.27)
for i in range(4):
    circle = patches.Circle((5, 3),
Esempio n. 9
0
                                                   nrow,
                                                   ncol,
                                                   steps=steps,
                                                   width=width,
                                                   td=td,
                                                   eps=eps)
        t, x, y, c, a, s = sequences

        speed = s[~np.isnan(s)]
        bins = np.linspace(0, 4, 51)
        hs = np.histogram(speed, bins=bins)[0]
        ax.plot(bins[:-1] / 25. * 1000.,
                hs / float(np.sum(hs)),
                label='%s' % shift)
        ax_spines.set_default(ax)
        ax.locator_params(nbins=4)

ax = axes[-1]
ax.set_ylabel('Probability')
ax.set_xlabel('Velocity [grid points / sec]')
ax.legend(title='Shift [grid points]')

panel_label(axes[0], 'a', x=-.15)
panel_label(axes[1], 'b', x=-.15)

filename = 'sequence_I_networks_shift_speed'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')

pl.show()
        axbar.set_position([barbox.x0, box.y0, 0.01, box.height])
        norm = mpl.colors.Normalize(vmin=0, vmax=2 * np.pi)
        cbar = mpl.colorbar.ColorbarBase(axbar, cmap=cmap, norm=norm)
        cbar.set_ticks(np.arange(0, 2 * np.pi + np.pi / 2, np.pi / 2))
        cbar.set_ticklabels(
            ['$0$', '$0.5{\pi}$', '$\pi$', '$1.5\pi$', '$2\pi$'])
        cbar.set_label('$\phi$')

    plot_histogram(axes[:, -1], S, indegree, rate, direction, idx)

ax = axes[0, -1]
ax.legend(['Symmetric', 'Random', 'Perlin', 'Homogeneous'],
          bbox_to_anchor=(1.2, 1.00))

ax = axes[-1, -1]
ax.set_xlabel('Probability')

rows = ['a', 'b', 'c', 'd']
cols = ['i', 'ii', 'iii', 'iv']
cols = ['1', '2', '3', '4']
for i in range(4):
    for j in range(4):
        panel_label(axes[i, j], rows[i] + cols[j], x=-.2)
    panel_label(axes[i, -1], rows[i] + '5', x=-.5)

filename = 'sequence_I_networks_measurements'
fig.savefig(filename + '.png', format='png', dpi=300)
fig.savefig(filename + '.pdf', format='pdf')

pl.show()