Exemplo n.º 1
0
def plot_all_rho(simlist):
    """Make the rho_HI plot with labels etc"""
    #Cosmo0
    for i in simlist:   #xrange(8):
        (zzz,dndx,omegadla) = get_rhohi_dndx(i)
        plt.figure(1)
        plt.plot(zzz,dndx, 'o', color=colors[i], ls=lss[i], label=labels[i])
        plt.figure(2)
        plt.plot(zzz,omegadla, 'o', color=colors[i], ls=lss[i],label=labels[i])
    plt.figure(1)
    plt.xlabel("z")
    plt.ylabel(r"$dN / dX$")
    dla_data.dndx_not()
    dla_data.dndx_pro()
    plt.xlim(2,4)
    plt.ylim(0,0.13)
    plt.legend(loc=4, ncol=3)
    tight_layout_wrapper()
    save_figure(path.join(outdir,"cosmo_dndx"))
    plt.clf()

    plt.figure(2)
    plt.xlabel("z")
    plt.ylabel(r"$10^3 \Omega_\mathrm{DLA}$")
    dla_data.omegahi_not()
#     dla_data.omegahi_pro()
    plt.xlim(2,4)
    plt.ylim(0,2.)
    plt.legend(loc=4, ncol=3)
    tight_layout_wrapper()
    save_figure(path.join(outdir,"cosmo_rhohi"))
    plt.clf()
Exemplo n.º 2
0
def plot_omegahi_breakdown(sim):
    """Make the rho_HI plot with labels etc"""
    halo = myname.get_name(sim, True, 25)
    snaps = {4:1, 3.5:2, 3:3, 2.5:4, 2:5}
    fractions=[]
    zzz = []
    omegadla = []
    for zzzz in (4, 3.5, 3, 2.5, 2):
        ahalo = dp.PrettyBox(halo, snaps[zzzz], nslice=10)
        (massbins, fracs) = ahalo.get_omega_hi_mass_breakdown()
        fractions.append(fracs)
        zzz.append(zzzz)
        omegadla.append(ahalo.omega_DLA())
    fractions = np.array(fractions)
    for i in xrange(np.size(fractions[0,:])-2):
        plt.plot(zzz,fractions[:,i+1], 'o', color=colors[i], ls=lss[i], label=dp.pr_num(np.log10(massbins[i]))+" - "+dp.pr_num(np.log10(massbins[i+1])))
    plt.plot(zzz,fractions[:,-1], 'o', color=colors[6], ls=lss[6], label="Field")
    plt.plot(zzz,omegadla, 'o', color=colors[sim], ls=lss[sim], label="Total")
    plt.xlabel("z")
    plt.ylabel(r"$10^3 \Omega_\mathrm{DLA}$")
    dla_data.omegahi_not()
    plt.xlim(2,4)
    plt.ylim(0,2.3)
    plt.legend(loc=1, ncol=2)
    tight_layout_wrapper()
    save_figure(path.join(outdir,"cosmo_rhohi_break"+str(sim)))
    plt.clf()
Exemplo n.º 3
0
def plot_all_rho():
    """Make the rho_HI plot with labels etc"""
    #Cosmo0
    zzz0= [4, 3, 2]
    dndx0= [0.12982373590447616, 0.11318656438441635, 0.14167778407440484]
    omega0= [1.1295349304295403, 1.0832253887624965, 1.4772732823119952]
    #Cosmo2
    zzz2= [4, 3.5, 3, 2.5, 2]
    dndx2= [0.081675998741546157, 0.071281732587967661, 0.061506461643187245, 0.061143942748744885, 0.063275568]
    omega2= [0.76470263480711975, 0.69383248829835542, 0.64764348287042328, 0.6917879571651826, 0.7428807770637]
    #Cosmo3
    zzz3= [4, 3, 2]
    dndx3= [0.11528106522481622, 0.11797023730537365, 0.12545022290952848]
    omega3= [1.7090510472291021, 1.8510973567379598, 1.9917860682826971]

    #for i in (0,2,3):
    #    (zzz,dndx,rhohi) = plot_rhohi_dndx(i)
    #    plt.figure(1)
    #    print "zzz=",zzz
    #    print "dndx=",dndx
    #    print "omega=",rhohi
    #    plt.plot(zzz,dndx, color=colors[sim], ls=lss[sim])
    #    plt.figure(2)
    #    plt.plot(zzz,rhohi, color=colors[sim], ls=lss[sim])

    plt.figure(1)
    plt.plot(zzz0,dndx0, color=colors[0], ls=lss[0])
    plt.plot(zzz2,dndx2, color=colors[2], ls=lss[2])
    plt.plot(zzz3,dndx3, color=colors[3], ls=lss[3])
    plt.xlabel("z")
    plt.ylabel(r"$dN / dX$")
    dla_data.dndx_not()
    dla_data.dndx_pro()
    save_figure(path.join(outdir,"cosmo_dndx"))
    plt.clf()

    plt.figure(2)
    plt.plot(zzz0,omega0, color=colors[0], ls=lss[0])
    plt.plot(zzz2,omega2, color=colors[2], ls=lss[2])
    plt.plot(zzz3,omega3, color=colors[3], ls=lss[3])
    plt.xlabel("z")
    plt.ylabel(r"$10^3 \Omega_\mathrm{DLA}$")
    dla_data.omegahi_not()
    dla_data.omegahi_pro()
    save_figure(path.join(outdir,"cosmo_rhohi"))
    plt.clf()
def plot_omegahi_breakdown(sim):
    """Make the rho_HI plot with labels etc"""
    halo = myname.get_name(sim, True, 25)
    snaps = {4: 1, 3.5: 2, 3: 3, 2.5: 4, 2: 5}
    fractions = []
    zzz = []
    omegadla = []
    for zzzz in (4, 3.5, 3, 2.5, 2):
        ahalo = dp.PrettyBox(halo, snaps[zzzz], nslice=10)
        (massbins, fracs) = ahalo.get_omega_hi_mass_breakdown()
        fractions.append(fracs)
        zzz.append(zzzz)
        omegadla.append(ahalo.omega_DLA())
    fractions = np.array(fractions)
    for i in xrange(np.size(fractions[0, :]) - 2):
        plt.plot(zzz,
                 fractions[:, i + 1],
                 'o',
                 color=colors[i],
                 ls=lss[i],
                 label=dp.pr_num(np.log10(massbins[i])) + " - " +
                 dp.pr_num(np.log10(massbins[i + 1])))
    plt.plot(zzz,
             fractions[:, -1],
             'o',
             color=colors[6],
             ls=lss[6],
             label="Field")
    plt.plot(zzz, omegadla, 'o', color=colors[sim], ls=lss[sim], label="Total")
    plt.xlabel("z")
    plt.ylabel(r"$10^3 \Omega_\mathrm{DLA}$")
    dla_data.omegahi_not()
    plt.xlim(2, 4)
    plt.ylim(0, 2.3)
    plt.legend(loc=1, ncol=2)
    tight_layout_wrapper()
    save_figure(path.join(outdir, "cosmo_rhohi_break" + str(sim)))
    plt.clf()
def plot_all_rho(simlist):
    """Make the rho_HI plot with labels etc"""
    #Cosmo0
    for i in simlist:  #xrange(8):
        (zzz, dndx, omegadla) = get_rhohi_dndx(i)
        plt.figure(1)
        plt.plot(zzz, dndx, 'o', color=colors[i], ls=lss[i], label=labels[i])
        plt.figure(2)
        plt.plot(zzz,
                 omegadla,
                 'o',
                 color=colors[i],
                 ls=lss[i],
                 label=labels[i])
    plt.figure(1)
    plt.xlabel("z")
    plt.ylabel(r"$dN / dX$")
    dla_data.dndx_not()
    dla_data.dndx_pro()
    plt.xlim(2, 4)
    plt.ylim(0, 0.13)
    plt.legend(loc=4, ncol=3)
    tight_layout_wrapper()
    save_figure(path.join(outdir, "cosmo_dndx"))
    plt.clf()

    plt.figure(2)
    plt.xlabel("z")
    plt.ylabel(r"$10^3 \Omega_\mathrm{DLA}$")
    dla_data.omegahi_not()
    #     dla_data.omegahi_pro()
    plt.xlim(2, 4)
    plt.ylim(0, 2.)
    plt.legend(loc=4, ncol=3)
    tight_layout_wrapper()
    save_figure(path.join(outdir, "cosmo_rhohi"))
    plt.clf()
Exemplo n.º 6
0
            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()

Exemplo n.º 7
0
def do_data_plots(cat, subdir):
    """Make a set of plots"""
    dla_data.noterdaeme_12_data()
    (l_N, cddf, cddf68, cddf95) = cat.plot_cddf(zmax=5, color="blue")
    np.savetxt(
        path.join(subdir, "cddf_all.txt"),
        (l_N, cddf, cddf68[:, 0], cddf68[:, 1], cddf95[:, 0], cddf95[:, 1]))
    plt.xlim(1e20, 1e23)
    plt.ylim(1e-28, 5e-21)
    plt.legend(loc=0)
    save_figure(path.join(subdir, "cddf_gp"))
    plt.clf()

    (l_N, cddf, cddf68, cddf95) = cat.plot_cddf(zmax=5,
                                                color="blue",
                                                moment=True)
    plt.xlim(1e20, 1e23)
    plt.legend(loc=0)
    save_figure(path.join(subdir, "cddf_moment_gp"))
    plt.clf()

    #Evolution with redshift
    (l_N, cddf, cddf68, cddf95) = cat.plot_cddf(4,
                                                5,
                                                label="4-5",
                                                color="brown")
    np.savetxt(
        path.join(subdir, "cddf_z45.txt"),
        (l_N, cddf, cddf68[:, 0], cddf68[:, 1], cddf95[:, 0], cddf95[:, 1]))
    (l_N, cddf, cddf68, cddf95) = cat.plot_cddf(3,
                                                4,
                                                label="3-4",
                                                color="black")
    np.savetxt(
        path.join(subdir, "cddf_z34.txt"),
        (l_N, cddf, cddf68[:, 0], cddf68[:, 1], cddf95[:, 0], cddf95[:, 1]))
    (l_N, cddf, cddf68, cddf95) = cat.plot_cddf(2.5,
                                                3,
                                                label="2.5-3",
                                                color="green")
    np.savetxt(
        path.join(subdir, "cddf_z253.txt"),
        (l_N, cddf, cddf68[:, 0], cddf68[:, 1], cddf95[:, 0], cddf95[:, 1]))
    (l_N, cddf, cddf68, cddf95) = cat.plot_cddf(2,
                                                2.5,
                                                label="2-2.5",
                                                color="blue")
    np.savetxt(
        path.join(subdir, "cddf_z225.txt"),
        (l_N, cddf, cddf68[:, 0], cddf68[:, 1], cddf95[:, 0], cddf95[:, 1]))
    plt.xlim(1e20, 1e23)
    plt.ylim(1e-28, 5e-21)
    plt.legend(loc=0)
    save_figure(path.join(subdir, "cddf_zz_gp"))
    plt.clf()

    #dNdX
    dla_data.dndx_not()
    dla_data.dndx_pro()
    (z_cent, dNdX, dndx68, dndx95) = cat.plot_line_density(zmax=5)
    np.savetxt(
        path.join(subdir, "dndx_all.txt"),
        (z_cent, dNdX, dndx68[:, 0], dndx68[:, 1], dndx95[:, 0], dndx95[:, 1]))
    plt.legend(loc=0)
    plt.ylim(0, 0.16)
    save_figure(path.join(subdir, "dndx_gp"))
    plt.clf()

    #Omega_DLA
    dla_data.omegahi_not()
    dla_data.omegahi_pro()
    dla_data.crighton_omega()
    (z_cent, omega_dla, omega_dla_68,
     omega_dla_95) = cat.plot_omega_dla(zmax=5)
    #     cat.tophat_prior = True
    #     cat.plot_omega_dla(zmax=5, label="Tophat Prior", twosigma=False)
    #     cat.tophat_prior = False
    np.savetxt(path.join(subdir, "omega_dla_all.txt"),
               (z_cent, omega_dla, omega_dla_68[:, 0], omega_dla_68[:, 1],
                omega_dla_95[:, 0], omega_dla_95[:, 1]))
    plt.legend(loc=0)
    plt.xlim(2, 5)
    plt.ylim(0, 2.5)
    save_figure(path.join(subdir, "omega_gp"))
    plt.clf()