def main(): palette.configure(False) print("Good target: center on %d%d%d" % (47 % 7, (47 // 7) % 7, 47 // 49)) plot_dev(0) plot_dev(1) plot_dev(2) plt.show()
def main(): palette.configure(False) all_ids, mvir, rvir, mpeak, x, y, z = np.loadtxt( "halo_data.txt", usecols=(0, 1, 2, 3, 6, 7, 8) ).T vec = np.array([x, y, z]).T unique_ids = np.unique(all_ids) # array of booleans for uniqueness # i.e. a new host halo id == True for j in range(5): plt.figure(j) ok = all_ids == unique_ids[j] # SUPER HELPFUL LINE FOR CONDENSING plot_subhaloes(mpeak[ok], 1e12, rvir[ok], vec[ok]) plt.show() """
def main(): palette.configure(False) d_indiv, n_indiv = np.loadtxt("indiv_dx_min.txt").T d_global, n_global = np.loadtxt("global_dx_min.txt").T d_rot_global, n_rot_global = np.loadtxt("global_rotation.txt").T d_window_indiv, n_window_indiv = np.loadtxt("rotate_window_indiv.txt").T d_mean_indiv, n_mean_indiv = np.loadtxt("rotate_mean_indiv.txt").T d_mode_indiv, n_mode_indiv = np.loadtxt("rotate_mode_indiv.txt").T plt.plot(d_indiv, n_indiv, color=pc("k"), label=r"${\rm individual\ (\Delta x)_{\rm min}}$") plt.plot(d_global, n_global, color=pc("r"), label=r"${\rm global\ (\Delta x)_{\rm min}}$") plt.plot(d_rot_global, n_rot_global, color=pc("o"), label=r"${\rm global\ rotation}$") plt.plot(d_rot_global - 2**16, n_rot_global, color=pc("o")) plt.plot(d_window_indiv, n_window_indiv, color=pc("g"), label=r"${\rm individual\ rotation\ (window)}$") plt.plot(d_window_indiv - 2**16, n_window_indiv, color=pc("g")) plt.plot(d_mean_indiv, n_mean_indiv, color=pc("b"), label=r"${\rm individual\ rotation\ (mean)}$") plt.plot(d_mean_indiv - 2**16, n_mean_indiv, color=pc("b")) plt.plot(d_mode_indiv, n_mode_indiv, color=pc("p"), label=r"${\rm individual\ rotation\ (mode)}$") plt.plot(d_mode_indiv - 2**16, n_mode_indiv, color=pc("p")) plt.legend(loc="upper left", frameon=True, fontsize=16) xlo, xhi = plt.xlim(-400, 2000) ylo, yhi = plt.ylim() plt.ylim(ylo, yhi) plt.xlabel(r"$\Delta x$") plt.ylabel(r"$N(\Delta x)$") n = -512 while n < xhi: plt.plot([n, n], [ylo, yhi], ":", lw=1, c="k") n += 256 plt.show()
def main(): palette.configure(True) file_names = [ "profiles/phi_pts/phi_pts_4_1.25.txt", "profiles/phi_pts/phi_pts_4_2.5.txt", "profiles/phi_pts/phi_pts_4_5.txt", "profiles/phi_pts/phi_pts_4_10.txt", "profiles/phi_pts/phi_pts_4_20.txt" ] log_r, phi = np.loadtxt(file_names[0]).T log_r_2, phi_2 = np.loadtxt(file_names[-1]).T mvir = 5.112e+09 vvir = mvir_to_vvir(mvir) rvir = mvir_to_rvir(mvir) log_r -= np.log10(rvir) log_r_2 -= np.log10(rvir) phi /= vvir**2 phi_2 /= vvir**2 plt.plot([-12, 5], [-12, 5], "--", lw=2, c=pc("a")) plt.plot(phi, phi_2, ".", c="k") plt.xlim(-12, 5) plt.ylim(-12, 5) plt.xlabel(r"$\Phi_{\rm true}/V_{\rm vir}^2$") plt.ylabel(r"$\Phi(\delta_v = 0.8 V_{\rm vir})/V_{\rm vir}^2$") plt.fill_between([0, 5], [0, 0], [-12, -12], color=pc("b"), alpha=0.2) plt.fill_between([-12, 0], [5, 5], [0, 0], color=pc("r"), alpha=0.2) plt.savefig("plots/fig4_vvir_boundedness.png")
import matplotlib.pyplot as plt import numpy as np import palette from palette import pc import string ls = "-" lw = 3 palette.configure() def gaussian(mu, sigma, x): return np.exp(-(x - mu)**2 / (2 * sigma**2)) / np.sqrt(2 * np.pi * sigma**2) x = np.linspace(0, 1, 100) for c in palette.colors[:0:-1]: plt.figure() for sigma in np.linspace(0.2, 1.0, 10): plt.plot(x, gaussian(sigma, sigma, x), ls, lw=lw, c=pc(c, sigma)) if c == "red": plt.savefig("README_images/color_range.png") plt.figure() x = np.linspace(-1, 1, 100)
plt.figure() acc = np.array(accuracies[0]) plt.plot(np.log10(acc), dv_means, c=pc("b"), label=r"$\vec{v}$") plt.plot(np.log10(acc), dv_means, "o", c=pc("b")) plt.xlabel(r"$\log_{10}(\delta v)\ ({\rm km\,s^{-1}})$", color=pc("b")) plt.ylabel(r"${\rm Compression\ ratio}$") plt.tick_params(axis="x", colors=pc("b")) plt.twiny() plt.plot(np.log10(acc / spacing / 1e3), dx_means, c=pc("r"), label=r"$\vec{x}$") plt.plot(np.log10(acc / spacing / 1e3), dx_means, "o", c=pc("r")) plt.xlabel(r"$\log_{10}(\delta x / l)$", color=pc("r")) plt.ylabel(r"${\rm Compression\ ratio}$") plt.tick_params(axis="x", colors=pc("r")) plt.savefig("plots/fig_2b_ratio_vs_accuracy.png") if __name__ == "__main__": palette.configure(True) main() #plt.show()
import sys sys.path.append("../python") import matplotlib matplotlib.use("PDF") import numpy as np import matplotlib.pyplot as plt import palette from palette import pc import minh import time palette.configure(False) def main(): fname = sys.argv[1] f = minh.open(fname) for b in range(f.blocks): x, vx, mvir, vmax = f.block(b, ["x", "vx", "mvir", "vmax"]) print("X", x[:3]) print("Y", vx[:3]) print("mvir", mvir[:3]) print("vmax", vmax[:3]) break """