コード例 #1
0
    density_data = [[dens_t, dens_x, sigma_mean], [dens_t_sig, dens_x_sig, num]]
    dens_titles = [["$< g_1\Sigma_c>$", "$< g_2\Sigma_c>$", "$<\Sigma_c>$"],
             ["$\delta <g_1\Sigma_c>$","$\delta <g_2\Sigma_c>$","$number$"]]

    gamma_data = [[gamma_t, gamma_x, gamma], [gamma_t_sig, gamma_x_sig, num],[gamma_tc, gamma_xc, num]]
    gamma_titles = [["$g_1$", "$g_2$", "$g$"],
              ["$\delta g_1$", "$\delta g_2$", "$number$"],
              ["$< g_1\Sigma_c>/\Sigma_{z=%.2f}$"%crit_z,"$< g_2\Sigma_c>/\Sigma_{z=%.2f}$"%crit_z,"nothing"]]

    kappa_data = [[kappa_recon_ks95, kappa_recon_ks95_crit], [kappa_recon, kappa_recon_crit]]
    kappa_titles = [["$\kappa KS\_95 Fourier$ ", "$\kappa KS\_95 Fourier critical$"],
              ["$\kappa real$", "$\kappa real criticak$"]]

    # show density map
    img = plot_tool.Image_Plot(fig_x=8, fig_y=8)
    img.subplots(2,3)
    cmap = plt.get_cmap('YlOrRd')
    sm = plt.cm.ScalarMappable(cmap=cmap)

    for i in range(2):
        for j in range(3):
            density_data[i][j][idx] = 0
            ax = img.axs[i][j].imshow(density_data[i][j][inverse],cmap=cmap)
            img.set_label(i,j, 1, "RA")
            img.set_label(i,j, 0, "DEC")
            img.axs[i][j].set_title(dens_titles[i][j],fontsize=img.xy_lb_size)
            img.figure.colorbar(ax, ax=img.axs[i][j])

    img.save_img(data_path + "density_%d.png"%ir)
    if platform.system() != 'Linux':
コード例 #2
0
# img.axs[0][0].legend()
# img.save_img()

# coeff_t = tool_box.fit_1d(gh, chi_t, 2, "scipy")
# corr_sig_t = numpy.sqrt(1 / 2. / coeff_t[2])
# g_corr_t = -coeff_t[1] / 2. / coeff_t[2]
#
# coeff_x = tool_box.fit_1d(gh, chi_x, 2, "scipy")
# corr_sig_x = numpy.sqrt(1 / 2. / coeff_x[2])
# g_corr_x = -coeff_x[1] / 2. / coeff_x[2]

comm.Barrier()
# plt.close()
if rank == 0:
    numpy.savez(data_path + "result_%d.npz"%area_id, result)
    img = plot_tool.Image_Plot()
    img.create_subfig(1, 2)
    gh = 10**numpy.linspace(numpy.log10(0.04), numpy.log10(15), 13)
    img.axs[0][0].errorbar(gh, result[0], result[1], label="T",capsize=img.cap_size)
    img.axs[0][0].errorbar(gh, result[2], result[3], label="X",capsize=img.cap_size)
    img.axs[0][0].set_xscale("log")
    img.axs[0][0].legend()

    img.axs[0][1].errorbar(gh, numpy.abs(result[0]), result[1], label="T",capsize=img.cap_size)
    img.axs[0][1].errorbar(gh, numpy.abs(result[2]), result[3], label="X",capsize=img.cap_size)
    img.axs[0][1].set_xscale("log")
    img.axs[0][1].set_yscale("log")
    img.axs[0][1].set_ylim(0.01, 200)
    img.axs[0][1].legend()

    img.save_img(data_path + "result_%d.pdf"%area_id)
コード例 #3
0

ch_num = 8
cuts_num = 20
x_coord = [i*2/cuts_num*100 for i in range(ch_num)]
print(x_coord)
ch = [i*2 for i in range(ch_num)]
ylabels = ["m$_1 \\times 10^2$", "m$_2 \\times 10^2$", "m$_1 \\times 10^2$", "m$_2 \\times 10^2$"]
fmt = '%2.f%%'
xticks = mtick.FormatStrFormatter(fmt)

npz = numpy.load("E:/works/CFHT_tomo/all/cut_ext/flux_alt_s12_a1/total.npz")
mc1 = npz["arr_0"][:,ch]
mc2 = npz["arr_1"][:,ch]

img = plot_tool.Image_Plot()
img.subplots(1, 2)
img.axs[0][0].errorbar(x_coord, mc1[0]-1, mc1[1],marker="s", mfc="none",linewidth=img.plt_line_width,capsize=img.cap_size, label="$m_1$")
img.axs[0][0].errorbar(x_coord, mc2[0]-1, mc2[1], marker="s", mfc="none",linewidth=img.plt_line_width,capsize=img.cap_size, label="$m_2$")


img.axs[0][1].errorbar(x_coord, mc1[2], mc1[3], marker="s", mfc="none",linewidth=img.plt_line_width,capsize=img.cap_size, label="$c_1$")
img.axs[0][1].errorbar(x_coord, mc2[2], mc2[3], marker="s", mfc="none",linewidth=img.plt_line_width,capsize=img.cap_size, label="$c_2$")
for i in range(2):
    img.axs[0][i].xaxis.set_major_formatter(xticks)
    xs = img.axs[0][i].set_xlim()
    img.axs[0][i].plot([xs[0], xs[1]],[0,0],linestyle="--",c="grey")
    img.axs[0][i].legend(fontsize=img.legend_size)
img.set_label(0,0,0,"m")
img.set_label(0,1,0,"c")
img.set_label(0,0,1,"Cutoff percentage")
コード例 #4
0
    idx_dec_s2 = dec <= dec_max + radius

    idx_p = idx_ra_s1 & idx_ra_s2 & idx_dec_s1 & idx_dec_s2

    for ir in range(len(redshift_bin) - 1):

        idx_z_b1 = redshift >= redshift_bin[ir]
        idx_z_b2 = redshift < redshift_bin[ir + 1]

        idx_z_sub = idx_z_b1 & idx_z_b2

        idx_s = idx_p & idx_z_sub

        if rank == 0:

            img = plot_tool.Image_Plot(fig_x=30, fig_y=30)
            img.subplots(1, 2)

            img.axs[0][0].scatter(fore_ra[igal],
                                  fore_dec[igal],
                                  s=200,
                                  facecolors="none",
                                  edgecolors="r",
                                  marker="*")
            for i in range(ny + 1):
                img.axs[0][0].plot([ra_min, ra_max], [dec_bin[i], dec_bin[i]],
                                   c="black",
                                   linestyle="--",
                                   alpha=0.5,
                                   linewidth=0.3)
            for j in range(nx + 1):
コード例 #5
0
    idx_dec_s2 = dec <= dec_max + radius

    idx_p = idx_ra_s1 & idx_ra_s2 & idx_dec_s1 & idx_dec_s2

    for ir in range(len(redshift_bin) - 1):

        idx_z_b1 = redshift >= redshift_bin[ir]
        idx_z_b2 = redshift < redshift_bin[ir + 1]

        idx_z_sub = idx_z_b1 & idx_z_b2

        idx_s = idx_p & idx_z_sub

        if rank == 0:

            img = plot_tool.Image_Plot(fig_x=12, fig_y=12)
            img.create_subfig(1, 2)

            img.axs[0][0].scatter(fore_ra[igal],
                                  fore_dec[igal],
                                  s=200,
                                  facecolors="none",
                                  edgecolors="r",
                                  marker="*")
            for i in range(ny + 1):
                img.axs[0][0].plot([ra_min, ra_max], [dec_bin[i], dec_bin[i]],
                                   c="black",
                                   linestyle="--",
                                   alpha=0.5,
                                   linewidth=0.3)
            for j in range(nx + 1):
コード例 #6
0
ra_min, ra_max = ra_bin.min(), ra_bin.max()
dec_min, dec_max = dec_bin.min(), dec_bin.max()

h5f.close()
print(ra, dec, ra_bin[1] - ra_bin[0] - scale, dec_bin[1] - dec_bin[0] - scale)

mask = fits.open("mask.fits")[0].data
target_blocks = []
for i in range(ny):
    for j in range(nx):
        if mask[i, j] > -1:
            m, n = divmod(mask[i, j], nx)
            target_blocks.append((m, n))
            print(m, n, dec_bin[m], dec_bin[m + 1], ra_bin[n], ra_bin[n + 1])
print(len(target_blocks))
img = plot_tool.Image_Plot(fig_x=20, fig_y=int(20. * ny / nx))
img.plot_img(1, 1)

for i in range(ny + 1):
    img.axs[0][0].plot([ra_min, ra_max], [dec_bin[i], dec_bin[i]],
                       c="black",
                       linewidth=0.5)
    for j in range(nx + 1):
        img.axs[0][0].plot([ra_bin[j], ra_bin[j]], [dec_min, dec_max],
                           c="black",
                           linewidth=0.5)

for blks in target_blocks:
    blk_x, blks_y = ra_bin[blks[1]] + 0.5 * scale, dec_bin[
        blks[0]] + 0.5 * scale
    img.axs[0][0].scatter(blk_x, blks_y, s=5, c="blue")