ndsplines.NDSpline¶
- class ndsplines.NDSpline(knots, coefficients, degrees, periodic=False, extrapolate=True)¶
Multivariate tensor-product spline in the B-spline basis. A general N dimensional tensor product B-spline is given by
\[S(x_1, ..., x_N) = \sum_{i_1=0}^{n_1-1} \cdots \sum_{i_N=0}^{n_N-1} c_{i_1, ..., i_N} \prod_{j = i}^{N} B_{i_j;k_j,t_j}(x_j)\]where \(B_{i_j;k_j,t_j}\) is the \(i_j\)-th B-spline basis function of degree \(k_j\) over the knots \({t_j}\) with coefficients \(c_{i_1, ..., i_N}\)
- Parameters:
knots (list of ndarrays, shapes=[n_0+degrees[i]+1, ..., n_ndim+degrees[-1]+1], dtype=np.float_) – List of knots in each dimension, \([t_1, t_2, \ldots, t_N]\).
coefficients (ndarray, shape=(n_1, n_2, ..., n_xdim) + yshape, dtype=np.float_) – N-D array of coefficients, \(c_{i_1, ..., i_N}\).
degrees (ndarray, shape=(xdim,), dtype=np.int_) – Array of the degree of each dimension, \([k_1, k_2, \ldots, k_N]\).
periodic (ndarray, shape=(xdim,), dtype=bool) – Array of periodicity flags for each dimension.
extrapolate (ndarray, shape=(xdim,2), dtype=bool) – Array of extrapolation flags for each side in each dimension.
- knots¶
List of knots in each dimension, \([t_1, t_2, \ldots, t_N]\).
- Type:
list of ndarrays, shapes=[n_0+degrees[i]+1, …, n_ndim+degrees[-1]+1], dtype=np.float_
- xdim¶
Dimension of spline input space.
- Type:
int
- coefficients¶
N-D array of coefficients, \(c_{i_1, ..., i_N}\).
- Type:
ndarray, shape=(n_1, n_2, …, n_xdim, ydim), dtype=np.float_
- ydim¶
Dimension of spline output space.
- Type:
int
- yshape¶
Shape of spline output.
- Type:
tuple of ints
- __init__(knots, coefficients, degrees, periodic=False, extrapolate=True)¶
Methods
__init__
(knots, coefficients, degrees[, ...])allocate_workspace_arrays
(num_points)Allocate workspace arrays for the N-dimensional B-spline evaluation.
antiderivative
(dim[, nu])Return NDSpline representing the nu-th antiderivative in the dim-th dimension.
compute_basis_coefficient_selector
(x[, nus])Evaluate the N-dimensional B-spline basis functions and coefficient selectors.
copy
()Return a deep copy of this NDSpline object.
derivative
(dim[, nu])Return NDSpline representing the nu-th derivative in the dim-th dimension.
to_file
(file[, compress])Save attributes of
NDSpline
object to binary file in NumPy.npz
format so that the object can be re-created.Attributes
extrapolate
periodic