Esempio n. 1
0
def z09_mstar_lsun(mags,band,color,color_str,redshift,ubv=None,ld=None,close=None):
    '''
    Use the Zibetti 2009 table B1 values
    to estimate stellar mass quickly
    input:
    1. magnitude(s) : array of magnitudes
    if it's ubvri, the mags should be in AB
    2. band(s) : array of strings, in the order of blue->red, don't use u/U band
    3. colors for sdss:u-g~z, g-r~z,r-i,r-z
    4. redshift : 
    set ld if luminosity distance is passed instaed of redshift
    '''
    wav=np.zeros(len(band),dtype=float)
    lband=np.zeros(len(band),dtype=float)    
    mag_dmod = dmod(redshift)
    for i in range(len(band)):
        wav[i]=dict_wav[band[i]]
        lband[i] = (mabs_sun[band[i]] - (mags[i]-mag_dmod))/2.5
    def get_z09pars(band,color_str,ubv=None):
        if not ubv:
            z09=storez09['z09_sdss']
            pars=z09.loc[color_str,band].values
        else:
            z09=storez09['z09_ubv']
            pars=z09.loc[color_str,band].values
        return pars
    mass_band=np.zeros((len(band),len(color_str)),dtype=np.float64)
    for i in range(len(band)):
        for j in range(len(color_str)):
            pars=get_z09pars(band[i],color_str[j],ubv=ubv)
            mass_band[i,j]=lband[i]+pars[0]+pars[1]*color[j]
    if close:storez09.close()
    return mass_band
Esempio n. 2
0
def mstar_k(kmag,z):
    '''
    Use redshift and observed ks-band luminosity to estimate stellar mass
    '''
    dm = dmod(z)
    kmag_abs = kmag-dm
    lk_sun = (3.28-kmag_abs)/2.5
    mass_k = np.log10(0.31)+lk_sun
    return mass_k
Esempio n. 3
0
def mstar_k(kmag, z):
    '''
    Use redshift and observed ks-band luminosity to estimate stellar mass
    '''
    dm = dmod(z)
    kmag_abs = kmag - dm
    lk_sun = (3.28 - kmag_abs) / 2.5
    mass_k = np.log10(0.31) + lk_sun
    return mass_k
Esempio n. 4
0
def z09_mstar_lsun(mags,
                   band,
                   color,
                   color_str,
                   redshift,
                   ubv=None,
                   ld=None,
                   close=None):
    '''
    Use the Zibetti 2009 table B1 values
    to estimate stellar mass quickly
    input:
    1. magnitude(s) : array of magnitudes
    if it's ubvri, the mags should be in AB
    2. band(s) : array of strings, in the order of blue->red, don't use u/U band
    3. colors for sdss:u-g~z, g-r~z,r-i,r-z
    4. redshift : 
    set ld if luminosity distance is passed instaed of redshift
    '''
    wav = np.zeros(len(band), dtype=float)
    lband = np.zeros(len(band), dtype=float)
    mag_dmod = dmod(redshift)
    for i in range(len(band)):
        wav[i] = dict_wav[band[i]]
        lband[i] = (mabs_sun[band[i]] - (mags[i] - mag_dmod)) / 2.5

    def get_z09pars(band, color_str, ubv=None):
        if not ubv:
            z09 = storez09['z09_sdss']
            pars = z09.loc[color_str, band].values
        else:
            z09 = storez09['z09_ubv']
            pars = z09.loc[color_str, band].values
        return pars

    mass_band = np.zeros((len(band), len(color_str)), dtype=np.float64)
    for i in range(len(band)):
        for j in range(len(color_str)):
            pars = get_z09pars(band[i], color_str[j], ubv=ubv)
            mass_band[i, j] = lband[i] + pars[0] + pars[1] * color[j]
    if close: storez09.close()
    return mass_band