Example #1
0
def Composite(SSP1, SSP2):
    synphot1 = Observe(SSP1, filters, redshift=0.001)
    synphot2 = Observe(SSP2, filters, redshift=0.001)
    mags1 = synphot1.AB[0]
    U_V1 = mags1[2]-mags1[4]
    V_J1 = mags1[4]-mags1[7]
    mags2 = synphot2.AB[0]
    U_V2 = mags2[2]-mags2[4]
    V_J2 = mags2[4]-mags2[7]
    X1, Y1 = V_J1, U_V1
    X2, Y2 = V_J2, U_V2
    for i, w in enumerate(weight):
        combined = w * SSP1 + (1-w) * SSP2
        synphot = Observe(combined, filters, redshift=0.001)

        mags = synphot.AB[0]
        U_V = mags[2]-mags[4]
        V_J = mags[4]-mags[7]
        
        X, Y = V_J, U_V
        
        X_track[i] = X.ravel()
        Y_track[i] = Y.ravel()
    return X_track, Y_track, X1, Y1, X2, Y2
Example #2
0
    lgMs = BC03_out['lgM*'].reshape((M_seed.size, Ages.size)).T
    lgSSFR = BC03_out['lgsSFR'].reshape((M_seed.size, Ages.size)).T
    Ms = 10**lgMs
    SSFR = 10**lgSSFR

#==============================================================================
# Mock Observation
#==============================================================================
eazy_library = LoadEAZYFilters('FILTER.RES.CANDELS')

print eazy_library.filternames

filters = FilterSet()
filters.addEAZYFilter(eazy_library, range(len(eazy_library.filternames)))
Names = ['FUV', 'NUV', 'U', 'B', 'V', 'R', 'I', 'J', 'H', 'K']
synphot = Observe(models, filters, redshift=0.001)

mags = synphot.AB[0]
FUV_V = mags[0] - mags[4]
NUV_V = mags[1] - mags[4]
U_V = mags[2] - mags[4]
V_J = mags[4] - mags[7]
V_K = mags[4] - mags[9]
NUV_R = mags[1] - mags[5]
R_K = mags[5] - mags[9]

#==============================================================================
# UVJ Tracks
#==============================================================================
X, Y = V_J, U_V
plt.figure(figsize=(8, 7))
Example #3
0
weight = np.concatenate((np.linspace(0., 0.1, 11), np.linspace(0.2, 1.0, 9)))
X_track, Y_track = np.empty((len(weight), SFH.size)), np.empty(
    (len(weight), SFH.size))

#==============================================================================
# Choose SSP
#==============================================================================
# A:0 B:1 C:2 D:3
SP1, SP2 = SP_A, SP_C
sp1, sp2 = 0, 2
#==============================================================================
eazy_library = LoadEAZYFilters('FILTER.RES.CANDELS')
filters = FilterSet()
filters.addEAZYFilter(eazy_library, range(len(eazy_library.filternames)))
Names = ['FUV', 'NUV', 'U', 'B', 'V', 'R', 'I', 'J', 'H', 'K']
synphot1 = Observe(SP1, filters, redshift=0.001)
synphot2 = Observe(SP2, filters, redshift=0.001)
fluxes1 = np.squeeze(synphot1.fluxes).value
fluxes2 = np.squeeze(synphot2.fluxes).value

data = Table()

for i, n in enumerate(Names):
    flux = np.array([])
    for k, w in enumerate(weight):
        flux = np.append(flux, (w * fluxes1[i] * Ms[sp1,:] + \
                                (1-w) * fluxes2[i] * Ms[sp2,:]).ravel())
    err = 0.01 * flux
    data.add_columns(
        [Column(flux, 'F%s' % (i + 1)),
         Column(err, 'E%s' % (i + 1))])
Example #4
0
eazy_library = LoadEAZYFilters('data/FILTER.RES.v8')
eazy_library.search('J')

filters = FilterSet()
filters.addEAZYFilter(eazy_library, [139, 141, 125])  # U, V, J
filters.addTophatFilter(centre=1500 * u.AA, width=150 * u.AA)  # FUV

UV = np.empty((SFH.size, Ages.size))
VJ = np.empty((SFH.size, Ages.size))

for i, tau in enumerate(SFH):
    for j, T in enumerate(Ages):
        key = '%s-%s' % (str(i), str(j))

        synphot = Observe(models[key], filters, redshift=0.)

        mags = np.squeeze(synphot.AB)
        UV[i, j] = (mags[0] - mags[1]).value
        VJ[i, j] = (mags[1] - mags[2]).value

with quantity_support():
    for i, tau in enumerate(SFH):
        s = plt.scatter(VJ[i],
                        UV[i],
                        c=np.log10(Ages / u.yr),
                        s=60,
                        cmap=plt.cm.RdYlBu_r)
        plt.plot(VJ[i], UV[i], label=r'$\tau = ${0}'.format(tau), alpha=0.7)

    col = plt.colorbar(s)
Example #5
0
    Ax.semilogy(ssp.wave,
                spec,
                '--',
                label='SMpy: M_gal = 0.64',
                color='firebrick')
    Ax.semilogy(wave_src,
                spec_src,
                '-',
                label='BC03 src: M_star = 0.44',
                color='steelblue')
    Ax.set_ylim([1e-4, 1e-2])
    Ax.set_xlim([1000, 7000])
    Leg = Ax.legend(loc='best', fontsize=12)
plt.show()

eazy_library = LoadEAZYFilters('FILTER.RES.CANDELS')

print eazy_library.filternames

filters = FilterSet()
filters.addEAZYFilter(eazy_library, [2, 4, 7])  # U, V, J

synphot = Observe(ssp, filters, redshift=0.01)

mags = np.squeeze(synphot.AB)
U, V, J = mags
UV = U - V
VJ = V - J

print UV, VJ
Example #6
0
SFR_e = models_e.SFR * M_s_e[None, :, :, None, None]
sSFR_e = np.squeeze(np.log10(models_e.SFR.value))

SED_d = models_d.SED * M_s_d[None, :, :, None, None, None]
SFR_d = models_d.SFR * M_s_d[None, :, :, None, None]
sSFR_d = np.squeeze(np.log10(models_d.SFR.value))

eazy_library = LoadEAZYFilters('FILTER.RES.CANDELS')

print eazy_library.filternames

filters = FilterSet()
filters.addEAZYFilter(eazy_library, range(len(eazy_library.filternames)))
# FUV, NUV, U, B, V, R, I, J, H, K

synphot_e = Observe(models_e, filters, redshift=0.001)
synphot_d = Observe(models_d, filters, redshift=0.001)

mags_e = np.squeeze(synphot_e.AB)
Colors_e = {
    'UV': mags_e[2] - mags_e[4],
    'VJ': mags_e[4] - mags_e[7],
    'FUVR': mags_e[0] - mags_e[5],
    'RK': mags_e[5] - mags_e[9]
}
mags_d = np.squeeze(synphot_d.AB)
Colors_d = {
    'UV': mags_d[2] - mags_d[4],
    'VJ': mags_d[4] - mags_d[7],
    'FUVR': mags_d[0] - mags_d[5],
    'RK': mags_d[5] - mags_d[9]
Example #7
0
#==============================================================================
# Mock Observation
#==============================================================================
eazy_library = LoadEAZYFilters('FILTER.RES.CANDELS')

print eazy_library.filternames

filters = FilterSet()
filters.addEAZYFilter(eazy_library, range(len(eazy_library.filternames)))  
Names = ['FUV', 'NUV', 'U', 'B', 'V', 'R', 'I', 'J', 'H', 'K']

theta = 34.8*u.deg

#Aldo
synphot_A = Observe(models_A, filters, redshift=0.001)
mags_A = synphot_A.AB[0]
FUV, NUV, U, B, V, R, I, J, H, K = mags_A
FUV_V = FUV - V
NUV_V = NUV - V
U_V = U - V
V_J = V - J
V_K = V - K
Ssed_A = pd.DataFrame(np.squeeze(np.sin(theta)*U_V + np.cos(theta)*V_J))
Csed_A = pd.DataFrame(np.squeeze(np.cos(theta)*U_V - np.sin(theta)*V_J))
UV_A = pd.DataFrame(np.squeeze(U_V))
VJ_A = pd.DataFrame(np.squeeze(V_J))

#Ciesla
synphot_C = Observe(models_C, filters, redshift=0.001)
mags_C = synphot_C.AB[0]
Example #8
0
#    cb.set_label(r'$\log_{10}(\rm{Tau}/\rm{yr})$')
#    plt.legend(loc='best',fontsize=12,frameon=True,facecolor='w')
#    plt.plot([-1., 1.0, 1.6, 1.6], [1.3, 1.3, 2.01, 2.5], color='k', alpha=0.7)
#    plt.axhline(0.5,ls='--',color='k')
#    plt.xlabel('V - J')
#    plt.ylabel('U - V')
#    plt.xlim([-0.75, 2.0])
#    plt.ylim([-0.25, 2.25])
#    plt.tight_layout()
#    #plt.savefig('taskIII/A+D %.2f.png'%w,dpi=100)
#    plt.show()

#==============================================================================
# Exponential
#==============================================================================
synphot_exp = Observe(models_exp, filters, redshift=0.001)
mags_exp = synphot_exp.AB[0]
FUV, NUV, U, B, V, R, I, J, H, K = mags_exp
FUV_V = FUV - V
NUV_V = NUV - V
U_V = U - V
V_J = V - J
V_K = V - K

#==============================================================================
# Composite Schematic
#==============================================================================
X, Y = V_J, U_V
with sns.axes_style("ticks"):
    plt.figure(figsize=(7,7))
    plt.plot(X[0,:,0,0,0], Y[0,:,0,0,0], c='m',lw=2, alpha=0.7)