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)
评论列表
文章目录