genDiskMassProbability.py 文件源码

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

项目:EM_Bright 作者: shaonghosh 项目源码 文件源码
def fromPostSamp(self, burn=None, skipHeader=12):
        '''
        This method uses lalinference samples. If not burn value is given then the
        entire posterior sample is used. If the burn option is supplied then the
        initial part of the chain (upto iteration number = burn) is ignored.
        Output is a list whose first two elements are the probability that the primary
        and secondary object is a NS respectively. The third element gives the remnant
        mass outside the black hole in access of the threshold mass supplied.
        '''
        data = np.recfromtxt(self.inputFile, names=True, skip_header=skipHeader)
        burnin = 0
        if burn: burnin = burn
        mc = data['mc'][burnin:]
        massRatio = data['q'][burnin:]
        self.chi = data['a1'][burnin:]
        self.eta = massRatio/((1 + massRatio)**2)
        self.mPrimary = (massRatio**(-0.6)) * mc * (1. + massRatio)**0.2
        self.mSecondary = (massRatio**0.4) * mc * (1. + massRatio)**0.2
        NS_prob_2 = np.sum(self.mSecondary < self.max_ns_g_mass)*100./len(self.mSecondary) # RE: Max NS mass was hardcoded as 3.0. Should be gotten from class variable
        NS_prob_1 = np.sum(self.mPrimary < self.max_ns_g_mass)*100./len(self.mPrimary)
        return [NS_prob_1, NS_prob_2, self.computeRemMass()]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号