Basis functions#

All of your basis functions inherit from the base class BasisFunction.

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 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 spline passing through the knots provided.

refinement_mask()#

This function is needed for local refinement (see [Badoual2016]). Basis splines with the ‘local refinement property’ can be expressed as a linear combination of themselfs. This is useful when you iteratively want to refine your spline with additional knots in a given interval.