discrete.py 文件源码

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

项目:CElegansBehaviour 作者: ChristophKirst 项目源码 文件源码
def projection_matrix(self, points = None, derivative = 0, extrapoltaion = 1):
    """Projection matrix to calucalte spline coefficients via dot product

    Arguments:
      points (array or None): projection matrix for this set of sample points (if None use internal points)
      derivative (int): if n>0 the projection matrix of the n-th derivative is returned
      extrapolation (int): projection matrix with 0=extrapolated value, 1=return 0, 3=boundary value
    """
    points = self.get_points(points, error = 'sample points need to be specified for the calculation of the projection matrix!')

    projection = np.zeros((self._nparameter, points.shape[0]));
    for i in range(self._nparameter):
      p = np.zeros(self._nparameter);
      p[i] = 1;
      pp = np.pad(p, (0,self.degree+1), 'constant'); # splev wants parameter
      tck = (self.knots_all, pp, self.degree);
      projection[i] = splev(points, tck, der = derivative, ext = extrapoltaion);
    return projection.T;
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号