예제 #1
0
                       normed=True,
                       cumulative=True,
                       histtype="step",
                       bins=100)
    plt.xlabel(r"$(M_{\mathrm{period.fix}} - M_{\mathrm{no fix}}) \%$")
    plt.ylabel("CDF")
    plt.savefig(
        "/Users/lls/Documents/mlhalos_files/den_only_periodicity_fix/cdf_difference_predicted_masses.png"
    )
    plt.clf()

    # Compare 2d histograms of true vs predicted w and w/o periddicity fix

    pf.compare_2d_histograms(x,
                             y_fixed_den,
                             x,
                             y_den,
                             title1="periodicity fix",
                             title2="no period. fix")
    plt.savefig(
        "/Users/lls/Documents/mlhalos_files/den_only_periodicity_fix/2d_hist.png"
    )

    # Compare violin plots

    b_t = np.linspace(x.min(), x.max(), 15, endpoint=True)
    pf.compare_violin_plots(y_fixed_den,
                            x,
                            y_den,
                            x,
                            b_t,
                            label1="periodicity fix",
예제 #2
0
import sys
sys.path.append("/Users/lls/Documents/mlhalos_code")
import numpy as np
import matplotlib.pyplot as plt
from regression.plots import plotting_functions as pf

y_lowz = np.load("/Users/lls/Documents/mlhalos_files/z0_test/z0_only/predicted_log_halo_mass.npy")
# y_lowz = np.load("/Users/lls/Documents/mlhalos_files/lowz_density/predicted_log_halo_mass.npy")
y_fixed_den = np.load("/Users/lls/Documents/mlhalos_files/den_only_periodicity_fix/predicted_log_halo_mass.npy")
x = np.load("/Users/lls/Documents/mlhalos_files/lowz_density/true_mass_test_set.npy")

bins_plotting = np.linspace(x.min(), x.max(), 15, endpoint=True)

# 2D HISTOGRAM

pf.compare_2d_histograms(x, y_lowz, x, y_fixed_den,
                         title1="ics + low-z density", title2="ics density", save_path=None)

# VIOLINS

pf.compare_violin_plots(y_lowz, x, y_fixed_den, x,
                        bins_plotting, label1="ics + low-z density", label2="ics density", color1="g", color2="r")
pf.compare_violin_plots(y_lowz, x, y_fixed_den, x,
                        bins_plotting, label1="$z=0$ density", label2="ics density", color1="g", color2="r")

# 2D histograms of low/mid/high mass halos

high_mass = np.where(x>=13)[0]
mid_mass = np.where((x<13) & (x>12))[0]
low_mass = np.where(x<=12)[0]

pf.compare_2d_histograms(x[high_mass], y_lowz[high_mass], x[high_mass], y_fixed_den[high_mass],
예제 #3
0
    # path_density = "/Users/lls/Documents/mlhalos_files/regression/in_halos_only/log_m_output/even_radii_and_random/"
    path_density = "/Users/lls/Documents/mlhalos_files/den_only_periodicity_fix/"

    log_den_true = np.load(
        "/Users/lls/Documents/mlhalos_files/lowz_density/true_mass_test_set.npy"
    )
    log_den_predicted = np.load(path_density + "predicted_log_halo_mass.npy")
    # log_den_true = np.log10(den_true)
    # log_den_predicted = np.log10(den_predicted)

    # 2D HISTOGRAM

    pf.compare_2d_histograms(all_log_true_mass,
                             all_log_predicted_mass,
                             log_den_true,
                             log_den_predicted,
                             title1="density+shear",
                             title2="density",
                             save_path=None)

    # VIOLINS

    pf.compare_violin_plots(all_log_predicted_mass,
                            all_log_true_mass,
                            log_den_predicted,
                            log_den_true,
                            bins_plotting,
                            label1="den+shear",
                            label2="density",
                            color1="b",
                            color2="r",
예제 #4
0
perc_den0, perc_den1 = np.percentile(y_den_z0[ind], [16, 84])
plt.plot([perc_den0, perc_den1], [3000, 3000], color="g", lw=1.5)
plt.scatter(np.median(y_den_z0[ind]), 3000, color="g", s=10)
plt.legend(loc="best")
plt.xlabel(r"$\log (M /\mathrm{M}_{\odot})$", size=17)

# difference in distributions

plt.plot((bden[1:] + bden[:-1]) / 2, n0 - nden)
plt.xlabel(r"$\log (M /\mathrm{M}_{\odot})$", size=17)
plt.ylabel("N(ics + $z=0$) - N (ics)", size=17)

# 2d histograms

pf.compare_2d_histograms(x[ind],
                         y_den_z0[ind],
                         x[ind],
                         y_fixed_den[ind],
                         title2="ics density",
                         title1="ics + $z=0$ density",
                         x_max=x[ind].max(),
                         x_min=x[ind].min(),
                         y_max=13,
                         y_min=y_fixed_den[ind].min())

pf.compare_2d_histograms(x,
                         y_den_z0,
                         x,
                         y_fixed_den,
                         title2="ics density",
                         title1="ics + $z=0$ density")
예제 #5
0
    "/Users/lls/Documents/mlhalos_files/truth_feature/predicted_log_halo_mass.npy"
)
y_den = np.load(
    "/Users/lls/Documents/mlhalos_files/den_only_periodicity_fix/predicted_log_halo_mass.npy"
)
x = np.load(
    "/Users/lls/Documents/mlhalos_files/lowz_density/true_mass_test_set.npy")

bins_plotting = np.linspace(x.min(), x.max(), 15, endpoint=True)

# VIOLINS

pf.compare_violin_plots(y_w_truth_feat,
                        x,
                        y_den,
                        x,
                        bins_plotting,
                        label1="ics density + truth",
                        label2="ics density",
                        color1="g",
                        color2="r")

# 2D HISTOGRAM

pf.compare_2d_histograms(x,
                         y_w_truth_feat,
                         x,
                         y_den,
                         title1="ics density + truth",
                         title2="ics density",
                         save_path=None)