コード例 #1
0
    for ii, tag in enumerate(tags):

        z = float(tag[5:].replace('p','.'))
        print (z)
        df = pd.read_csv('Magnitude_limits.txt')
        low = np.array(df[filters])[ii]

        Halpha = np.concatenate(get_line_all(tag, 'HI6563', inp = 'FLARES', LF = False)[:,1])
        Hbeta = np.concatenate(get_line_all(tag, 'HI4861', inp = 'FLARES', LF = False)[:,1])
        CIII = np.concatenate(get_line_all(tag, 'CIII1907', inp = 'FLARES', LF = False)[:,1] + get_line_all(tag, 'CIII1909', inp = 'FLARES', LF = False)[:,1])
        OII = np.concatenate(get_line_all(tag, 'OII3726', inp = 'FLARES', LF = False)[:,1] + get_line_all(tag, 'OII3729', inp = 'FLARES', LF = False)[:,1])
        # NeIII = get_line_all(tag, 'NeIII3869', inp = 'FLARES', LF = False) + get_line_all(tag, 'NeIII3967', inp = 'FLARES', LF = False)
        OIII = np.concatenate(get_line_all(tag, 'OIII4959', inp = 'FLARES', LF = False)[:,1] + get_line_all(tag, 'OIII5007', inp = 'FLARES', LF = False)[:,1])
        if input == plt_options[1]:
            x_inp = get_data_all(tag, dataset = 'Mstar_30', DF=False)*1e10
            for kk in range(len(x_inp)): x_inp[kk] = np.log10(x_inp[kk])
            bins = np.arange(7.5, 11.5, 0.5)
            xlabel=r'log$_{10}$(M$_{\star}$/M$_{\odot}$)'
            xpos = 0.455
            bottom = 0.20

        elif input == plt_options[2]:
            x_inp = get_lum_all(tag, LF=False)
            for kk in range(len(x_inp)): x_inp[kk] = lum_to_M(x_inp[kk])
            bins = -np.arange(17, 25, 1)[::-1]
            xlabel = r'$\mathrm{M}_{1500}$'
            xpos = 0.47
            bottom = 0.21

            for kk in range(5): axs[kk].set_xlim((-17,-23.9))
コード例 #2
0
                        edgecolor='k')
axs = axs.ravel()

for ii, tag in enumerate(tags):

    df = pd.read_csv('Magnitude_limits.txt')
    low = np.array(df[filters])[ii]
    bins = -np.arange(-low, 25, 0.4)[::-1]

    L_FUV = get_lum_all(tag, LF=False, filter='FUV', Luminosity='DustModelI')
    L_NUV = get_lum_all(tag, LF=False, filter='NUV', Luminosity='DustModelI')
    L_FUV_int = get_lum_all(tag,
                            LF=False,
                            filter='FUV',
                            Luminosity='Intrinsic')
    Mstar_30 = get_data_all(tag, inp='FLARES', DF=False)
    sfr_30 = get_data_all(tag, dataset='SFR_inst_30', inp='FLARES', DF=False)

    ws = np.array([])
    for jj in range(len(weights)):
        ws = np.append(ws, np.ones(np.shape(L_FUV[jj])) * weights[jj])
    L_FUV = np.concatenate(L_FUV)
    L_FUV_int = np.concatenate(L_FUV_int)
    L_NUV = np.concatenate(L_NUV)
    Mstar_30 = np.concatenate(Mstar_30) * 1e10
    sfr_30 = np.concatenate(sfr_30)

    ok = np.where(lum_to_M(L_FUV) < low)[0]
    L_FUV, L_NUV, L_FUV_int, Mstar_30 = L_FUV[ok], L_NUV[ok], L_FUV_int[
        ok], Mstar_30[ok]
    sfr_30 = sfr_30[ok] / Mstar_30
コード例 #3
0
weights = np.array(df['weights'])
sims = np.arange(len(weights))

fig, axs = plt.subplots(nrows = 2, ncols = 3, figsize=(13, 6), sharex=False, sharey=False, facecolor='w', edgecolor='k')
axs = axs.ravel()

for ii, tag in enumerate(tags):

    z = float(tag[5:].replace('p','.'))
    print (z)

    dat1 = get_line_all(tag, 'OIII4959', inp = 'FLARES', LF = False)
    dat2 = get_line_all(tag, 'OIII5007', inp = 'FLARES', LF = False)
    dat3 = get_line_all(tag, 'HI4861', inp = 'FLARES', LF = False)
    l_fuvs = np.concatenate(get_lum_all(tag, LF=False))
    mstar = get_data_all(tag, dataset = 'Mstar_30', DF=False)

    ws = np.array([])
    for jj in sims:
        ws = np.append(ws, np.ones(np.shape(mstar[jj]))*weights[jj])
    mstar = np.concatenate(mstar)*1e10

    OIII4959_lum = np.concatenate(dat1[:,0])
    OIII4959_EW = np.concatenate(dat1[:,1])

    OIII5007_lum = np.concatenate(dat2[:,0])
    OIII5007_EW = np.concatenate(dat2[:,1])

    Hbeta_lum = np.concatenate(dat3[:,0])
    Hbeta_EW = np.concatenate(dat3[:,1])
コード例 #4
0
    c_m = matplotlib.cm.viridis_r
    # create a ScalarMappable and initialize a data structure
    s_m = matplotlib.cm.ScalarMappable(cmap=c_m, norm=norm)
    s_m.set_array([])

    bins = np.arange(-1, 4, 0.4)
    bincen = (bins[1:] + bins[:-1]) / 2.
    binwidth = bins[1:] - bins[:-1]

    for ii, tag in enumerate(tags):

        z = float(tag[5:].replace('p', '.'))
        axs[ii].text(-0.5, -5.7, r'$z = {}$'.format(z), fontsize=12)

        sfr_30 = get_data_all(tag,
                              dataset='SFR/SFR_100',
                              inp='FLARES',
                              DF=False)
        L_FUV = get_lum_all(tag,
                            LF=False,
                            filter='FUV',
                            Luminosity='DustModelI')
        L_FUV_int = get_lum_all(tag,
                                LF=False,
                                filter='FUV',
                                Luminosity='Intrinsic')

        sfr_tot = np.zeros(len(bincen))
        sfr_tot_err = np.zeros(len(bincen))

        sfr_obsc = np.zeros(len(bincen))
        sfr_unobsc = np.zeros(len(bincen))
コード例 #5
0
norm = matplotlib.colors.Normalize(vmin=0.5, vmax=len(tags)+0.5)
# choose a colormap
c_m = matplotlib.cm.viridis_r
# create a ScalarMappable and initialize a data structure
s_m = matplotlib.cm.ScalarMappable(cmap=c_m, norm=norm)
s_m.set_array([])

bins = np.arange(7.5, 12, 0.5)
bincen = (bins[1:]+bins[:-1])/2.

yerr1_lo, yerr1_up, yerr2_lo, yerr2_up = np.array([]), np.array([]), np.array([]), np.array([])

for ii, tag in enumerate(tags):

    z = float(tag[5:].replace('p','.'))
    mstar = get_data_all(tag, inp = 'FLARES', DF = False)
    ws = np.array([])
    for jj in sims:
        ws = np.append(ws, np.ones(np.shape(mstar[jj]))*weights[jj])
    mstar = np.log10(np.concatenate(mstar)*1e10)

    data = get_Z(tag)

    S_met = np.log10(np.concatenate(data[:,0]))
    G_met = np.log10(np.concatenate(data[:,1]))

    out = flares.binned_weighted_quantile(mstar, G_met,ws,bins,quantiles)
    xx, yy, yy84, yy16 = bincen, out[:,1], out[:,0],out[:,2]
    hist, edges=np.histogram(mstar, bins)
    ok = np.where(hist>=5)[0]
    ax.errorbar(xx[ok], yy[ok], ls='-', color=s_m.to_rgba(ii+0.5), alpha=.9, lw=1, fmt='s')
コード例 #6
0
# choose a colormap
c_m = matplotlib.cm.viridis_r

# create a ScalarMappable and initialize a data structure
s_m = matplotlib.cm.ScalarMappable(cmap=c_m, norm=norm)
s_m.set_array([])

for ii, tag in enumerate(tags):

    axs[ii].text(7.9, -6.5, r'$z = {}$'.format(zs[ii]), fontsize=10)

    bins = np.arange(7.5, 12.5, 0.25)
    bincen = (bins[1:] + bins[:-1]) / 2.
    binwidth = bins[1:] - bins[:-1]

    out, hist, err = get_data_all(tag, bins=bins, inp='FLARES', DF=True)

    ok = np.where(hist > 0)[0]
    hist = hist[ok]
    Msim = out / (binwidth * vol)
    xerr = np.ones(len(out)) * binwidth[0] / 2.
    yerr = err / (vol * binwidth)

    ok1 = np.where(hist >= 5)[0][-1]

    Mref = get_data_all(tags_ref[ii], bins=bins, inp='REF',
                        DF=True) / (binwidth * refvol)
    okref = np.where(Mref > 0)
    # Magn = get_data_all(tags_ref[ii], bins = bins, inp = 'AGNdT9', DF = True)/(binwidth*AGNdT9vol)
    # okagn = np.where(Magn>0)
    # if zs[ii]>=8: