コード例 #1
0
def plot_Mstar_DTM_age(files, z, axs, snapnum, i, on):

    add = sims[i]
    Mstar, Mratio, Type, Age, Mcg, Mmet = get_vals(files, z, axs, snapnum, i,
                                                   on)
    x, y, xx, yy, yy_up, yy_low, den = create_out.out_age(
        Mstar, Mratio, Type, Age, z)

    x = np.log10(x)
    y = np.log10(y)
    xx = np.log10(xx)
    yy = np.log10(yy)
    yy_up = np.log10(yy_up)
    yy_low = np.log10(yy_low)

    p = make_fig.fig_age(axs, z, x, y, xx, yy, yy_up, yy_low, den)

    xlim = [7.5, 11.5]
    ylim = [-2.9, 0.5]
    xticks = [8, 9, 10, 11]

    axs.set_xlim(xlim)
    axs.set_ylim(ylim)
    axs.set_xticks(xticks)

    return add, p, den
コード例 #2
0
def plot_tacc_Mstar_user(files, z, axs, snapnum, i, on):

    add = sims[i]

    Mstar, tacc, Type, Age, Z = get_vals(files, z, axs, snapnum, i, on)
    x, y, xx, yy, yy_up, yy_low, den = create_out.out_age(
        Mstar, tacc, Type, Z, z)

    x = np.log10(x)
    y = np.log10(y)
    xx = np.log10(xx)
    yy = np.log10(yy)
    yy_up = np.log10(yy_up)
    yy_low = np.log10(yy_low)
    den = np.log10(den)

    #p = make_fig.fig_age(axs, z, x, y, xx, yy, yy_up, yy_low, den, bins = None) #Colour by metallicity
    p = make_fig.fig_user(axs, z, x, y, xx, yy, yy_up, yy_low, den)

    xlim = [7.5, 11.7]
    ylim = [5, 11.5]
    xticks = [8, 9, 10, 11]
    yticks = [5, 6, 7, 8, 9, 10, 11]

    axs.set_xlim(xlim)
    axs.set_ylim(ylim)
    axs.set_xticks(xticks)
    axs.set_yticks(yticks)

    return add, p, den
コード例 #3
0
def plot_tacc_Mstar_age(files, z, axs, snapnum, i, on):

    add = sims[i]

    Mstar, tacc, Type, Age, Z = get_vals(files, z, axs, snapnum, i, on)
    x, y, xx, yy, yy_up, yy_low, den = create_out.out_age(
        Mstar, tacc, Type, Age, z)

    x = np.log10(x)
    y = np.log10(y)
    xx = np.log10(xx)
    yy = np.log10(yy)
    yy_up = np.log10(yy_up)
    yy_low = np.log10(yy_low)

    p = make_fig.fig_age(axs, z, x, y, xx, yy, yy_up, yy_low, den)

    xlim = [7.5, 11.7]
    ylim = [5, 10.5]
    xticks = [8, 9, 10, 11]
    yticks = [5, 6, 7, 8, 9, 10]

    axs.set_xlim(xlim)
    axs.set_ylim(ylim)
    axs.set_xticks(xticks)

    return add, p, den
コード例 #4
0
def plot_O_H_vs_Dust_age(files, z, axs, snapnum, i, on):

    add, met, Mdust, Type, Age = get_vals(files, z, axs, snapnum, i, on)

    x, y, xx, yy, yy_up, yy_low, den = create_out.out_age(
        met, Mdust, Type, Age, z)

    x = 12 + np.log10(x)
    y = np.log10(y)
    xx = 12 + np.log10(xx)
    yy = np.log10(yy)
    yy_up = np.log10(yy_up)
    yy_low = np.log10(yy_low)

    p = make_fig.fig_age(axs, z, x, y, xx, yy, yy_up, yy_low, den)

    xlim = [7.5, 10.5]
    ylim = [2.5, 10.5]
    xticks = [8, 9, 10]

    axs.set_xlim(xlim)
    axs.set_ylim(ylim)
    axs.set_xticks(xticks)

    return add, p, den
コード例 #5
0
def plot_Mstar_Mdust_age(files, z, axs, snapnum, i, on):

    add = sims[i]
    snap = snapnum[i][np.where(redshift == str(z))[0][0]]

    try:
        data = np.load('data/Mstar_{}_snap_{}.npz'.format(add, snap))
        Mstar = data['Mstar']
        data = np.load('data/Type_{}_snap_{}.npz'.format(add, snap))
        Type = data['Type']
        data = np.load('data/Age_{}_snap_{}.npz'.format(add, snap))
        Age = data['Age']
        data = np.load('data/DustColdGasDiff_elements_{}_snap_{}.npz'.format(
            add, snap))
        Mdust1 = data['DustColdGasDiff_elements']
        data = np.load('data/DustColdGasClouds_elements_{}_snap_{}.npz'.format(
            add, snap))
        Mdust2 = data['DustColdGasClouds_elements']

    except:
        Mstar = (get_.get_var(files[i], 'StellarMass', snap) * 1e10) / h

        if on and i == 0:
            ok = np.where(Mstar >= 10**8.9)[0]
        elif on and i == 1:
            ok = np.logical_and(Mstar > 10**7.5, Mstar < 10**8.9)
        else:
            ok = np.array([True] * len(Mstar))

        Mstar = Mstar[ok]
        np.savez_compressed('data/Mstar_{}_snap_{}'.format(add, snap),
                            Mstar=Mstar)
        Type = get_.get_var(files[i], 'Type', snap)[ok]
        np.savez_compressed('data/Type_{}_snap_{}'.format(add, snap),
                            Type=Type)
        Age = get_.get_var(files[i], 'MassWeightAge', snap)[ok]
        np.savez_compressed('data/Age_{}_snap_{}'.format(add, snap), Age=Age)
        Mdust1 = get_.get_var(files[i], 'DustColdGasDiff_elements', snap)[ok]
        np.savez_compressed('data/DustColdGasDiff_elements_{}_snap_{}'.format(
            add, snap),
                            DustColdGasDiff_elements=Mdust1)
        Mdust2 = get_.get_var(files[i], 'DustColdGasClouds_elements', snap)[ok]
        np.savez_compressed(
            'data/DustColdGasClouds_elements_{}_snap_{}'.format(add, snap),
            DustColdGasClouds_elements=Mdust2)

    Mdust1 = np.nansum(Mdust1, axis=1)
    Mdust2 = np.nansum(Mdust2, axis=1)
    Mdust = Mdust1 + Mdust2

    x, y, xx, yy, yy_up, yy_low, den = create_out.out_age(
        Mstar, Mdust, Type, Age, z)

    x = np.log10(x)
    y = np.log10(y)
    xx = np.log10(xx)
    yy = np.log10(yy)
    yy_up = np.log10(yy_up)
    yy_low = np.log10(yy_low)

    p = make_fig.fig_age(axs, z, x, y, xx, yy, yy_up, yy_low, den)

    xlim = [7.5, 11.9]
    ylim = [1.5, 10.8]
    xticks = [8, 9, 10, 11]

    axs.set_xlim(xlim)
    axs.set_ylim(ylim)
    axs.set_xticks(xticks)

    return add, p, den