def optc(self):
"""
Optimize the coeffs, don't touch the knots
This is the fast guy, one reason to use splines :-)
Returns the chi2 in case you want it (including stabilization points) !
Sets lastr2stab, but not lastr2nostab !
"""
out = si.splrep(self.datapoints.jds, self.datapoints.mags, w=1.0/self.datapoints.magerrs, xb=None, xe=None, k=self.k, task=-1, s=None, t=self.getintt(), full_output=1, per=0, quiet=1)
# We check if it worked :
if not out[2] <= 0:
raise RuntimeError("Problem with spline representation, message = %s" % (out[3]))
self.c = out[0][1] # save the coeffs
#import matplotlib.pyplot as plt
#plt.plot(self.datapoints.jds, self.datapoints.magerrs)
#plt.show()
self.lastr2stab = out[1]
return out[1]
评论列表
文章目录