def plot_metallicity(sims, snap): """Plot metallicity, vel width, their correlation and the extra statistics""" out = "cosmo_metallicity_z" + str(snap) for sim in sims: hspec = get_hspec(sim, snap) hspec.plot_metallicity(color=colors[sim], ls=lss[sim]) vel_data.plot_alpha_metal_data(zrange[snap]) plt.legend(loc=2, ncol=3) plt.ylim(0, 2) save_figure(path.join(outdir, out)) plt.clf()
def plot_metallicity(sims, snap): """Plot metallicity, vel width, their correlation and the extra statistics""" out = "cosmo_metallicity_z"+str(snap) for sim in sims: hspec = get_hspec(sim, snap) hspec.plot_metallicity(color=colors[sim], ls=lss[sim]) vel_data.plot_alpha_metal_data(zrange[snap]) plt.legend(loc=2,ncol=3) plt.ylim(0,2) save_figure(path.join(outdir,out)) plt.clf()
def plot_metal_ion_corr(sim, snap,species="Si",ion=2): """Plot metallicity from Z/H vs from a single species for computing ionisation corrections""" halo = myname.get_name(sim) hspec = ps.VWPlotSpectra(snap, halo) hspec.plot_metallicity(color="red", ls="-") hspec.plot_species_metallicity(species, ion, color="blue", ls="-") vel_data.plot_alpha_metal_data((3.5,2.5)) save_figure(path.join(outdir, "cosmo_metallicity"+str(sim)+"_ion_corr"+str(snap))) plt.clf() hspec.plot_ion_corr(species, ion) save_figure(path.join(outdir, "cosmo_metallicity"+str(sim)+"_rel_ion_corr"+str(snap))) plt.clf()
def plot_metal_ion_corr(sim, snap, species="Si", ion=2): """Plot metallicity from Z/H vs from a single species for computing ionisation corrections""" halo = myname.get_name(sim) hspec = ps.VWPlotSpectra(snap, halo) hspec.plot_metallicity(color="red", ls="-") hspec.plot_species_metallicity(species, ion, color="blue", ls="-") vel_data.plot_alpha_metal_data((3.5, 2.5)) save_figure( path.join(outdir, "cosmo_metallicity" + str(sim) + "_ion_corr" + str(snap))) plt.clf() hspec.plot_ion_corr(species, ion) save_figure( path.join(outdir, "cosmo_metallicity" + str(sim) + "_rel_ion_corr" + str(snap))) plt.clf()
def plot_metallicity(sim, snap): """Plot a spectrum""" halo = "modified_128_a" + str(sim) + "_b1" out = "cosmo" + str(sim) + "_metallicity_z" + str(snap) #Load from a save file only hspec = ps.VWPlotSpectra(snap, base + halo, None, None) hspec.plot_metallicity() vel_data.plot_alpha_metal_data(zrange[snap]) save_figure(path.join(outdir, out)) plt.clf() out = "cosmo" + str(sim) + "_correlation_z" + str(snap) hspec.plot_Z_vs_vel_width() vel_data.plot_prochaska_2008_correlation() save_figure(path.join(outdir, out)) hspec.save_file() plt.clf()
def plot_metallicity(sim, snap): """Plot a spectrum""" halo = "modified_128_a"+str(sim)+"_b1" out = "cosmo"+str(sim)+"_metallicity_z"+str(snap) #Load from a save file only hspec = ps.VWPlotSpectra(snap, base+halo, None, None) hspec.plot_metallicity() vel_data.plot_alpha_metal_data(zrange[snap]) save_figure(path.join(outdir,out)) plt.clf() out = "cosmo"+str(sim)+"_correlation_z"+str(snap) hspec.plot_Z_vs_vel_width() vel_data.plot_prochaska_2008_correlation() save_figure(path.join(outdir,out)) hspec.save_file() plt.clf()
def plot_metal_ion_corr(sim, snap,species="Si",ion=2, dla=True, othersave="boxhi_grid_H2_no_atten.hdf5"): """Plot metallicity from GFM_Metallicity vs from a single species for computing ionisation corrections""" halo = myname.get_name(sim) ahalo = dp.PrettyBox(halo, snap, nslice=10, label=labels[sim]) ahalo.plot_dla_metallicity(color="red",ls="--") ahalo.plot_species_fraction(species, ion, dla, color="blue", ls="-") ahalo_no_atten = dp.PrettyBox(halo, snap, nslice=10, label=labels[sim],savefile=othersave) ahalo_no_atten.plot_species_fraction(species, ion, dla, color="green", ls="-.") vel_data.plot_alpha_metal_data((3.5,2.5)) save_figure(path.join(outdir, "cosmo"+str(sim)+"_ion_corr"+str(snap))) plt.clf() ahalo.plot_ion_corr(species, ion, dla,upper=1,lower=-1) ahalo_no_atten.plot_ion_corr(species, ion, dla,color="green",ls="--",upper=1,lower=-1) save_figure(path.join(outdir, "cosmo"+str(sim)+"_rel_ion_corr"+str(snap))) plt.clf() del ahalo
def plot_metal_ion_corr(sim, snap, species="Si", ion=2, dla=True, othersave="boxhi_grid_H2_no_atten.hdf5"): """Plot metallicity from GFM_Metallicity vs from a single species for computing ionisation corrections""" halo = myname.get_name(sim) ahalo = dp.PrettyBox(halo, snap, nslice=10, label=labels[sim]) ahalo.plot_dla_metallicity(color="red", ls="--") ahalo.plot_species_fraction(species, ion, dla, color="blue", ls="-") ahalo_no_atten = dp.PrettyBox(halo, snap, nslice=10, label=labels[sim], savefile=othersave) ahalo_no_atten.plot_species_fraction(species, ion, dla, color="green", ls="-.") vel_data.plot_alpha_metal_data((3.5, 2.5)) save_figure(path.join(outdir, "cosmo" + str(sim) + "_ion_corr" + str(snap))) plt.clf() ahalo.plot_ion_corr(species, ion, dla, upper=1, lower=-1) ahalo_no_atten.plot_ion_corr(species, ion, dla, color="green", ls="--", upper=1, lower=-1) save_figure( path.join(outdir, "cosmo" + str(sim) + "_rel_ion_corr" + str(snap))) plt.clf() del ahalo
#Make a plot of the effect of modifying the minimum velocity for ss in (0, 1, 5): plot_cddf_a_halo(ss, 3, moment=True) dla_data.column_density_data(moment=True) plt.xlim(1e17, 3e22) plt.ylim(1e-4, 0.3) save_figure(path.join(outdir, "cosmo_cddf_minvel_z3")) plt.clf() #Metallicity for zz in (1, 3, 5): zrange = {1: (7, 3.5), 3: (3.5, 2.5), 5: (2.5, 1.5)} for ss in simlist: #xrange(6): plot_metal_halo(ss, zz) vel_data.plot_alpha_metal_data(zrange[zz]) plt.legend(loc=2) plt.ylim(0, 1.45) plt.xlim(-3, 0) plt.title("DLA metallicity at z=" + str(redshifts[zz])) save_figure(path.join(outdir, "cosmo_metal_z" + str(zz))) plt.clf() #LLS Metallicity for zz in (1, 3, 5): for ss in simlist + (4, 6): plot_metal_halo(ss, zz, lls=True) plt.legend(loc=2, ncol=3) plt.ylim(0, 1.2) save_figure(path.join(outdir, "cosmo_lls_metal_z" + str(zz))) plt.clf()
#Make a plot of the effect of modifying the minimum velocity for ss in (0,1,5): plot_cddf_a_halo(ss, 3, moment=True) dla_data.column_density_data(moment=True) plt.xlim(1e17,3e22) plt.ylim(1e-4,0.3) save_figure(path.join(outdir,"cosmo_cddf_minvel_z3")) plt.clf() #Metallicity for zz in (1,3,5): zrange = {1:(7,3.5), 3:(3.5,2.5), 5:(2.5,1.5)} for ss in simlist: #xrange(6): plot_metal_halo(ss, zz) vel_data.plot_alpha_metal_data(zrange[zz]) plt.legend(loc=2) plt.ylim(0,1.45) plt.xlim(-3,0) plt.title("DLA metallicity at z="+str(redshifts[zz])) save_figure(path.join(outdir,"cosmo_metal_z"+str(zz))) plt.clf() #LLS Metallicity for zz in (1,3,5): for ss in simlist+(4,6): plot_metal_halo(ss, zz, lls=True) plt.legend(loc=2, ncol=3) plt.ylim(0,1.2) save_figure(path.join(outdir,"cosmo_lls_metal_z"+str(zz)))