sersic.py 文件源码

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

项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码
def bg_lum_hi(pp, qq):
    # Tested 2011-08-31
    """Exact deprojection of Sersic profile using Meijer G function as
    described by Baes + Gentile 1009.4713.  Use formula valid for half
    integers"""

    if not (pp==int(pp) and qq==int(qq)): raise RuntimeError
    if not (qq == 1 or qq == 2): raise RuntimeError

    pp, qq = int(pp), int(qq)    
    mm = (1.0*pp)/qq
    i0, bb = bg_constants(pp, qq)

    # a and b vectors are specified: [[num1, num2, num3],[denom1,denom2,denom3]]    
    avect = [[], []]
    nums = range(1,2*pp/qq)
    bvect = [[xx/(2.0*mm) for xx in nums] + [0.5], []]
    reff = 1.0

    factor = 2*i0*np.sqrt(mm)/(reff*(2*np.pi)**mm)

    def lum(rr):
        if np.iterable(rr): return np.array([lum(r) for r in rr])
        ss = rr/reff
        zz = (bb/(2*mm))**(2*mm) * ss**2
        return (factor/ss)*mpmath.meijerg(avect, bvect, zz)

    return lum

##################################################
## The big money function is defined right here!  The name conforms to
## naming conventions used throughout this file, but is nearly useless
## to users.  So make it available as luminosity() to users via a line
## in __init__.py since it's likely the only function any user will
## care about.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号