draw.py 文件源码

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

项目:PyCS 作者: COSMOGRAIL 项目源码 文件源码
def shareflux(lc1, lc2, frac=0.01):
    """
    I add "noise" to lc1 and lc2 by randomly sharing flux between the two sources.

    :param frac: The stddev of the gaussian "noise" in flux, with respect to the minimum flux in the curves.

    """
    if not np.all(lc1.jds == lc2.jds):
        raise RuntimeError("I do only work on curves with identical jds !")

    #lc1fs = lc1.getrawfluxes()
    #lc2fs = lc2.getrawfluxes()

    minshift = np.fabs(max(lc1.getminfluxshift(), lc2.getminfluxshift()))
    shifts = frac * minshift * np.random.randn(len(lc1))
    shifts = np.clip(shifts, -minshift+1.0, minshift-1.0) # To garantee that we won't get negative fluxes


    lc1.addfluxes(shifts)
    lc2.addfluxes(-shifts)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号