Ejemplo n.º 1
0
def predict_c_one(theta, age):
    # Time, tq and tau are in units of Gyrs
    t = N.linspace(0,14.0,100)
    tq, tau = theta
    sfr = expsfh(tau, tq, t)
    nuv_u = N.zeros_like(sfr)
    u_r = N.zeros_like(sfr)
    # Work out total flux at each time given the sfh model of tau and tq (calls assign_fluxes function)
    total_flux = assign_fluxes.assign_total_flux_numpy(data[0,1:], data[1:,0], data[1:,1:], t*1E9, sfr)
    # Calculate fluxes from the flux at all times then interpolate to get one colour for the age you are observing the galaxy at - if many galaxies are being observed, this also works with an array of ages to give back an array of colours
    nuv_u, u_r = get_colours_numpy(t*1E9, total_flux, data)
    nuv_u_age = N.interp(age, t, nuv_u)
    u_r_age = N.interp(age, t, u_r)
    return nuv_u_age, u_r_age
Ejemplo n.º 2
0
def predict_c_one(theta, age):
    # Time, tq and tau are in units of Gyrs
    print theta
    t = N.linspace(0,14.0,100)
    tq, tau = theta
    sfr = expsfh(tau, tq, t)
    dir ='/Users/becky/Projects/Green-Valley-Project/bc03/models/Padova1994/chabrier/ASCII/'
    model = 'extracted_bc2003_lr_m62_chab_ssp.ised_ASCII'
    data = N.loadtxt(dir+model)
    nuv_u = N.zeros_like(sfr)
    u_r = N.zeros_like(sfr)
    total_flux = assign_fluxes.assign_total_flux_numpy(data[0,1:], data[1:,0], data[1:,1:], t*1E9, sfr)
    nuv_u, u_r = get_colours_numpy(t*1E9, total_flux, data)
    nuv_u_age = N.interp(age, t, nuv_u)
    u_r_age = N.interp(age, t, u_r)
    return nuv_u_age, u_r_age
Ejemplo n.º 3
0
def predict_colour_numpy(tq, tau, t):
    # Time, tq and tau are in units of Gyrs 
    time = t.reshape(len(t),1)
    tq = tq.reshape(len(tq),1)
    tau = tau.reshape(len(tau),1)
    sfr = exp_sfh(tau, tq, time)
    a = N.split(sfr,len(tq), axis=2)
    dir ='/Users/becky/Projects/Green-Valley-Project/bc03/models/Padova1994/chabrier/ASCII/'
    model = 'extracted_bc2003_lr_m62_chab_ssp.ised_ASCII'
    data = N.loadtxt(dir+model)
    nuv_u = N.zeros_like(sfr)
    u_r = N.zeros_like(sfr)
    for m in range(len(tq)):
        for n in range(len(tau)):
            total_flux = assign_fluxes.assign_total_flux_numpy(data[0,1:], data[1:,0], data[1:,1:], t*1E9, a[m][n])
            nuv_u[n,:,m], u_r[n,:,m] = get_colours_numpy(t*1E9, total_flux, data)
    return nuv_u, u_r