MODEL_AGNfitter.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:AGNfitter 作者: GabrielaCR 项目源码 文件源码
def stellar_info(chain, data):

    """
    computes stellar masses and SFRs
    """

    gal_do,  irlum_dict, nh_dict, BBebv_dict, SFRdict = data.dictkey_arrays #call dictionary info

    #relevanta parameters form the MCMC chain
    tau_mcmc = chain[:,0]     
    age_mcmc = chain[:,1] 
    GA = chain[:,6] - 18. #1e18 is the common normalization factor used in parspace.ymodel in order to have comparable NORMfactors    

    z = data.z
    distance = z2Dlum(z)

    #constants
    solarlum = const.L_sun.to(u.erg/u.second) #3.839e33
    solarmass = const.M_sun

    Mstar_list=[]
    SFR_list=[]


    for i in range (len (tau_mcmc)):        
        N = 10**GA[i]* 4* pi* distance**2 / (solarlum.value)/ (1+z)

        gal_do.nearest_par2dict(tau_mcmc[i], 10**age_mcmc[i], 0.)
        tau_dct, age_dct, ebvg_dct=gal_do.t, gal_do.a,gal_do.e
        SFR_mcmc =SFRdict[tau_dct, age_dct]

        # Calculate Mstar. BC03 templates are normalized to M* = 1 M_sun. 
        # Thanks to Kenneth Duncan, and his python version of BC03, smpy
        Mstar = np.log10(N * 1) 
        #Calculate SFR. output is in [Msun/yr]. 
        SFR = N * SFR_mcmc
        SFR_list.append(SFR.value)    
        Mstar_list.append(Mstar)    

    return np.array(Mstar_list)    , np.array(SFR_list)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号