def plot_H2_effect(sim, snap): """Load a simulation and plot its cddf""" halo = myname.get_name(sim, True) savefile = "boxhi_grid_noH2.hdf5" ahalo = dp.PrettyBox(halo, snap, nslice=10, savefile=savefile, label=r"No $H_2$") ahalo.plot_column_density(color="blue", ls="--", moment=True) savefile = "boxhi_grid_H2.hdf5" ahalo2 = dp.PrettyBox(halo, snap, nslice=10, savefile=savefile, label=r"$H_2$") ahalo2.plot_column_density(color="red",moment=True) # savefile = path.join(halo,"snapdir_"+str(snap).rjust(3,'0'),"boxhi_grid_H2-old.hdf5") # ahalo2 = dp.PrettyBox(halo, snap, nslice=10, savefile=savefile) # ahalo2.plot_column_density(color="green",moment=True) dla_data.column_density_data(moment=True) # dla_data.noterdaeme_12_data(path.join(path.dirname(__file__),"../dla_data"), moment=True) plt.legend(loc=3) plt.xlim(1e20,2e22) plt.ylim(1e-5,0.1) # plt.title("CDDF for "+labels[sim]+" at z="+str(redshifts[snap])) save_figure(path.join(outdir, "cosmo"+str(sim)+"_H2_"+str(snap))) plt.clf() cddf_base = ahalo.column_density_function() cddf = ahalo2.column_density_function() plt.semilogx(cddf_base[0], np.log10(cddf[1]/cddf_base[1]), color=colors[sim], ls=lss[sim]) plt.ylim(-0.5,0.5) tight_layout_wrapper() ax = plt.gca() ylab = ax.set_ylabel(r"$N_\mathrm{HI} f(N)$") save_figure(path.join(outdir, "cosmo_rel"+str(sim)+"_H2_"+str(snap))) plt.clf()
def plot_rel_res(sim): """Load and make a plot of the difference between two simulations""" basel = myname.get_name(sim) bases = myname.get_name(sim, box=10) plt.figure(1) for snap in (1, 3, 5): base = dp.PrettyBox(basel, snap, nslice=10) cddf_base = base.column_density_function() ahalo2 = dp.PrettyBox(bases, snap, nslice=10) cddf = ahalo2.column_density_function() plt.semilogx(cddf_base[0], np.log10(cddf[1]/cddf_base[1]), color=colors[snap], ls=lss[snap]) if snap == 3: plt.figure(3) base.plot_column_density(color=colors[sim], ls=lss[sim], moment=True) ahalo2.plot_column_density(color="grey", ls=lss[sim], moment=True) dla_data.column_density_data(moment=True) save_figure(path.join(outdir,"cosmo_res_cddf_z3_abs")) plt.clf() base.plot_halo_hist(Mmin=1e7,color=colors[sim]) ahalo2.plot_halo_hist(Mmin=1e7,color="grey") plt.ylim(0,0.1) save_figure(path.join(outdir,"cosmo_res_halohist")) plt.clf() plt.figure(1) savefile = "boxhi_grid_noH2.hdf5" base = dp.PrettyBox(basel, 3, nslice=10,savefile=savefile) cddf_base = base.column_density_function() savefile = "boxhi_grid_noH2.hdf5" ahalo2 = dp.PrettyBox(bases, 3, nslice=10,savefile=savefile) cddf = ahalo2.column_density_function() plt.semilogx(cddf_base[0], np.log10(cddf[1]/cddf_base[1]), color=colors[0], ls=lss[0]) plt.ylim(-0.5,0.5) save_figure(path.join(outdir,"cosmo_res_cddf_z"+str(sim))) plt.clf()
def plot_UVB_effect(): """Load a simulation and plot its cddf""" for i in (0, 5, 7): halo = myname.get_name(i, True) ahalo = dp.PrettyBox(halo, 3, nslice=10) ahalo.plot_column_density(color=colors[i], ls=lss[i], moment=True) dla_data.column_density_data(moment=True) save_figure(path.join(outdir, "cosmo_UVB_3")) plt.clf()
def plot_UVB_effect(): """Load a simulation and plot its cddf""" for i in (0,5,7): halo = myname.get_name(i, True) ahalo = dp.PrettyBox(halo, 3, nslice=10) ahalo.plot_column_density(color=colors[i], ls=lss[i],moment=True) dla_data.column_density_data(moment=True) save_figure(path.join(outdir, "cosmo_UVB_3")) plt.clf()
def plot_H2_effect(sim, snap): """Load a simulation and plot its cddf""" halo = "Cosmo"+str(sim)+"_V6_512" savefile = path.join(base+halo,"snapdir_"+str(snap).rjust(3,'0'),"boxhi_grid.hdf5") ahalo = dp.PrettyBox(base+halo, snap, nslice=10, savefile=savefile) ahalo.plot_column_density(color="blue", ls="--") del ahalo savefile = path.join(base+halo,"snapdir_"+str(snap).rjust(3,'0'),"boxhi_grid_H2.hdf5") ahalo = dp.PrettyBox(base+halo, snap, nslice=10, savefile=savefile) ahalo.plot_column_density(color="red") dla_data.column_density_data() del ahalo save_figure(path.join(outdir, "cosmo"+str(sim)+"_H2_"+str(snap))) plt.clf()
def plot_grid_res(): """The effect of a finer grid""" halo = myname.get_name(7, True) savefile = "boxhi_grid_cutoff_H2_32678.hdf5" ahalo = dp.PrettyBox(halo, 5, nslice=30, savefile=savefile) ahalo.plot_column_density(color="blue", ls="--", moment=True) # savefile = path.join(halo,"snapdir_003/boxhi_grid_16384.hdf5") ahalo2 = dp.PrettyBox(halo, 5, nslice=10) ahalo2.plot_column_density(color="red", moment=True, ls="-.") dla_data.column_density_data(moment=True) save_figure(path.join(outdir, "cosmo7_grid_5")) plt.clf() cdf1 = ahalo.column_density_function() cdf2 = ahalo2.column_density_function() plt.semilogx(cdf1[0], cdf1[1] / cdf2[1], color="red", ls="-") save_figure(path.join(outdir, "cosmo7_grid_5_rel")) plt.clf()
def plot_grid_res(): """The effect of a finer grid""" halo = myname.get_name(7, True) savefile = "boxhi_grid_cutoff_H2_32678.hdf5" ahalo = dp.PrettyBox(halo, 5, nslice=30, savefile=savefile) ahalo.plot_column_density(color="blue", ls="--", moment=True) # savefile = path.join(halo,"snapdir_003/boxhi_grid_16384.hdf5") ahalo2 = dp.PrettyBox(halo, 5, nslice=10) ahalo2.plot_column_density(color="red",moment=True, ls="-.") dla_data.column_density_data(moment=True) save_figure(path.join(outdir, "cosmo7_grid_5")) plt.clf() cdf1 = ahalo.column_density_function() cdf2 = ahalo2.column_density_function() plt.semilogx(cdf1[0], cdf1[1]/cdf2[1], color="red", ls="-") save_figure(path.join(outdir, "cosmo7_grid_5_rel")) plt.clf()
def plot_rel_res(sim): """Load and make a plot of the difference between two simulations""" basel = myname.get_name(sim) bases = myname.get_name(sim, box=10) plt.figure(1) for snap in (1, 3, 5): base = dp.PrettyBox(basel, snap, nslice=10) cddf_base = base.column_density_function() ahalo2 = dp.PrettyBox(bases, snap, nslice=10) cddf = ahalo2.column_density_function() plt.semilogx(cddf_base[0], np.log10(cddf[1] / cddf_base[1]), color=colors[snap], ls=lss[snap]) if snap == 3: plt.figure(3) base.plot_column_density(color=colors[sim], ls=lss[sim], moment=True) ahalo2.plot_column_density(color="grey", ls=lss[sim], moment=True) dla_data.column_density_data(moment=True) save_figure(path.join(outdir, "cosmo_res_cddf_z3_abs")) plt.clf() base.plot_halo_hist(Mmin=1e7, color=colors[sim]) ahalo2.plot_halo_hist(Mmin=1e7, color="grey") plt.ylim(0, 0.1) save_figure(path.join(outdir, "cosmo_res_halohist")) plt.clf() plt.figure(1) savefile = "boxhi_grid_noH2.hdf5" base = dp.PrettyBox(basel, 3, nslice=10, savefile=savefile) cddf_base = base.column_density_function() savefile = "boxhi_grid_noH2.hdf5" ahalo2 = dp.PrettyBox(bases, 3, nslice=10, savefile=savefile) cddf = ahalo2.column_density_function() plt.semilogx(cddf_base[0], np.log10(cddf[1] / cddf_base[1]), color=colors[0], ls=lss[0]) plt.ylim(-0.5, 0.5) save_figure(path.join(outdir, "cosmo_res_cddf_z" + str(sim))) plt.clf()
def plot_H2_effect(sim, snap): """Load a simulation and plot its cddf""" halo = myname.get_name(sim, True) savefile = "boxhi_grid_noH2.hdf5" ahalo = dp.PrettyBox(halo, snap, nslice=10, savefile=savefile, label=r"No $H_2$") ahalo.plot_column_density(color="blue", ls="--", moment=True) savefile = "boxhi_grid_H2.hdf5" ahalo2 = dp.PrettyBox(halo, snap, nslice=10, savefile=savefile, label=r"$H_2$") ahalo2.plot_column_density(color="red", moment=True) # savefile = path.join(halo,"snapdir_"+str(snap).rjust(3,'0'),"boxhi_grid_H2-old.hdf5") # ahalo2 = dp.PrettyBox(halo, snap, nslice=10, savefile=savefile) # ahalo2.plot_column_density(color="green",moment=True) dla_data.column_density_data(moment=True) # dla_data.noterdaeme_12_data(path.join(path.dirname(__file__),"../dla_data"), moment=True) plt.legend(loc=3) plt.xlim(1e20, 2e22) plt.ylim(1e-5, 0.1) # plt.title("CDDF for "+labels[sim]+" at z="+str(redshifts[snap])) save_figure(path.join(outdir, "cosmo" + str(sim) + "_H2_" + str(snap))) plt.clf() cddf_base = ahalo.column_density_function() cddf = ahalo2.column_density_function() plt.semilogx(cddf_base[0], np.log10(cddf[1] / cddf_base[1]), color=colors[sim], ls=lss[sim]) plt.ylim(-0.5, 0.5) tight_layout_wrapper() ax = plt.gca() ylab = ax.set_ylabel(r"$N_\mathrm{HI} f(N)$") save_figure(path.join(outdir, "cosmo_rel" + str(sim) + "_H2_" + str(snap))) plt.clf()
# save_figure(path.join(outdir, "cosmo_7mass_metal")) # plt.clf() # plot_mass_metal(7,3) # save_figure(path.join(outdir, "cosmo_7mass_metal3")) # plt.clf() # plot_rel_res(5) plot_grid_res() # plot_UVB_effect() plot_all_rho(simlist) # plot_cutoff() #Make a plot of the column density functions. for ss in simlist: #xrange(6): plot_cddf_a_halo(ss, 3) plt.legend(loc=3) dla_data.column_density_data() ax = plt.gca() ylab = ax.set_ylabel(r"$f(N)$") # tight_layout_wrapper() save_figure(path.join(outdir, "cosmo_cddf_z3")) plt.clf() #Plot first moment for zz in (1, 3, 4, 5): for ss in simlist: #xrange(6): if zz == 4 and ss == 3: plot_cddf_a_halo(3, 3, moment=True) else: plot_cddf_a_halo(ss, zz, moment=True)
if len(sys.argv) < 2 or int(sys.argv[1]) == 3: plt.clf() hplots.plot_sigma_DLA() save_figure(path.join(outdir, "sigma_DLA_" + str(snapnum))) plt.clf() hplots.plot_sigma_DLA(17, 20.3) save_figure(path.join(outdir, "sigma_DLA_17_" + str(snapnum))) if len(sys.argv) < 2 or int(sys.argv[1]) == 4: # Fig 12 plt.clf() hplots.plot_column_density() if snapnum == 141: dla_data.column_density_data() save_figure(path.join(outdir, "columden_" + str(snapnum))) plt.clf() hplots.plot_column_density_breakdown() save_figure(path.join(outdir, "columden_break_" + str(snapnum))) # Fig 12 # plt.clf() # hplots.plot_rel_column_density() # plt.ylim(0.5,1.5) # save_figure(path.join(outdir,"columden_rel_"+str(snapnum))) if len(sys.argv) < 2 or int(sys.argv[1]) == 5: # Fig 11 plt.clf()
hspec = ps.PlottingSpectra(zzz[zz], halo) dndx[zz]=hspec.line_density() del hspec except TypeError: pass plt.plot(list(dndx.keys()),list(dndx.values()), color=color) colors = {0:"red", 1:"purple", 2:"blue", 3:"green", 4:"orange"} for i in (0,1,2,3,4): plot_dndx(i,colors[i]) dla_data.dndx_not() save_figure(path.join(outdir,"cosmo_dndx")) plt.clf() for i in (0,1,2,3,4): plot_rho_HI(i,colors[i]) dla_data.omegahi_not() save_figure(path.join(outdir,"cosmo_rhohi")) plt.clf() #Make a plot of the column density functions. for ss in (4,3,2,1,0): plot_cddf_a_halo(ss, 3, color=colors[ss]) dla_data.column_density_data(moment=True) save_figure(path.join(outdir,"cosmo_cddf_z3")) plt.clf()
if len(sys.argv) < 2 or int(sys.argv[1]) == 3: plt.clf() hplots.plot_sigma_DLA() save_figure(path.join(outdir,"sigma_DLA_"+str(snapnum))) plt.clf() hplots.plot_sigma_DLA(17,20.3) save_figure(path.join(outdir,"sigma_DLA_17_"+str(snapnum))) if len(sys.argv) < 2 or int(sys.argv[1]) == 4: #Fig 12 plt.clf() hplots.plot_column_density() if snapnum == 141: dla_data.column_density_data() save_figure(path.join(outdir,"columden_"+str(snapnum))) plt.clf() hplots.plot_column_density_breakdown() save_figure(path.join(outdir,"columden_break_"+str(snapnum))) #Fig 12 # plt.clf() # hplots.plot_rel_column_density() # plt.ylim(0.5,1.5) # save_figure(path.join(outdir,"columden_rel_"+str(snapnum))) if len(sys.argv) < 2 or int(sys.argv[1]) == 5: #Fig 11 plt.clf()