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);
评论列表
文章目录