def spline(self):
"""
I return a new pycs.gen.spl.Spline object corresponding to the source.
So this is a bit the inverse of the constructor.
You can then put this spline object as ML of a lightcurve, as source spline, or whatever.
Note that my output spline has LOTs of knots... it is an interpolating spline, not a regression spline !
..note:: This spline is a priori for display purposes only. To do an interpolation, it might be safer (and faster) to use
the above linear interpolation eval() function.
But making a plot, you'll see that this spline seems well accurate.
"""
x = self.ijds.copy()
y = self.imags.copy()
magerrs = np.zeros(len(x))
out = si.splrep(x, y, w=None, xb=None, xe=None, k=3, task=0, s=0.0, t=None, full_output=1, per=0, quiet=1)
# s = 0.0 means interpolating spline !
tck = out[0]
# From this we want to build a real Spline object.
datapoints = pycs.gen.spl.DataPoints(x, y, magerrs, splitup=False, sort=False, stab=False)
outspline = pycs.gen.spl.Spline(datapoints, t = tck[0], c = tck[1], k = tck[2], plotcolour=self.plotcolour)
# Conditions for the knots (no, everything is ok with them, no need to tweak anything).
#intt = outspline.getintt()
#outspline.setintt(intt)
#print tck[2]
#sys.exit()
outspline.knottype = "MadeBySource"
outspline.showknots = False # Usually we have a lot of them, slows down.
return outspline
评论列表
文章目录