def calcmlmags(self, lightcurve):
"""
Returns a "lc.mags"-like array made using the ml-parameters.
It has the same size as lc.mags, and contains the microlensing to be added to them.
The lightcurve object is not changed !
For normal use, call getmags() from the lightcurve.
Idea : think about only returning the seasons mags to speed it up ? Not sure if reasonable, as no seasons defined outside ?
"""
jds = lightcurve.jds[self.season.indices] # Is this already a copy ? It seems so. So no need for an explicit copy().
# We do not need to apply shifts (i.e. getjds()), as anyway we "center" the jds.
# Old method :
if self.mltype == "poly":
refjd = np.mean(jds)
jds -= refjd # This is apparently safe, it does not shifts the lightcurves jds.
allmags = np.zeros(len(lightcurve.jds))
allmags[self.season.indices] = np.polyval(self.params, jds) # probably faster then +=
return allmags
# Legendre polynomials :
if self.mltype == "leg":
rjd = (np.max(jds) - np.min(jds))/2.0
cjd = (np.max(jds) + np.min(jds))/2.0
jds = (jds - cjd)/rjd
allmags = np.zeros(len(lightcurve.jds))
for (n, p) in enumerate(self.params):
allmags[self.season.indices] += p * ss.legendre(n)(jds)
return allmags
评论列表
文章目录