astro_tools.py 文件源码

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

项目:scikit-discovery 作者: MITHaystack 项目源码 文件源码
def inv_cdf_dlf(p, A, m1, a1, m2, a2, start=-26, end=-15):

    ''' 
    Inverse Cumulative Schechter function. Second LF is set to be 2*A of first LF.

    @param p: probability
    @param A: Scale factor
    @param m1: Knee of distribution 1
    @param a1: Faint-end turnover of first lf
    @param m2: Knee of distribution 2
    @param a2: Faint-end turnover of second lf
    @param start: Brightest magnitude
    @param end: Faintest possible magnitude

    @return Magnitude associated with cdf probability p
    '''
    def get_root(p):
        return root(lambda x: cdf_dlf(x,A,m1,a1,m2,a2,start)-p, (start + end)/2).x[0]

    if np.isscalar(p):
        return get_root(p)
    else:
        return np.fromiter(map(get_root,p),np.float,count=len(p))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号