Beispiel #1
0
        sum_vals.append(vals)

    fig = plt.figure()
    ax = plt.subplot(111)
    adjust_spines(ax, ['bottom', 'left'])
    xvals = []
    xlbls = []
    offset = 0
    divider = 2
    for i in range(len(groups)):
        base_ind = i * divider
        print base_ind
        dt = np.array(csv_vals[base_ind: base_ind + divider]).T
        offsets = np.arange(dt.shape[1]) + offset
        mean_adjust = (i != 1)
        do_point_line_plot(dt, offsets, mean_adjust=mean_adjust)
#        for j in range(dt.shape[1]):
#            p_offset = -0.2
#            if dt[j].sum() > 0:
#                for ind in range(j + 1, dt.shape[1]):
#                    if dt[ind].sum() == 0:
#                        continue
#                    stat, p = scipy.stats.ttest_ind(dt[j], dt[ind])
#                    print 'p', p, j, ind
#                    if p < 0.05:
#                        plt.scatter(offset + j + p_offset,
#                                    0.95, c=colors[ind],
#                                    edgecolor=colors[ind],
#                                    marker='*')
#                        p_offset *= -1
fig8 = plt.figure(figsize=(4.5, 3.5))
fig8.set_facecolor('white')
plt.hold(True)
offset = 1
xvals = []
xlbls = []
ax = plt.subplot(111)
adjust_spines(ax, ['left', 'bottom'])
for exp_type in exp_types:
    dt = []
    offsets = offset + np.arange(len(stim_types))
    plt.text(offsets.mean(), 1.02, exp_type, ha='center')
    for i, k in enumerate(stim_types):
        dt.append(cell_max_time[exp_type][k][:, 1])
    dt = np.array(dt).T
    do_point_line_plot(dt, offsets, mean_adjust=True, width=0.7)
    xvals += offsets.tolist()
    xlbls += stim_types_short
    offset = offsets.max() + 2
print xvals
plt.ylabel('Corr of Cells to Prediction')
#plt.ylim(-0.01, 1)
plt.xticks(xvals, xlbls, rotation='vertical')
plt.subplots_adjust(left=0.12,
                    bottom=0.2,
                    right=0.97,
                    top=0.95,
                    wspace=0.23,
                    hspace=0.23)
fig_path = startup.fig_path + 'Sparseness/summary/'
fig8.savefig(fig_path + '%s_pred_summary.eps' % (str(filt)))
fig8 = plt.figure(figsize=(4.5, 3.5))
fig8.set_facecolor('white')
plt.hold(True)
offset = 1
xvals = []
xlbls = []
ax = plt.subplot(111)
adjust_spines(ax, ['left', 'bottom'])
for exp_type in exp_types:
    dt = []
    offsets = offset + np.arange(len(stim_types))
    plt.text(offsets.mean(), 1.02, exp_type, ha='center')
    for i, k in enumerate(stim_types):
        dt.append(cell_max_time[exp_type][k][:, 1])
    dt = np.array(dt).T
    do_point_line_plot(dt, offsets, mean_adjust=True, width=0.7)
    xvals += offsets.tolist()
    xlbls += stim_types_short
    offset = offsets.max() + 2
print xvals
plt.ylabel('Corr of Cells to Prediction')
#plt.ylim(-0.01, 1)
plt.xticks(xvals, xlbls, rotation='vertical')
plt.subplots_adjust(left=0.12, bottom=0.2, right=0.97, top=0.95,
                   wspace=0.23, hspace=0.23)
fig_path = startup.fig_path + 'Sparseness/summary/'
fig8.savefig(fig_path + '%s_pred_summary.eps' % (str(filt)))
fig8.savefig(fig_path + '%s_pred_summary.png' % (str(filt)))
#plt.show()
plt.close(fig8)
Beispiel #4
0
        sum_vals.append(vals)

    fig = plt.figure()
    ax = plt.subplot(111)
    adjust_spines(ax, ['bottom', 'left'])
    xvals = []
    xlbls = []
    offset = 0
    divider = 2
    for i in range(len(groups)):
        base_ind = i * divider
        print base_ind
        dt = np.array(csv_vals[base_ind:base_ind + divider]).T
        offsets = np.arange(dt.shape[1]) + offset
        mean_adjust = (i != 1)
        do_point_line_plot(dt, offsets, mean_adjust=mean_adjust)
        #        for j in range(dt.shape[1]):
        #            p_offset = -0.2
        #            if dt[j].sum() > 0:
        #                for ind in range(j + 1, dt.shape[1]):
        #                    if dt[ind].sum() == 0:
        #                        continue
        #                    stat, p = scipy.stats.ttest_ind(dt[j], dt[ind])
        #                    print 'p', p, j, ind
        #                    if p < 0.05:
        #                        plt.scatter(offset + j + p_offset,
        #                                    0.95, c=colors[ind],
        #                                    edgecolor=colors[ind],
        #                                    marker='*')
        #                        p_offset *= -1
            adjust_spines(ax, ['bottom', 'left'])
            xvals = []
            xlbls = []
            offset = 1
            if exp_type == 'PYR':
                divider = 2
            else:
                divider = 3
            for i in range(len(groups)):
                base_ind = i * divider
                mean_adjust = (i != 1)
                dt = csv_vals[:, base_ind: base_ind + divider]
                offsets = np.arange(dt.shape[1]) + offset
                plt.text(offsets.mean(), 1, groups[i], ha='center')                
                do_point_line_plot(dt, offsets, width=0.7,
                                   mean_adjust=mean_adjust,
                                   alpha=0.5,
                                   c=colors)

#                do_spot_scatter_plot(csv_vals[:, i], offset, col,
#                            width=0.7, mean_adjust=mean_adjust)


                xvals += offsets.tolist()
                xlbls += headers[1 + base_ind: base_ind + divider + 1]
                offset += divider + 1

            plt.xticks(xvals, xlbls, rotation='vertical')
            
            plt.ylim(0, 1.15)
            plt.subplots_adjust(left=0.05, bottom=0.25, right=0.98, top=0.98,
                       wspace=0.3, hspace=0.34)
            xvals = []
            xlbls = []
            offset = 1
            if exp_type == 'PYR':
                divider = 2
            else:
                divider = 3
            for i in range(len(groups)):
                base_ind = i * divider
                mean_adjust = (i != 1)
                dt = csv_vals[:, base_ind:base_ind + divider]
                offsets = np.arange(dt.shape[1]) + offset
                plt.text(offsets.mean(), 1, groups[i], ha='center')
                do_point_line_plot(dt,
                                   offsets,
                                   width=0.7,
                                   mean_adjust=mean_adjust,
                                   alpha=0.5,
                                   c=colors)

                #                do_spot_scatter_plot(csv_vals[:, i], offset, col,
                #                            width=0.7, mean_adjust=mean_adjust)

                xvals += offsets.tolist()
                xlbls += headers[1 + base_ind:base_ind + divider + 1]
                offset += divider + 1

            plt.xticks(xvals, xlbls, rotation='vertical')

            plt.ylim(0, 1.15)
            plt.subplots_adjust(left=0.05,
                                bottom=0.25,