示例#1
0
def plot_mass_cosmic_density(plt, outdir, redshifts, mcold, mHI, mH2):

    fig = plt.figure(figsize=(5, 4.5))

    ax = fig.add_subplot(111)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    xtit = "$\\rm Lookback\,time/Gyr$"
    ytit = "$\\rm log_{10}(\\Omega_{\\rm gas})$"
    common.prepare_ax(ax,
                      0,
                      13.5,
                      -4,
                      -2.7,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))
    ax2 = ax.twiny()
    ax2.set_xlim(ax.get_xlim())
    new_tick_locations = np.array([0., 2., 4., 6., 8., 10., 12.])

    ax2.set_xticks(new_tick_locations)
    ax2.set_xticklabels(us.redshift(new_tick_locations), fontsize=12)

    ax2.set_xlabel("redshift", fontsize=13)

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ax.plot(us.look_back_time(redshifts),
            mcold + np.log10(Omegab) - np.log10(XH),
            'k',
            label='total neutral ISM')
    ax.plot(us.look_back_time(redshifts),
            mHI + np.log10(Omegab) - np.log10(XH),
            'b',
            linestyle='dotted',
            label='atomic')
    ax.plot(us.look_back_time(redshifts),
            mH2 + np.log10(Omegab) - np.log10(XH),
            'r',
            linestyle='dashed',
            label='molecular')

    common.prepare_legend(ax, ['k', 'b', 'r'], loc=1)
    common.savefig(outdir, fig, "omega_neutral.pdf")
示例#2
0
def plot_omega_h2(plt, outdir, obsdir, redshifts, h0, mH2den):

    fig = plt.figure(figsize=(5, 4.5))

    ax = fig.add_subplot(111)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    xtit = "$\\rm Lookback\, time/Gyr$"
    ytit = "$\\rm log_{10}(\\rho_{\\rm H_2}/ M_{\odot}\,cMpc^{-3})$"
    common.prepare_ax(ax,
                      0,
                      13.5,
                      6.2,
                      8.4,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))

    ax2 = ax.twiny()
    ax2.set_xlim(ax.get_xlim())
    new_tick_locations = np.array([0., 2., 4., 6., 8., 10., 12.])

    ax2.set_xticks(new_tick_locations)
    ax2.set_xticklabels(us.redshift(new_tick_locations), fontsize=12)

    ax2.set_xlabel("redshift", fontsize=13)

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(mH2den > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(mH2den[ind] * pow(h0, 2.0)) + np.log10(XH), 'r')

    z, h2_modelvar = common.load_observation(
        obsdir, 'Models/SharkVariations/Global_OtherModels.dat', [0, 2])
    h2_modelvar_burst3 = h2_modelvar[0:179]
    h2_modelvar_nu0p5 = h2_modelvar[181:360]
    h2_modelvar_burst20 = h2_modelvar[360:539]

    ind = np.where(h2_modelvar_burst20 > -10)
    ax.plot(us.look_back_time(z[ind]),
            h2_modelvar_burst20[ind],
            'Sienna',
            linestyle='dotted')
    ind = np.where(h2_modelvar_burst3 > -10)
    ax.plot(us.look_back_time(z[ind]),
            h2_modelvar_burst3[ind],
            'Crimson',
            linestyle='dashdot')
    ind = np.where(h2_modelvar_nu0p5 > -10)
    ax.plot(us.look_back_time(z[ind]),
            h2_modelvar_nu0p5[ind],
            'Salmon',
            linestyle='dotted')

    #Walter ASPECS ALMA program
    zD16, zloD16, zupD16, rhoH2D16, rhoH2loD16, rhoH2upD16 = common.load_observation(
        obsdir, 'Global/Walter17_H2.dat', [0, 1, 2, 3, 4, 5])

    hobs = 0.7

    xobs = zD16
    errxlow = zD16 - zloD16
    errxup = zupD16 - zD16
    yobs = np.log10(rhoH2D16) + np.log10(pow(hobs / h0, 3.0))
    errylow = np.log10(rhoH2D16) - np.log10(rhoH2loD16)
    erryup = np.log10(rhoH2upD16) - np.log10(rhoH2D16)

    ax.errorbar(us.look_back_time(xobs),
                yobs,
                xerr=[errxlow, errxup],
                yerr=[errylow, erryup],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='+',
                label="Decarli+16")
    ax.errorbar(us.look_back_time(xobs[0:1]),
                yobs[0:1],
                xerr=[errxlow[0:1], errxup[0:1]],
                yerr=[errylow[0:1], erryup[0:1]],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o',
                label="Boselli+14")

    # Legend
    common.prepare_legend(ax, ['grey', 'grey', 'grey'], loc=0)

    common.savefig(outdir, fig, "omega_H2.pdf")
示例#3
0
def plot_stellar_mass_cosmic_density(plt, outdir, obsdir, redshifts, h0,
                                     mstarden, mstarbden_mergers,
                                     mstarbden_diskins):

    # Plots stellar mass cosmic density
    xtit = "$\\rm redshift$"
    ytit = "$\\rm log_{10}(\\rho_{\\rm star}/ M_{\odot}\,cMpc^{-3})$"

    fig = plt.figure(figsize=(5, 9))
    ax = fig.add_subplot(211)
    plt.subplots_adjust(left=0.15)

    common.prepare_ax(ax, 0, 10, 5, 8.7, xtit, ytit, locators=(0.1, 1, 0.1, 1))

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(mstarden > 0)
    ax.plot(redshifts[ind], np.log10(mstarden[ind] * pow(h0, 2.0)), 'k')

    ind = np.where(mstarbden_mergers > 0)
    ax.plot(redshifts[ind],
            np.log10(mstarbden_mergers[ind] * pow(h0, 2.0)),
            'r',
            linestyle='dashed')
    ind = np.where(mstarbden_diskins > 0)
    ax.plot(redshifts[ind],
            np.log10(mstarbden_diskins[ind] * pow(h0, 2.0)),
            'b',
            linestyle='dotted')

    z, sm_modelvar = common.load_observation(
        obsdir, 'Models/SharkVariations/Global_OtherModels.dat', [0, 4])
    sm_modelvar_burst3 = sm_modelvar[0:179]
    sm_modelvar_nu0p5 = sm_modelvar[181:360]
    sm_modelvar_burst20 = sm_modelvar[360:539]

    ind = np.where(sm_modelvar_burst20 > -10)
    ax.plot(z[ind], sm_modelvar_burst20[ind], 'Sienna', linestyle='dotted')
    ind = np.where(sm_modelvar_burst3 > -10)
    ax.plot(z[ind],
            sm_modelvar_burst3[ind],
            'DarkSlateGray',
            linestyle='dashdot')
    ind = np.where(sm_modelvar_nu0p5 > -10)
    ax.plot(z[ind], sm_modelvar_nu0p5[ind], 'SlateGray', linestyle='dotted')

    #Baldry (Chabrier IMF), ['Baldry+2012, z<0.06']
    redD17d, redD17u, smdD17, err1, err2, err3, err4 = common.load_observation(
        obsdir, 'Global/Driver18_smd.dat', [1, 2, 3, 4, 5, 6, 7])

    hobs = 0.7
    xobs = (redD17d + redD17u) / 2.0
    yobs = smdD17 + np.log10(hobs / h0)

    err = yobs * 0. - 999.
    err = np.sqrt(
        pow(err1, 2.0) + pow(err2, 2.0) + pow(err3, 2.0) + pow(err4, 2.0))
    ax.errorbar(xobs,
                yobs,
                yerr=[err, err],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o',
                label="Driver+18")

    common.prepare_legend(ax, ['grey'], loc=3)

    xtit = "$\\rm Lookback\, time/Gyr$"
    ax = fig.add_subplot(212)
    plt.subplots_adjust(left=0.15)
    common.prepare_ax(ax,
                      0,
                      13.5,
                      5,
                      8.7,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(mstarden > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(mstarden[ind] * pow(h0, 2.0)),
            'k',
            label='Shark all galaxies')

    ind = np.where(mstarbden_mergers > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(mstarbden_mergers[ind] * pow(h0, 2.0)),
            'r',
            linestyle='dashed',
            label='formed in galaxy mergers')
    ind = np.where(mstarbden_diskins > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(mstarbden_diskins[ind] * pow(h0, 2.0)),
            'b',
            linestyle='dotted',
            label='formed in disk instabilities')

    ind = np.where(sm_modelvar_burst20 > -10)
    ax.plot(us.look_back_time(z[ind]),
            sm_modelvar_burst20[ind],
            'Sienna',
            linestyle='dotted',
            label='$\\eta_{\\rm burst}=20$')
    ind = np.where(sm_modelvar_burst3 > -10)
    ax.plot(us.look_back_time(z[ind]),
            sm_modelvar_burst3[ind],
            'DarkSlateGray',
            linestyle='dashdot',
            label='$\\eta_{\\rm burst}=3$')
    ind = np.where(sm_modelvar_nu0p5 > -10)
    ax.plot(us.look_back_time(z[ind]),
            sm_modelvar_nu0p5[ind],
            'SlateGray',
            linestyle='dotted',
            label='$\\nu_{\\rm SF}=0.5 \\rm Gyr^{-1}$')

    ax.errorbar(us.look_back_time(xobs),
                yobs,
                yerr=[err, err],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o')

    common.prepare_legend(
        ax, ['k', 'r', 'b', 'Sienna', 'DarkSlateGray', 'SlateGray'], loc=3)

    common.savefig(outdir, fig, "cosmic_smd.pdf")
示例#4
0
def plot_cosmic_sfr(plt, outdir, obsdir, redshifts, h0, sfr, sfrd, sfrb,
                    history_interactions, mDMden):

    fig = plt.figure(figsize=(5, 9))

    xtit = "$\\rm redshift$"
    ytit = "$\\rm log_{10}(CSFRD/ M_{\odot}\,yr^{-1}\,cMpc^{-3})$"

    ax = fig.add_subplot(211)
    plt.subplots_adjust(left=0.15)

    common.prepare_ax(ax,
                      0,
                      10,
                      -3,
                      -0.5,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))

    #Baldry (Chabrier IMF), ['Baldry+2012, z<0.06']
    redK11, SFRK11, err_upK11, err_dnK11 = common.load_observation(
        obsdir, 'Global/SFRD_Karim11.dat', [0, 1, 2, 3])

    hobs = 0.7
    xobs = redK11

    yobs = xobs * 0. - 999.
    indx = np.where(SFRK11 > 0)
    yobs[indx] = np.log10(SFRK11[indx] * pow(hobs / h0, 2.0))

    lerr = yobs * 0. - 999.
    indx = np.where((SFRK11 - err_dnK11) > 0)
    lerr[indx] = np.log10(SFRK11[indx] - err_dnK11[indx])

    herr = yobs * 0. + 999.
    indx = np.where((SFRK11 + err_upK11) > 0)
    herr[indx] = np.log10(SFRK11[indx] + err_upK11[indx])

    ax.errorbar(xobs[0:8],
                yobs[0:8],
                yerr=[yobs[0:8] - lerr[0:8], herr[0:8] - yobs[0:8]],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='D')
    ax.errorbar(xobs[9:17],
                yobs[9:17],
                yerr=[yobs[9:17] - lerr[9:17], herr[9:17] - yobs[9:17]],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='x')

    #Driver (Chabrier IMF), ['Baldry+2012, z<0.06']
    redD17d, redD17u, sfrD17, err1, err2, err3, err4 = common.load_observation(
        obsdir, 'Global/Driver18_sfr.dat', [0, 1, 2, 3, 4, 5, 6])

    hobs = 0.7
    xobsD17 = (redD17d + redD17u) / 2.0
    yobsD17 = sfrD17 + np.log10(hobs / h0)

    errD17 = yobs * 0. - 999.
    errD17 = np.sqrt(
        pow(err1, 2.0) + pow(err2, 2.0) + pow(err3, 2.0) + pow(err4, 2.0))
    ax.errorbar(xobsD17,
                yobsD17,
                yerr=[errD17, errD17],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o')

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(sfr > 0)
    ax.plot(redshifts[ind],
            np.log10(sfr[ind] * pow(h0, 2.0)),
            'k',
            linewidth=1,
            label='total')

    ind = np.where(sfrd > 0)
    ax.plot(redshifts[ind],
            np.log10(sfrd[ind] * pow(h0, 2.0)),
            'b',
            linestyle='dashed',
            linewidth=1,
            label='quiescent')
    ind = np.where(sfrb > 0)
    ax.plot(redshifts[ind],
            np.log10(sfrb[ind] * pow(h0, 2.0)),
            'r',
            linestyle='dotted',
            linewidth=1,
            label='bursts')

    z, sfr_modelvar = common.load_observation(
        obsdir, 'Models/SharkVariations/Global_OtherModels.dat', [0, 3])
    sfr_modelvar_burst3 = sfr_modelvar[0:179]
    sfr_modelvar_nu0p5 = sfr_modelvar[179:359]
    sfr_modelvar_burst20 = sfr_modelvar[360:539]

    ind = np.where(sfr_modelvar_burst20 > -10)
    ax.plot(z[ind],
            sfr_modelvar_burst20[ind],
            'Sienna',
            linestyle='dotted',
            label='$\\eta_{\\rm burst}=20$')
    ind = np.where(sfr_modelvar_burst3 > -10)
    ax.plot(z[ind],
            sfr_modelvar_burst3[ind],
            'DarkSlateGray',
            linestyle='dashdot',
            label='$\\eta_{\\rm burst}=3$')
    ind = np.where(sfr_modelvar_nu0p5 > -10)
    ax.plot(z[ind],
            sfr_modelvar_nu0p5[ind],
            'SlateGray',
            linestyle='dotted',
            label='$\\nu_{\\rm SF}=0.5 \\rm Gyr^{-1}$')

    common.prepare_legend(ax, [
        'k', 'b', 'r', 'Sienna', 'DarkSlateGray', 'SlateGray', 'grey', 'grey',
        'grey'
    ],
                          bbox_to_anchor=(0.52, 0.47))

    xtit = "$\\rm Lookback\, time/Gyr$"
    ax = fig.add_subplot(212)
    plt.subplots_adjust(left=0.15)

    common.prepare_ax(ax,
                      0,
                      13.5,
                      -3,
                      -0.5,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))
    ax.errorbar(us.look_back_time(xobs[0:8]),
                yobs[0:8],
                yerr=[yobs[0:8] - lerr[0:8], herr[0:8] - yobs[0:8]],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='D',
                label="Karim+11 obs")
    ax.errorbar(us.look_back_time(xobs[9:17]),
                yobs[9:17],
                yerr=[yobs[9:17] - lerr[9:17], herr[9:17] - yobs[9:17]],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='x',
                label="Karim+11 extr")
    ax.errorbar(us.look_back_time(xobsD17),
                yobsD17,
                yerr=[errD17, errD17],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o',
                label="Driver+18")

    ind = np.where(sfr > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(sfr[ind] * pow(h0, 2.0)),
            'k',
            linewidth=1)

    ind = np.where(sfrd > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(sfrd[ind] * pow(h0, 2.0)),
            'b',
            linestyle='dashed',
            linewidth=1)
    ind = np.where(sfrb > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(sfrb[ind] * pow(h0, 2.0)),
            'r',
            linestyle='dotted',
            linewidth=1)

    ind = np.where(sfr_modelvar_burst20 > -10)
    ax.plot(us.look_back_time(z[ind]),
            sfr_modelvar_burst20[ind],
            'Sienna',
            linestyle='dotted')
    ind = np.where(sfr_modelvar_burst3 > -10)
    ax.plot(us.look_back_time(z[ind]),
            sfr_modelvar_burst3[ind],
            'DarkSlateGray',
            linestyle='dashdot')
    ind = np.where(sfr_modelvar_nu0p5 > -10)
    ax.plot(us.look_back_time(z[ind]),
            sfr_modelvar_nu0p5[ind],
            'SlateGray',
            linestyle='dotted')

    common.prepare_legend(ax, ['grey', 'grey', 'grey'], loc=2)
    common.savefig(outdir, fig, "cosmic_sfr.pdf")

    #create plot with interaction history
    fig = plt.figure(figsize=(5, 4))

    xtit = "$\\rm redshift$"
    ytit = "$\\rm log_{10}(density\,rate/Mpc^{-3} h^{-3} Gyr^{-1})$"

    ax = fig.add_subplot(111)
    plt.subplots_adjust(left=0.15)

    common.prepare_ax(ax, 0, 10, -4, 0, xtit, ytit, locators=(0.1, 1, 0.1, 1))
    delta_time = np.zeros(shape=(len(redshifts)))
    for i in range(0, len(redshifts)):
        if (i == 0):
            delta_time[i] = 13.7969 - us.look_back_time(redshifts[i])
        if (i < len(redshifts)):
            delta_time[i] = us.look_back_time(
                redshifts[i - 1]) - us.look_back_time(redshifts[i])

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(history_interactions[0, :] + history_interactions[1, :] > 0)
    yplot = np.log10(
        (history_interactions[0, ind] + history_interactions[1, ind]) /
        delta_time[ind])
    ax.plot(redshifts[ind], yplot[0], 'k', linewidth=1, label='mergers')
    ind = np.where(history_interactions[2, :] > 0)
    yplot = np.log10(history_interactions[2, ind] / delta_time[ind])
    ax.plot(redshifts[ind],
            yplot[0],
            'b',
            linewidth=1,
            label='disk instabilities')

    ind = np.where(mDMden[:] > 0)
    yplot = np.log10(mDMden[ind]) - 11.0
    ax.plot(redshifts[ind], yplot, 'r', linewidth=1, label='DM mass(-11dex)')

    common.prepare_legend(ax, ['k', 'b', 'r'], loc=3)

    common.savefig(outdir, fig, "interaction_history.pdf")

    #create plot with interaction history
    fig = plt.figure(figsize=(5, 4))

    xtit = "$\\rm redshift$"
    ytit = "$\\rm delta\, time/Gyr$"

    ax = fig.add_subplot(111)
    plt.subplots_adjust(left=0.15)

    common.prepare_ax(ax,
                      0,
                      10,
                      0,
                      0.3,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 0.1))

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ax.plot(redshifts, delta_time, 'k', linewidth=1)

    common.savefig(outdir, fig, "delta_time_history.pdf")
示例#5
0
def plot_mass_densities(plt, outdir, obsdir, h0, redshifts, mstar, mcold, mhot,
                        meje, mstarden, mcoldden, mhotden, mejeden):

    fig = plt.figure(figsize=(5, 15))

    xtit = "$\\rm Lookback\, time/Gyr$"
    ytit = "$\\rm log_{10}(\\rho/\\rho_{\\rm bar,halos})$"

    ax = fig.add_subplot(411)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    common.prepare_ax(ax,
                      0,
                      13.5,
                      -5,
                      0.1,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1),
                      fontsize=10)
    ax2 = ax.twiny()
    ax2.set_xlim(ax.get_xlim())
    new_tick_locations = np.array([0., 2., 4., 6., 8., 10., 12.])

    ax2.set_xticks(new_tick_locations)
    ax2.set_xticklabels(us.redshift(new_tick_locations), fontsize=12)

    ax2.set_xlabel("redshift", fontsize=13)

    ax.plot(us.look_back_time(redshifts), mstar, 'k', label='stars')
    ax.plot(us.look_back_time(redshifts), mcold, 'b', label='ISM gas')
    ax.plot(us.look_back_time(redshifts), mhot, 'r', label='halo gas')
    ax.plot(us.look_back_time(redshifts), meje, 'g', label='ejected gas')

    common.prepare_legend(ax, ['k', 'b', 'r', 'g'], fontsize=10)

    xtit = "$\\rm Lookback\, time/Gyr$"
    ytit = "$\\rm log_{10}(\\rho_{\\rm bar} /\\rm M_{\odot} \\rm Mpc^{-3})$"

    ax = fig.add_subplot(412)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    common.prepare_ax(ax,
                      0,
                      13.5,
                      6,
                      10,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1),
                      fontsize=10)

    msharktot = mstarden + mcoldden + mhotden + mejeden
    ind = np.where(mstarden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mstarden[ind] * pow(h0, 2.0)),
            'k',
            label='Shark')
    ind = np.where(mcoldden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mcoldden[ind] * pow(h0, 2.0)), 'b')
    ind = np.where(mhotden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mhotden[ind] * pow(h0, 2.0)), 'r')
    ind = np.where(mejeden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mejeden[ind] * pow(h0, 2.0)), 'g')
    ind = np.where(msharktot > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(msharktot[ind] * pow(h0, 2.0)), 'DarkMagenta')

    lbt, eaglesm, eaglesmout, eagleism, eaglehg, eagleejec = common.load_observation(
        obsdir, 'Models/OtherModels/EAGLE_BaryonGrowthTotal.dat',
        [0, 2, 3, 4, 5, 6])
    eaglesm = np.log10(pow(10.0, eaglesm) + pow(10.0, eaglesmout))
    eagletot = np.log10(
        pow(10.0, eaglesm) + pow(10.0, eagleism) + pow(10.0, eaglehg) +
        pow(10.0, eagleejec))
    ind = np.where(eaglesm > 0)
    ax.plot(lbt[ind],
            eaglesm[ind] - 6.0,
            'k',
            linestyle='dotted',
            label='EAGLE')
    ind = np.where(eagleism > 0)
    ax.plot(lbt[ind], eagleism[ind] - 6.0, 'b', linestyle='dotted')
    ind = np.where(eaglehg > 0)
    ax.plot(lbt[ind], eaglehg[ind] - 6.0, 'r', linestyle='dotted')
    ind = np.where(eagleejec > 0)
    ax.plot(lbt[ind], eagleejec[ind] - 6.0, 'g', linestyle='dotted')
    ind = np.where(eagletot > 0)
    ax.plot(lbt[ind], eagletot[ind] - 6.0, 'DarkMagenta', linestyle='dotted')

    common.prepare_legend(ax, ['k', 'k', 'k'], fontsize=10)

    ax = fig.add_subplot(413)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    common.prepare_ax(ax,
                      0,
                      13.5,
                      6,
                      10,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1),
                      fontsize=10)

    ind = np.where(mstarden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mstarden[ind] * pow(h0, 2.0)),
            'k',
            label='Shark')
    ind = np.where(mcoldden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mcoldden[ind] * pow(h0, 2.0)), 'b')
    ind = np.where(mhotden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mhotden[ind] * pow(h0, 2.0)), 'r')
    ind = np.where(mejeden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mejeden[ind] * pow(h0, 2.0)), 'g')
    ind = np.where(msharktot > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(msharktot[ind] * pow(h0, 2.0)), 'DarkMagenta')

    lbt, galsm, galism, galhg, galejec = common.load_observation(
        obsdir, 'Models/OtherModels/global_Mitchell18.dat', [0, 2, 3, 4, 5])
    galtot = np.log10(
        pow(10.0, galsm) + pow(10.0, galism) + pow(10.0, galhg) +
        pow(10.0, galejec))
    galsm = (galsm)
    galism = (galism)
    galhg = (galhg)
    galejec = (galejec)

    h = 0.704
    vol = 6.0  #np.log10(1953125.0/pow(h,3.0))
    ind = np.where(galsm > 0)
    ax.plot(lbt[ind],
            galsm[ind] - vol,
            'k',
            linestyle='dashed',
            label='GALFORM M18',
            linewidth=1)
    ind = np.where(galism > 0)
    ax.plot(lbt[ind], galism[ind] - vol, 'b', linestyle='dashed', linewidth=1)
    ind = np.where(galhg > 0)
    ax.plot(lbt[ind], galhg[ind] - vol, 'r', linestyle='dashed', linewidth=1)
    ind = np.where(galejec > 0)
    ax.plot(lbt[ind], galejec[ind] - vol, 'g', linestyle='dashed', linewidth=1)
    ind = np.where(galtot > 0)
    ax.plot(lbt[ind],
            galtot[ind] - vol,
            'DarkMagenta',
            linestyle='dashed',
            linewidth=1)

    common.prepare_legend(ax, ['k', 'k', 'k'], fontsize=10)

    ax = fig.add_subplot(414)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    common.prepare_ax(ax,
                      0,
                      13.5,
                      6,
                      10,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1),
                      fontsize=10)

    ind = np.where(mstarden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mstarden[ind] * pow(h0, 2.0)),
            'k',
            label='Shark')
    ind = np.where(mcoldden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mcoldden[ind] * pow(h0, 2.0)), 'b')
    ind = np.where(mhotden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mhotden[ind] * pow(h0, 2.0)), 'r')
    ind = np.where(mejeden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mejeden[ind] * pow(h0, 2.0)), 'g')
    ind = np.where(msharktot > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(msharktot[ind] * pow(h0, 2.0)), 'DarkMagenta')

    zbt, galism, galsm, galhg, galejec = common.load_observation(
        obsdir, 'Models/OtherModels/BaryonBudgetLgalaxies.dat',
        [1, 2, 3, 4, 5])
    lbt = us.look_back_time(zbt)
    galtot = np.log10(galsm + galism + galhg + galejec) + 10.0
    galsm = np.log10(galsm) + 10.0
    galism = np.log10(galism) + 10.0
    galhg = np.log10(galhg) + 10.0
    galejec = np.log10(galejec) + 10.0

    h = 0.673
    vol = np.log10(125000000.0 / pow(h, 3.0))
    ind = np.where(galsm > 0)
    ax.plot(lbt[ind],
            galsm[ind] - vol - np.log10(h),
            'k',
            linestyle='dashdot',
            label='L-galaxies H15',
            linewidth=1)
    ind = np.where(galism > 0)
    ax.plot(lbt[ind],
            galism[ind] - vol - np.log10(h),
            'b',
            linestyle='dashdot',
            linewidth=1)
    ind = np.where(galhg > 0)
    ax.plot(lbt[ind],
            galhg[ind] - vol - np.log10(h),
            'r',
            linestyle='dashdot',
            linewidth=1)
    ind = np.where(galejec > 0)
    ax.plot(lbt[ind],
            galejec[ind] - vol - np.log10(h),
            'g',
            linestyle='dashdot',
            linewidth=1)
    ind = np.where(galtot > 0)
    ax.plot(lbt[ind],
            galtot[ind] - vol - np.log10(h),
            'DarkMagenta',
            linestyle='dashdot',
            linewidth=1)

    common.prepare_legend(ax, ['k', 'k', 'k'], fontsize=10)

    common.savefig(outdir, fig, "global.pdf")

    fig = plt.figure(figsize=(5, 4))

    xtit = "$\\rm Lookback\, time/Gyr$"
    ytit = "$\\rm log_{10}(\\rho_{\\rm gas, halo} /\\rm M_{\odot} \\rm Mpc^{-3})$"

    ax = fig.add_subplot(111)
    plt.subplots_adjust(bottom=0.15, left=0.15)
    common.prepare_ax(ax,
                      0,
                      13.5,
                      5,
                      10,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1),
                      fontsize=10)

    ind = np.where(mhotden > 0)
    ax.plot(us.look_back_time(redshifts),
            np.log10(mhotden[ind] * pow(h0, 2.0)),
            'r',
            label='Shark')

    lbt, eaglesm, eaglesmout, eagleism, eaglehg, eagleejec = common.load_observation(
        obsdir, 'Models/OtherModels/EAGLE_BaryonGrowthTotal.dat',
        [0, 2, 3, 4, 5, 6])
    eaglesm = np.log10(pow(10.0, eaglesm) + pow(10.0, eaglesmout))
    eagletot = np.log10(
        pow(10.0, eaglesm) + pow(10.0, eagleism) + pow(10.0, eaglehg) +
        pow(10.0, eagleejec))
    ind = np.where(eaglehg > 0)
    ax.plot(lbt[ind],
            eaglehg[ind] - 6.0,
            'r',
            linestyle='dotted',
            label='EAGLE')

    lbt, galsm, galism, galhg, galejec = common.load_observation(
        obsdir, 'Models/OtherModels/global_Mitchell18.dat', [0, 2, 3, 4, 5])
    galtot = np.log10(
        pow(10.0, galsm) + pow(10.0, galism) + pow(10.0, galhg) +
        pow(10.0, galejec))
    galhg = (galhg)

    h = 0.704
    vol = 6.0  #np.log10(1953125.0/pow(h,3.0))
    ind = np.where(galhg > 0)
    ax.plot(lbt[ind],
            galhg[ind] - vol,
            'r',
            linestyle='dashed',
            linewidth=1,
            label='GALFORM M18')
    ind = np.where(galejec > 0)

    zbt, galism, galsm, galhg, galejec = common.load_observation(
        obsdir, 'Models/OtherModels/BaryonBudgetLgalaxies.dat',
        [1, 2, 3, 4, 5])
    lbt = us.look_back_time(zbt)
    galhg = np.log10(galhg) + 10.0

    h = 0.673
    vol = np.log10(125000000.0 / pow(h, 3.0))
    ind = np.where(galhg > 0)
    ax.plot(lbt[ind],
            galhg[ind] - vol - np.log10(h),
            'r',
            linestyle='dashdot',
            linewidth=1,
            label='L-galaxies H15')

    common.prepare_legend(ax, ['k', 'k', 'k', 'k'], fontsize=10)

    common.savefig(outdir, fig, "global_hotgas.pdf")
示例#6
0
def plot_omega_HI(plt, outdir, obsdir, redshifts, h0, omegaHI):

    fig = plt.figure(figsize=(5, 4.5))

    ax = fig.add_subplot(111)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    xtit = "$\\rm Lookback\, time/Gyr$"
    ytit = "$\\rm log_{10}(\\Omega_{\\rm H_I})$"
    common.prepare_ax(ax,
                      0,
                      13.5,
                      -5,
                      -2,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))

    ax2 = ax.twiny()
    ax2.set_xlim(ax.get_xlim())
    new_tick_locations = np.array([0., 2., 4., 6., 8., 10., 12.])

    ax2.set_xticks(new_tick_locations)
    ax2.set_xticklabels(us.redshift(new_tick_locations), fontsize=12)

    ax2.set_xlabel("redshift", fontsize=13)

    # note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(omegaHI > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(omegaHI[ind] * pow(h0, 2.0)) + np.log10(XH),
            'r',
            label='Shark')

    z, hi_modelvar = common.load_observation(
        obsdir, 'Models/SharkVariations/Global_OtherModels.dat', [0, 1])
    hi_modelvar_burst3 = hi_modelvar[0:179]
    hi_modelvar_nu0p5 = hi_modelvar[181:360]
    hi_modelvar_burst20 = hi_modelvar[360:539]

    ind = np.where(hi_modelvar_burst20 > -10)
    ax.plot(us.look_back_time(z[ind]),
            hi_modelvar_burst20[ind],
            'Sienna',
            linestyle='dotted',
            label='$\\eta_{\\rm burst}=20$')
    ind = np.where(hi_modelvar_burst3 > -10)
    ax.plot(us.look_back_time(z[ind]),
            hi_modelvar_burst3[ind],
            'Crimson',
            linestyle='dashdot',
            label='$\\eta_{\\rm burst}=3$')
    ind = np.where(hi_modelvar_nu0p5 > -10)
    ax.plot(us.look_back_time(z[ind]),
            hi_modelvar_nu0p5[ind],
            'Salmon',
            linestyle='dotted',
            label='$\\nu_{\\rm SF}=0.5 \\rm Gyr^{-1}$')

    xcgm = np.zeros(shape=2)
    ycgm = np.zeros(shape=2)

    xcgm[:] = 2.0
    ycgm[0] = -5.0
    ycgm[1] = -2.0
    ax.plot(us.look_back_time(xcgm),
            ycgm,
            'k',
            linestyle='dotted',
            linewidth=0.85)
    ax.arrow(us.look_back_time(2.0),
             -2.5,
             0.75,
             0,
             head_width=0.05,
             head_length=0.1,
             fc='k',
             ec='k')
    ax.text(10.55, -2.4, 'CGM?', fontsize=12)

    # Rhee+18 compilation
    redR18, reddR18, reduR18, omegaR18, errdnR18, errupR18 = common.load_observation(
        obsdir, 'Global/HI_density_Rhee18.dat', [1, 2, 3, 7, 8, 9])

    ax.errorbar(us.look_back_time(redR18),
                np.log10(omegaR18 * 1e-3),
                xerr=[reddR18, reduR18],
                yerr=[errdnR18, errupR18],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o',
                label="Rhee+18 (comp)")

    common.prepare_legend(ax, ['r', 'Sienna', 'Crimson', 'Salmon', 'grey'])
    common.savefig(outdir, fig, "omega_HI.pdf")
示例#7
0
def plot_cosmic_dust(plt, outdir, obsdir, redshifts, h0, mdustden,
                     mdustden_mol):

    fig = plt.figure(figsize=(5, 4.5))
    ax = fig.add_subplot(111)
    plt.subplots_adjust(bottom=0.15, left=0.15)

    xtit = "$\\rm Lookback\,time/Gyr$"
    ytit = "$\\rm log_{10}(\\rho_{\\rm dust}/ M_{\odot}\,cMpc^{-3})$"
    common.prepare_ax(ax,
                      0,
                      13.5,
                      4,
                      6.3,
                      xtit,
                      ytit,
                      locators=(0.1, 1, 0.1, 1))

    ax2 = ax.twiny()
    ax2.set_xlim(ax.get_xlim())
    new_tick_locations = np.array([0., 2., 4., 6., 8., 10., 12.])

    ax2.set_xticks(new_tick_locations)
    ax2.set_xticklabels(us.redshift(new_tick_locations), fontsize=12)

    ax2.set_xlabel("redshift", fontsize=13)

    #note that only h^2 is needed because the volume provides h^3, and the SFR h^-1.
    ind = np.where(mdustden > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(mdustden[ind] * pow(h0, 2.0)),
            'r',
            label='Shark all metals')

    ind = np.where(mdustden_mol > 0)
    ax.plot(us.look_back_time(redshifts[ind]),
            np.log10(mdustden_mol[ind] * pow(h0, 2.0)),
            'r',
            linestyle='dashed',
            label='Shark metals in molecular gas')

    #Baldry (Chabrier IMF), ['Baldry+2012, z<0.06']
    redD17d, redD17u, smdD17, err1, err2, err3, err4 = common.load_observation(
        obsdir, 'Global/Driver18_dust.dat', [1, 2, 3, 4, 5, 6, 7])

    hobs = 0.7
    xobs = (redD17d + redD17u) / 2.0
    yobs = smdD17 + np.log10(hobs / h0)

    err = yobs * 0. - 999.
    err = np.sqrt(
        pow(err1, 2.0) + pow(err2, 2.0) + pow(err3, 2.0) + pow(err4, 2.0))

    ax.errorbar(us.look_back_time(xobs),
                yobs,
                yerr=[err, err],
                ls='None',
                mfc='None',
                ecolor='grey',
                mec='grey',
                marker='o',
                label="Driver+18")

    common.prepare_legend(ax, ['r', 'r', 'grey'])
    common.savefig(outdir, fig, "cosmic_dust.pdf")