spl.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:PyCS 作者: COSMOGRAIL 项目源码 文件源码
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]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号