basis_functions#
This submodule provides a wide range of basis functions implemented as classes.
Each of these classes inherites from the the abstrac base class splinebox.basis_functions.BasisFunction described below and
should overwrite the following class methods:
splinebox.basis_functions.BasisFunction.filter_summetric()
Currently the following basis functions are implemented: B1, B2, B2, Exponential, Catmull Rom, Cubic Hermite, Exponential Hermite
- class splinebox.basis_functions.BasisFunction(multigenerator, support)#
Base class for all basis functions.
Parameters#
- multigeneratorboolean
This indicates if the basis function generates multiple outputs. In practice, this is used to indicate if a basis function is meant for a Hermite spline or not. Basis functions for Hermite splines return two values instead of one.
- supportfloat
The support of the function, i.e. the size of the area being mapped to non-zero values.
- eval(t, derivative=0)#
Evaluate the function at position(s) t.
Parameters#
- tfloat or numpy.array
The points where the function should be evaluated.
- derivative[0, 1, 2], default = 0
Whether to evaluate the function (0) or its first (1) or second (2) derivative.
Returns#
- ynumpy.array
Values of the function or its first or second derivative at position(s) t.
- filter_periodic(s)#
The filter used to turn knots into control points for a closed spline.
Parameters#
- snumpy.array
An array of knots of shape (n, dim) where n is the number of knots and dim is the dimensionality of the codomain, i.e. the space in which the curve lives. Note that the knots should be padded.
Returns#
- control_pointsnumpy.array
The control points for the spline passing through the knots provided.
- filter_symmetric(s)#
The filter used to turn knots into control points for an open spline.
Parameters#
- snumpy.array
An array of knots of shape (n, dim) where n is the number of knots and dim is the dimensionality of the codomain, i.e. the space in which the curve lives. Note that the knots should be padded.
Returns#
- control_pointsnumpy.array
The control points for the spline passing through the knots provided.