def get_points_and_values(self, points = None, parameter = None, derivative = 0, extrapolation = 1, error = None):
"""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: tha sample points
array: the values of the spline at the sample points
"""
points = self.get_points(points, error = error)
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 points, self._values;
if self.with_projection:
return points, self.projection.dot(parameter);
# full interpolation
pp = np.pad(parameter, (0,self.degree+1), 'constant');
tck = (self._knots_all, pp, self.degree);
return points, splev(points, tck, der = derivative, ext = extrapolation);
评论列表
文章目录