knot_fit

sofia_redux.toolkit.splines.spline_utils.knot_fit(splines, coefficients, start_indices, next_indices, panel_mapping, spline_mapping, knot_steps, panel_shape, k1, weights, values, coordinates)[source]

Calculate the spline fit at each knot location.

Parameters:
splinesnumpy.ndarray (float)

The splines of shape (n_dimensions, n_data, max(k1)).

coefficientsnumpy.ndarray (float)

The spline coefficients of shape (n_coefficients,).

start_indicesnumpy.ndarray (int)

The start indices of the reverse lookup array of shape (n_data,). See create_ordering() for further details.

next_indicesnumpy.ndarray (int)

The “next” indices of the reverse lookup array of shape (n_data,_. See create_ordering() for further details.

panel_mappingnumpy.ndarray (int)

An array containing the panel mapping (flat to n-D) indices. This is created by passing the panel shape (n_knots - (2 * degrees) - 1) into flat_index_mapping(). Should be an array of shape (n_dimensions, n_panels).

spline_mappingnumpy.ndarray (int)

An array containing the spline mapping (flat to n-D) indices. This is created by passing the spline shape (degrees + 1) into flat_index_mapping(). Should be an array of shape (n_dimensions, n_spline_coefficients).

knot_stepsnumpy.ndarray (int)

The flat index mapping steps in knot-space of shape (n_dimensions,). These are returned by passing the shape (n_knots - degrees - 1) into flat_index_mapping().

panel_shapenumpy.ndarray (int)

The panel shape will be defined as n_knots - (2 * k1) + 1 where k1 and n_knots are both of shape (n_dimensions,).

k1numpy.ndarray (int)

An array of shape (n_dimensions,) where k1[dimension] = degree[dimension] + 1.

weightsnumpy.ndarray (float)

The value weights of shape (n_data,).

valuesnumpy.ndarray (float)

The values to fit of shape (n_data,).

coordinatesnumpy.ndarray (float)

The coordinates of each value in each dimension of shape (n_dimensions, n_data).

Returns:
fit, knot_weights, knot_coordinates3-tuple of numpy.ndarray (float)

The fitted value at each knot of shape (n_data,), the knot weights of shape (max_panels,), and the knot coordinates of shape (max_panels,) where max_panels is the maximum number of panels available in the spline fit.