Exemple #1
0
def plot_gf_pix(x, y, ichip, gf1, gf2, gf, gf1_scale, gf2_scale,gf_scale,dot_size=1,pic_path=None):

    chip_row, chip_col = numpy.divmod(ichip, 9)

    x = x + chip_col * 2112
    y = y + chip_row * 4644

    img = Image_Plot(xpad=0.2,ypad=0.1)
    img.subplots(1, 3)
    color_cm = 'bwr'

    norm = plt.Normalize(vmin=numpy.min(gf1_scale[0]), vmax=numpy.max(gf1_scale[1]))
    cmap = plt.get_cmap(color_cm)
    cl = cmap(norm(gf1))
    fig = img.axs[0][0].scatter(x, y, color=cl, s=dot_size)
    sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
    sm._A = []
    img.figure.colorbar(sm, ax=img.axs[0][0])

    norm = plt.Normalize(vmin=numpy.min(gf2_scale[0]), vmax=numpy.max(gf2_scale[1]))
    cmap = plt.get_cmap(color_cm)
    cl = cmap(norm(gf2))
    fig = img.axs[0][1].scatter(x, y, color=cl, s=dot_size)
    sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
    sm._A = []
    img.figure.colorbar(sm, ax=img.axs[0][1])

    norm = plt.Normalize(vmin=numpy.min(gf_scale[0]), vmax=numpy.max(gf_scale[1]))
    cmap = plt.get_cmap(color_cm)
    cl = cmap(norm(gf))
    fig = img.axs[0][2].scatter(x, y, color=cl, s=dot_size)
    sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
    sm._A = []
    img.figure.colorbar(sm, ax=img.axs[0][2])

    for i in range(3):
        img.axis_sci_ticklabel(0,i,0)
        img.axis_sci_ticklabel(0,i,1)
        img.set_label(0,i,0,"y")
        img.set_label(0,i,1,"x")
    if pic_path:
        img.save_img(pic_path)
    # img.show_img()
    img.close_img()
Exemple #2
0
img = Image_Plot(fig_x=5, fig_y=4, xpad=0.1, ypad=0.13)
img.subplots(2, 2)

for i in range(4):
    m, n = divmod(i, 2)
    img.axs[m][n].hist(plt_data[i][0][idx],
                       20,
                       label=labels[i][0],
                       alpha=alpha,
                       histtype="step",
                       linewidth=ls)
    img.axs[m][n].hist(plt_data[i][1][idx],
                       20,
                       label=labels[i][1],
                       alpha=alpha,
                       histtype="step",
                       linewidth=ls)
    img.axs[m][n].hist(plt_data[i][2][idx],
                       20,
                       label=labels[i][2],
                       alpha=alpha,
                       histtype="step",
                       linewidth=ls)

for i in range(2):
    for j in range(2):
        img.axs[i][j].legend()
        img.axis_sci_ticklabel(i, j, 0)
        img.axis_sci_ticklabel(i, j, 1)
img.show_img()
        G1_bin,
        G1_hist_bin,
        NU1_hist_bin,
        chisq_gap=50,
        max_iters=50,
        fit_num=20,
        dg=0.002,
        ax=img.axs[0][1])[:4]
    t2 = time.time()

    chisq_min_c = coeffc[0] - coeffc[1]**2 / 4 / coeffc[2]
    result_min[2, tag] = chisq_min_c
    result_min[3, tag] = asymc

    for m in range(2):
        img.axis_sci_ticklabel(0, m, 1)
    print(
        "%.5f(%.5f). asym: %.3e. %d source + %d contaminations + %d corrections. %.2f sec"
        % (ghc, ghc_sig, asymc, num_s, num_non, num_corr, t2 - t1))

    img.save_img(data_path + "/result/%d/%s_%.2f_dilute_%d_mg_bins.png" %
                 (mg_bin_num, data_type, dilute_case[tag], mg_bin_num))
    # img.show_img()
    img.close_img()

comm.Barrier()
if rank == 0:
    numpy.savez(
        data_path + "/result/%d/%s_min_change_%d.npz" %
        (mg_bin_num, data_type, mg_bin_num), result_min)
    img = Image_Plot(xpad=0.25)
Exemple #4
0
        xs = img.axs[1][i].set_xlim()
        img.axs[1][i].plot([xs[0], xs[1]], [
            total_result[i + dilute_case, 0], total_result[i + dilute_case, 0]
        ],
                           label="$\chi^2$ before corr")

        ys = img.axs[0][i].set_ylim()
        dilute_ratio = dilute_ratio_list[i]
        num_non = int(num_s * dilute_ratio)
        img.axs[0][i].plot([num_non, num_non], [ys[0], ys[1]],
                           ls="--",
                           c="gray",
                           label="true dilution")

        img.set_label(0, i, 0, "Asymmetry")
        img.set_label(1, i, 0, "$\chi^2$")

        img.set_label(0, i, 1, "Correction")
        img.set_label(1, i, 1, "Correction")

        img.axis_sci_ticklabel(0, i, 0)
        img.axis_sci_ticklabel(0, i, 1)

        img.axis_sci_ticklabel(1, i, 1)

        img.axs[0][i].legend()
        img.axs[1][i].legend()

    img.save_img("./%d/asym_%d.pdf" % (mg_bin_num, mg_bin_num))
    img.close_img()
comm.Barrier()