splinebox.basis_functions.

Exponential#

class splinebox.basis_functions.Exponential(M)#

Basis function for an exponential spline.

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

The constructor requires M, the number of knots in the spline, as an argument.

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.

refinement_mask()

TODO: This fails the tests.

Examples

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

Create a basis function object:

>>> basis_function = splinebox.basis_functions.Exponential(M=5)

Evaluate the basis function at a single position:

>>> basis_function(0.5)
0.5

Evaluate the basis function at multiple positions simultaneously:

>>> t = np.array([-0.2, 0, 0.5])
>>> basis_function(t)
array([0.687, 0.724, 0.5  ])

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

>>> basis_function(t, derivative=1)
array([ 0.366,  0.   , -0.865])
>>> t = np.linspace(-2.1, 2.1, 500)
>>> plt.plot(t, basis_function(t))
>>> plt.show()
../../_images/splinebox-basis_functions-Exponential-1.png

Tracking the Undulating Motion of C. elegans

Tracking the Undulating Motion of C. elegans

Closed interpolating splines

Closed interpolating splines

Spline to mesh

Spline to mesh

Multivariate splines

Multivariate splines

Approximating a Noisy Signal

Approximating a Noisy Signal