sed.py 文件源码

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

项目:nmmn 作者: rsnemmen 项目源码 文件源码
def ion(self):
        """
    Calculates the rate of ionizing photons in the SED.

    >>> q=s.ion()
        """
        import scipy.integrate
        import scipy.stats
        h=6.62607e-27   # Planck constant in CGS

        # Performs interpolation before integrating. This is a precaution in 
        # case the user specify weird integration limits.           
        if not hasattr(self, 'nlnui'): self.interp()

        # 13.6 eV - "infty"
        xi, xf = 15.52, 22.

        # Gets only the elements corresponding to ionizing frequencies
        i=numpy.where((self.lognui>=xi) & (self.lognui<=xf))
        x,y = self.lognui[i],self.lli[i]    # easier notation

        # Calculates ionizing rate using integration (trapezoidal rule)
        q=scipy.integrate.trapz(self.nlnui[i]/self.nui[i]/(h*self.nui[i]), self.nui[i])

        return q
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号