def plot_dndx_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(False)
        fractions.append(fracs)
        zzz.append(zzzz)
        omegadla.append(ahalo.line_density())
    fractions = np.array(fractions)
    for i in xrange(np.size(fractions[0, :]) - 2):
        plt.plot(zzz,
                 fractions[:, i + 1],
                 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], color=colors[6], ls=lss[6], label="Field")
    plt.plot(zzz, omegadla, color=colors[sim], ls=lss[sim], label="Total")
    plt.xlabel("z")
    plt.ylabel(r"$dN/dX$")
    dla_data.dndx_not()
    dla_data.dndx_pro()
    plt.xlim(2, 4)
    plt.ylim(0, 0.15)
    plt.legend(loc=1, ncol=2)
    tight_layout_wrapper()
    save_figure(path.join(outdir, "cosmo_dndx_break" + str(sim)))
    plt.clf()
def plot_halos(sim, hh):
    """Plot the halo closest in mass and position in the given sim to the halo of the given number in sim 7."""
    ahalo = dp.PrettyHalo(myname.get_name(sim), 3, 20000)
    ahalo7 = dp.PrettyHalo(myname.get_name(7), 3, 20000)
    (mass, cofm, radii) = _load_halo(ahalo, 30)
    (mass7, cofm7, _) = _load_halo(ahalo7, 30)
    dist = np.sum((cofm7[hh] - cofm)**2, axis=1)
    nn = np.where(dist == np.min(dist))
    rhh = hh
    hh = np.ravel(nn)[0]
    print "Requested: ", rhh, "Got: ", hh, " dist:", np.sqrt(
        dist[nn]), " r-mass:", mass[hh] / mass7[rhh], "ormass: ", mass7[rhh]
    plt.title(r"Central Halo: $" +
              dp.pr_num(ahalo.sub_mass[hh] / 0.72 / 1e11) +
              r"\times 10^{11} M_\odot$")
    ahalo.plot_pretty_halo(hh)
    #Backwards because someone is a fortran programmer
    circle = plt.Circle((0, 0), radii[hh], color="black", fill=False)
    ax = plt.gca()
    ax.add_artist(circle)
    #     plot_rvir(ahalo.sub_cofm[hh], cofm, radii,ahalo.sub_radii[hh])
    dp.tight_layout_wrapper()
    save_figure(path.join(outdir, "pretty_" + str(sim) + "_halo_" + str(rhh)))
    plt.clf()
    ahalo.plot_pretty_cut_halo(hh)
    circle = plt.Circle((0, 0), radii[hh], color="black", fill=False)
    ax = plt.gca()
    ax.add_artist(circle)
    #     plot_rvir(ahalo.sub_cofm[hh], cofm, radii,ahalo.sub_radii[hh]/)
    plt.title(labels[sim] + " at z=3")
    dp.tight_layout_wrapper()
    save_figure(
        path.join(outdir, "pretty_cut_" + str(sim) + "_halo_" + str(rhh)))
    plt.clf()
    del ahalo
Example #3
0
def plot_halos(sim,hh):
    """Plot the halo closest in mass and position in the given sim to the halo of the given number in sim 7."""
    ahalo = dp.PrettyHalo(myname.get_name(sim),3,20000)
    ahalo7 = dp.PrettyHalo(myname.get_name(7),3,20000)
    (mass, cofm, radii) = _load_halo(ahalo, 30)
    (mass7, cofm7, _) = _load_halo(ahalo7, 30)
    dist = np.sum((cofm7[hh] - cofm)**2, axis=1)
    nn = np.where( dist == np.min(dist))
    rhh = hh
    hh = np.ravel(nn)[0]
    print "Requested: ",rhh,"Got: ",hh," dist:",np.sqrt(dist[nn])," r-mass:",mass[hh]/mass7[rhh], "ormass: ",mass7[rhh]
    plt.title(r"Central Halo: $"+dp.pr_num(ahalo.sub_mass[hh]/0.72/1e11)+r"\times 10^{11} M_\odot$")
    ahalo.plot_pretty_halo(hh)
    #Backwards because someone is a fortran programmer
    circle=plt.Circle((0,0),radii[hh],color="black",fill=False)
    ax = plt.gca()
    ax.add_artist(circle)
#     plot_rvir(ahalo.sub_cofm[hh], cofm, radii,ahalo.sub_radii[hh])
    dp.tight_layout_wrapper()
    save_figure(path.join(outdir,"pretty_"+str(sim)+"_halo_"+str(rhh)))
    plt.clf()
    ahalo.plot_pretty_cut_halo(hh)
    circle=plt.Circle((0,0),radii[hh],color="black",fill=False)
    ax = plt.gca()
    ax.add_artist(circle)
#     plot_rvir(ahalo.sub_cofm[hh], cofm, radii,ahalo.sub_radii[hh]/)
    plt.title(labels[sim]+" at z=3")
    dp.tight_layout_wrapper()
    save_figure(path.join(outdir,"pretty_cut_"+str(sim)+"_halo_"+str(rhh)))
    plt.clf()
    del ahalo
Example #4
0
def plot_dndx_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(False)
        fractions.append(fracs)
        zzz.append(zzzz)
        omegadla.append(ahalo.line_density())
    fractions = np.array(fractions)
    for i in xrange(np.size(fractions[0,:])-2):
        plt.plot(zzz,fractions[:,i+1], 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], color=colors[6], ls=lss[6], label="Field")
    plt.plot(zzz,omegadla, color=colors[sim], ls=lss[sim], label="Total")
    plt.xlabel("z")
    plt.ylabel(r"$dN/dX$")
    dla_data.dndx_not()
    dla_data.dndx_pro()
    plt.xlim(2,4)
    plt.ylim(0,0.15)
    plt.legend(loc=1, ncol=2)
    tight_layout_wrapper()
    save_figure(path.join(outdir,"cosmo_dndx_break"+str(sim)))
    plt.clf()
Example #5
0
    print "Saving plots for snapshot ", snapnum, " to ", outdir

    plt.figure(1)

    # Load only the nHI grids
    hplots = dp.HaloHIPlots(base, snapnum, minpart=minpart)

    if len(sys.argv) < 2 or int(sys.argv[1]) == 2:
        # low-mass halo radial profile
        hplots.plot_radial_profile(minM=3e9, maxM=3.5e9, maxR=10.0)
        plt.ylim(ymax=27)
        save_figure(path.join(outdir, "radial_profile_halo_low_" + str(snapnum)))
        plt.clf()

        hplots.ahalo.plot_pretty_halo(0)
        plt.title(r"Arepo, $\mathrm{z}=" + dp.pr_num(hplots.ahalo.redshift, 1) + "$")
        dp.tight_layout_wrapper()
        save_figure(path.join(outdir, "Arepo_" + str(snapnum) + "pretty_halo"))
        plt.clf()
        # Get the right halo
        g_halo_0 = hplots.ghalo.identify_eq_halo(hplots.ahalo.sub_mass[0], hplots.ahalo.sub_cofm[0, :], maxpos=50.0)[0]
        try:
            a_shalo = np.min(np.where(hplots.ahalo.sub_mass < 1e10))
            # Get the right halo for a smaller halo
            s_mass = hplots.ahalo.sub_mass[a_shalo]
            s_pos = hplots.ahalo.sub_cofm[a_shalo, :]
            g_shalo = hplots.ghalo.identify_eq_halo(s_mass, s_pos)
            # Make sure it has a gadget counterpart
            if np.size(g_shalo) == 0:
                nosmall = 1
                for i in np.where(hplots.ahalo.sub_mass < 1e10)[0]:
Example #6
0
    print "Saving plots for snapshot ",snapnum," to ",outdir

    plt.figure(1)

    #Load only the nHI grids
    hplots=dp.HaloHIPlots(base,snapnum,minpart=minpart)

    if len(sys.argv) < 2 or int(sys.argv[1]) == 2:
        #low-mass halo radial profile
        hplots.plot_radial_profile(minM=3e9, maxM=3.5e9,maxR=10.)
        plt.ylim(ymax = 27)
        save_figure(path.join(outdir,"radial_profile_halo_low_"+str(snapnum)))
        plt.clf()

        hplots.ahalo.plot_pretty_halo(0)
        plt.title(r"Arepo, $\mathrm{z}="+dp.pr_num(hplots.ahalo.redshift,1)+"$")
        dp.tight_layout_wrapper()
        save_figure(path.join(outdir,"Arepo_"+str(snapnum)+"pretty_halo"))
        plt.clf()
        #Get the right halo
        g_halo_0 = hplots.ghalo.identify_eq_halo(hplots.ahalo.sub_mass[0],hplots.ahalo.sub_cofm[0,:],maxpos=50.)[0]
        try:
            a_shalo=np.min(np.where(hplots.ahalo.sub_mass < 1e10))
            #Get the right halo for a smaller halo
            s_mass=hplots.ahalo.sub_mass[a_shalo]
            s_pos=hplots.ahalo.sub_cofm[a_shalo,:]
            g_shalo = hplots.ghalo.identify_eq_halo(s_mass,s_pos)
            #Make sure it has a gadget counterpart
            if np.size(g_shalo) == 0:
                nosmall=1
                for i in np.where(hplots.ahalo.sub_mass < 1e10)[0]: