def smooth(self, lightcurve):
"""
Only for plotting purposes : returns jds, mlmagshifts, and refmags with a tight and regular sampling,
over the range given by the season.
Note that this time we are interested in the acutal shifted jds, so that it looks right when plotted !
We return arrays that can directly be plotted to illustrate the microlensing.
TODO : return refmag, not refmags !
"""
jds = lightcurve.getjds()[self.season.indices]
# Old method :
if self.mltype == "poly":
refjd = np.mean(jds)
jds -= refjd
refmag = np.median(lightcurve.getmags()) # So the reference magnitude is evaluated from the entire lightcurve.
# Independent on seasons.
smoothtime = np.linspace(jds[0], jds[-1], 50)
smoothml = np.polyval(self.params, smoothtime)
smoothtime += refjd # important, to get the time back at the right place.
refmags = np.zeros(50) + refmag
return {"jds":smoothtime, "ml":smoothml, "refmags":refmags}
# 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
refmag = np.median(lightcurve.getmags()) # So the reference magnitude is evaluated from the entire lightcurve.
# Independent on seasons.
smoothtime = np.linspace(-1, 1, 300)
smoothml = np.zeros(len(smoothtime))
for (n, p) in enumerate(self.params):
smoothml += p * ss.legendre(n)(smoothtime)
smoothtime = smoothtime * rjd + cjd # important, to get the time back at the right place.
refmags = np.zeros(300) + refmag
return {"jds":smoothtime, "ml":smoothml, "refmags":refmags}
评论列表
文章目录