splinebox.basis_functions.

CubicHermite#

class splinebox.basis_functions.CubicHermite#

Basis function for a cubic Hermite spline.

For a detailed theoretical description – including the equation and a plot of the function – refer to the Cubic Hermite basis section in the documentation.

The constructor does not require any arguments.

Note: This basis function is a multigenerator and __call__ returns two values.

Methods

__call__(t[, derivative])

Evaluate the function at position(s) t.

filter_periodic(s)

Returns a filtered version of the input s, used to convert knots into control points for a closed spline.

filter_symmetric(s)

Returns a filtered version of the input s, used to convert knots into control points for an open spline.

h31_autocorrelation(i, j, M)

Derived by V.

h31_periodic_autocorrelation(n, M)

Derived by V.

h32_autocorrelation(i, j, M)

Derived by V.

h32_periodic_autocorrelation(n, M)

Derived by V.

h3_crosscorrelation(i, j, M)

Derived by V.

h3_periodic_crosscorrelation(n, M)

Derived by V.

refinement_mask()

This function is needed for local refinement (see [Badoual2016]).

h31

h31prime

h31primeprime

h32

h32prime

h32primeprime

Examples

>>> import splinebox
>>> import numpy as np
>>> import matplotlib.pyplot as plt

Create a basis function object:

>>> basis_function = splinebox.basis_functions.CubicHermite()

Evaluate the basis function at a single position:

>>> basis_function(0.5)
array([0.5  , 0.125])

Evaluate the basis function at multiple positions simultaneously:

>>> t = np.array([-0.2, 0, 0.5])
>>> basis_function(t)
array([[ 0.896, -0.128],
       [ 1.   ,  0.   ],
       [ 0.5  ,  0.125]])

Compute the first derivative of the basis function at multiple positions:

>>> basis_function(t, derivative=1)
array([[ 0.96,  0.32],
       [-0.  ,  1.  ],
       [-1.5 , -0.25]])
>>> t = np.linspace(-2.1, 2.1, 500)
>>> plt.plot(t, basis_function(t)[0])
>>> plt.plot(t, basis_function(t)[1], linestyle="-.")
>>> plt.show()