smooth_value_at

sofia_redux.scan.utilities.numba_functions.smooth_value_at(data, kernel, index, kernel_indices, kernel_reference_index, knots, coefficients, degrees, panel_mapping, panel_steps, knot_steps, nk1, spline_mapping, data_shape, kernel_shape, data_steps, flat_weight, flat_valid, weighted, validated)[source]

Return the convolution of data with a kernel at a single point.

This low-level function basically sorts a convolution of data with kernel at a single point (index) into processing by one of two algorithms. If the index aligns perfectly with a point on the kernel, the direct convolution is calculated via point_aligned_smooth(). Otherwise, a slightly shifted version of the kernel is generated using spline interpolation so that the shifted kernel indices align with those of the data array, and direct convolution is possible. In this case, convolution is performed using point_smooth().

Parameters:
datanumpy.ndarray (float)

The data from which to calculate smoothed values. Must be an array of arbitrary shape, but have n_dimensions.

kernelnumpy.ndarray (float)

The kernel to smooth with. Must be an array of arbitrary shape, but match the same number of dimensions as data.

indexnumpy.ndarray (int or float)

The index on data at which to calculate the smooth value. This should be an array of shape (n_dimensions,) using numpy (y, x) ordering.

kernel_indicesnumpy.ndarray (int)

An array of shape (n_dimensions, kernel.size) as returned by spline_utils.flat_index_mapping(). This gives the N-dimensional kernel index for a flat kernel. I.e., kernel.ravel()[i] is the same as kernel[kernel_indices[i]]. Note that dimensions are ordered using the Numpy (y, x) convention.

kernel_reference_indexnumpy.ndarray (int)

The kernel reference index specifying the center of the kernel. Must be of shape (n_dimensions,) and use numpy dimensional ordering (y, x).

knotsnumpy.ndarray (float)

The knots as calculated by the Spline object on kernel. These should be of shape (n_dimensions, max_knots) where max_knots is the maximum possible number of knots for a spline representation of kernel over all dimensions. Dimensions should be ordered as (x, y).

coefficientsnumpy.ndarray (float)

The spline coefficients of shape (n_coefficients,).

degreesnumpy.ndarray (int)
The spline degrees for each dimension of shape (n_dimensions,).

Dimensions should be ordered as (x, y).

panel_mappingnumpy.ndarray (int)

The panel mapping translation for the spline fit. Should be of shape (n_dimensions, n_panels). Dimensions should be ordered as (x, y).

panel_stepsnumpy.ndarray (int)

The panel steps translation for the spline fit. Should be of shape (n_dimensions,). Dimensions should be ordered as (x, y).

knot_stepsnumpy.ndarray (int)

The spline knot steps translation for the spline fit. Should be of shape (n_dimensions,). Dimensions should be ordered as (x, y).

nk1numpy.ndarray (int)

Another spline mapping parameter which is equal to n_knots - degrees - 1 for the spline. Should be of shape (n_dimensions,). Dimensions should be ordered as (x, y).

spline_mappingnumpy.ndarray (int)

A spline mapping translation for the spline knots. Should be of shape (n_dimensions, max_knots). Dimensions should be ordered as (x, y).

data_shapenumpy.ndarray (int)

The shape of data as an array of shape (n_dimensions,) in Numpy (y, x) order.

kernel_shapenumpy.ndarray (int)

The shape of kernel as an array of shape (n_dimensions,) in Numpy (y, x) order.

data_stepsnumpy.ndarray (int)

An array of shape (n_dimensions,) in Numpy (y, x) order giving the number of elements one would need to jump on a flattened data for a single increment along a given dimension on the ND-array. Please see spline_utils.flat_index_mapping() for further details.

flat_weightnumpy.ndarray (float)

The associated weight values for data, flattened to a single dimension array of shape (data.size,). I.e., flat_weight = weight.ravel(). If no weighting is required, this should be an empty array of shape (0,).

flat_validnumpy.ndarray (bool)

An array marking data values as valid (True) or invalid (False). Any invalid data will not be included in the calculation. This should be a flattened singular dimension array taken from one that was originally the same shape as data and be of shape (data.size,). I.e., flat_valid = valid.ravel(). If no validity checking is required (assumes all data points are valid), set this to an empty array of shape (0,).

weightedbool

If True, indicates that weighting is required and flat_weight should be of shape (data.size,). Otherwise, no weighting is required, and flat_weight may be of shape (0,).

validatedbool

If True, indicates that validity checking is required and flat_valid should be of shape (data.size,). Otherwise, flat_valid may be of shape (0,).

Returns:
smooth_value, smooth_weightfloat, float

The derived smooth value and associated weight by convolving data with kernel at index.