コード例 #1
0
ファイル: fig-reconstruct.py プロジェクト: dbirman/attfield2
                            wspace=0.3,
                            hspace=0.3,
                            left=0.1,
                            right=0.9,
                            bottom=0.06,
                            top=0.94)
base_a = util.panel_label(fig, fine_gc[0, 0], "a")
base_b = util.panel_label(fig, fine_gc[0, 2], "b")
base_c = util.panel_label(fig, gs[1, 0], "c")

# ----------------  readout panel  ----

# panel a
ax_b = fig.add_subplot(fine_gc[0, 2])
gain_mappable = readouts.gain_map(ax_b, readout_data)
util.labels(ax_b, "Layer 4 Feature Map", "")
util.colorbar(
    fig,
    ax_b,
    gain_mappable,
    label=pkws.labels.effective_gain,
    shrink=0,
)

# panel b
ax_c = fig.add_subplot(gs[1, 0])
readouts.reconstructed_bhv(ax_c, readout_data, regs)
util.labels(ax_c, None, pkws.labels.bhv_performance)

# save
plt.savefig(params.output, transparent=True)
コード例 #2
0
               color=pkws.pal_bhv[1],
               zorder=3,
               **pkws.bhv_mean)

    ax.set_xlim(-0.5, 3.5)
    # ax.axhline(0.5, lw = 1, color = '.7', zorder = -1, ls = '--')
    ax.set_xticks([0, 1, 2])
    ax.set_ylim(pkws.bhv_yrng)
    if yticks is None:
        ax.set_yticks(ax.get_yticks())
    else:
        ax.set_yticks(yticks)


# panel b
ax_c = fig.add_subplot(gs[0, 0])
reconstructed_bhv(ax_c, readout_data, regs, pkws=pkws, yticks=pkws.bhv_yrng)
ax_c.set_xticks([0, 1, 2])
sns.despine(ax=ax_c, trim=True, offset=5)
ax_c.set_xticklabels([
    pkws.labels.reconst_models[0], pkws.labels.reconst_models[2],
    pkws.labels.reconst_models[3]
],
                     rotation=45,
                     ha='center')
ax_c.set_xlim(-0.5, 2.5)
util.labels(ax_c, None, "Performance [AUC (d')]", pkws=pkws)

# save
plt.savefig(params.output, transparent=True)
コード例 #3
0
# make gridspec
gs = gridspec.GridSpec(
    nrows = 1, ncols = 1, figure = fig,)


ax_a = fig.add_subplot(gs[0, 0])
diagrams.rf_ellipses(
    ax_a, lp_pre_ells, lp_att_ells[3],
    grads_dist, grads_focl, (0,4,0),
    params.rf_diagram_units, loc = (56, 56),
    color_dist = '#000000', color_focl = '#d55c00', pkws = pkws)
ax_a.set_ylim([150, 0])
util.axis_expand(ax_a, L = 0.0, B = 0.05, R = 0.05, T = 0.1)
util.labels(ax_a,
    "Image space",
    "Image space", pkws = pkws)

# save
plt.savefig(params.output, transparent = True)










コード例 #4
0
                        pal=pkws.pal_b,
                        xlim=pkws.lineplot_xlim,
                        ylim=params.shift_lim,
                        xticks=[0, 150],
                        pkws=pkws)
for ax in ax_c:
    ax.set_yticks([ax.get_yticks()[0], ax.get_yticks()[-1]])
    ax.set_yticklabels(["", ""])
    ax.tick_params(length=pkws.rc['ytick.major.size'] / 2)
ax_c[-1].set_xticklabels(["", ""])
# c: main panel
ax_c = fig.add_subplot(gs_c[:, 0])
lineplots.lineplot(lineplots.rf_file_iterator('shift',
                                              lp_dists,
                                              lp_att_ells, (0, 4, 0),
                                              comp_ells=lp_comp_ells),
                   ax_c,
                   line_span=pkws.lineplot_span,
                   rad=30,
                   pal=pkws.pal_b,
                   xlim=pkws.lineplot_xlim,
                   ylim=params.shift_lim,
                   pkws=pkws)
ax_c.set_yticks([params.shift_lim[0], 0, params.shift_lim[1]])
ax_c.set_xticks([0, 150])
sns.despine(ax=ax_c, trim=True, offset=5)
util.labels(ax_c, pkws.labels.unit_distance, pkws.labels.rf_shift, pkws=pkws)

# save
plt.savefig(params.output, transparent=True)
コード例 #5
0
    figure=fig,
)

ax_e = fig.add_subplot(gs[0, 0])
lineplots.lineplot(lineplots.gain_file_iterator(lp_dists,
                                                sgain_focl, (0, 4, 0),
                                                gain_comp=sgain_comp),
                   ax_e,
                   line_span=pkws.lineplot_span,
                   rad=30,
                   pal=pkws.pal_b,
                   xlim=(0, 180),
                   ylim=params.gain_lim,
                   pkws=pkws)
util.labels(ax_e,
            pkws.labels.unit_distance,
            pkws.labels.effective_gain,
            pkws=pkws)
util.legend(fig,
            ax_e,
            pkws.labels.beta,
            pkws.pal_b,
            inset=pkws.legend_inset,
            pkws=pkws)
ax_e.set_yticks([1, params.gain_lim[1]])
ax_e.set_xticks([0, 150])
sns.despine(ax=ax_e, trim=True, offset=5)
util.axis_expand(ax_e, L=-0.07, B=-0.1, R=0.1, T=0.05)

# save
plt.savefig(params.output, transparent=True)
コード例 #6
0
    nrows=1,
    ncols=1,
    figure=fig,
)

ax_d = fig.add_subplot(gs[0, 0])
size_map = quivers.quiverplot(qv_dist_ell,
                              qv_focl_ell,
                              qv_smooth_samp,
                              ax_d,
                              cmap='coolwarm',
                              vrng=params.size_lim,
                              pkws=pkws)
util.axis_expand(ax_d, L=0.15, B=0.1, R=-0.11, T=0.15)
util.labels(ax_d,
            pkws.labels.image_position.format('Horizontal'),
            pkws.labels.image_position.format('Vertical'),
            pkws=pkws)
util.colorbar(fig,
              ax_d,
              size_map,
              ticks=params.size_lim + (1, ),
              label=pkws.labels.rf_size,
              label_vofs=-0.12,
              label_margin=0.04,
              margin=0.03,
              width=0.03,
              pkws=pkws)

# save
plt.savefig(params.output, transparent=True)
コード例 #7
0
#     pkws.labels.image_position.format('Vertical'))
# util.colorbar(
#     fig, ax_d, size_map, ticks = params.size_lim + (1,),
#     label = pkws.labels.rf_size, label_vofs = -0.03)


# panel c : single axis
ax_c = fig.add_subplot(gs[1,1])
lineplots.lineplot(
    lineplots.rf_file_iterator(
        'shift', lp_dists, lp_att_ells, (0,4,0),
        comp_ells = lp_comp_ells),
    ax_c,
    line_span = 30, rad = 30, pal = pkws.pal_b,
    xlim = (0, 180), ylim = params.shift_lim)
util.labels(ax_c, pkws.labels.unit_distance, pkws.labels.rf_shift)
util.legend(
    fig, ax_c, pkws.labels.beta, pkws.pal_b,
    inset = pkws.legend_inset)


# panel d : single axis
ax_d = fig.add_subplot(gs[1,2])
lineplots.lineplot(
    lineplots.rf_file_iterator(
        'size', lp_dists, lp_att_ells, (0,4,0),
        comp_ells = lp_comp_ells),
    ax_d,
    line_span = 30, rad = 30, pal = pkws.pal_b,
    xlim = (0, 180), ylim = params.size_lim)
util.labels(ax_d, pkws.labels.unit_distance, pkws.labels.rf_size)
コード例 #8
0
base_b = util.panel_label(fig, gs[1, 0], "b")
base_c = util.panel_label(fig, gs[1, 1], "c")
base_d = util.panel_label(fig, gs[1, 2], "d")
base_e = util.panel_label(fig, gs[2, 0], "e")
base_f = util.panel_label(fig, gs[2, 1], "f")

# panel b
ax_d = fig.add_subplot(gs[1, 0])
size_map = quivers.quiverplot(qv_dist_ell,
                              qv_focl_ell,
                              qv_smooth_samp,
                              ax_d,
                              cmap='coolwarm',
                              vrng=params.size_lim)
util.axis_expand(ax_d, L=0.2, B=0.2, R=-0.1, T=0.05)
util.labels(ax_d, pkws.labels.image_position.format('Horizontal'),
            pkws.labels.image_position.format('Vertical'))
util.colorbar(fig,
              ax_d,
              size_map,
              ticks=params.size_lim + (1, ),
              label=pkws.labels.rf_size,
              label_vofs=-0.04)

# panel c : single axis
ax_c = fig.add_subplot(gs[1, 1])
lineplots.lineplot(lineplots.rf_file_iterator('shift',
                                              lp_dists,
                                              lp_att_ells, (0, 4, 0),
                                              comp_ells=lp_comp_ells),
                   ax_c,
                   line_span=30,