discrete.py 文件源码

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

项目:CElegansBehaviour 作者: ChristophKirst 项目源码 文件源码
def get_values(self, points = None, parameter = None, derivative = 0, extrapolation = 1):
    """Calculates the values of the spline along the sample points

    Arguments:
      points (array or None): the sample points for the values, if None use internal samples points
      parameter (array or None): the bspline parameter, if None use internal parameter
      derivative (int): the order of the derivative
      extrapolation (int):  0=extrapolated value, 1=return 0, 2=raise a ValueError, 3=boundary value

    Returns:
      array: the values of the spline at the sample points
    """

    points = self.get_points(points, error = 'sample points need to be specified for the calculation of the values of this spline!')      

    if parameter is None:
      parameter = self._parameter;

    if points is self._points and derivative == 0:
      if parameter is self._parameter and self._values is not None: #cached version
        return self._values;
      if self.with_projection:
        return self.projection.dot(parameter);

    # full interpolation
    pp = np.pad(parameter, (0,self.degree+1), 'constant');
    tck = (self._knots_all, pp, self.degree);
    return splev(points, tck, der = derivative, ext = extrapolation);
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号