point_smooth¶
- sofia_redux.scan.utilities.numba_functions.point_smooth(flat_data, index, kernel_indices, kernel_reference_index, knots, coefficients, degrees, panel_mapping, panel_steps, knot_steps, nk1, spline_mapping, data_shape, kernel_shape, data_steps, weighted, validated, flat_weight, flat_valid)[source]¶
Convolution with a spline representation of a kernel at a single point.
This is a more complex interpretation of
point_aligned_smooth()
intended for use when convolution occurs at a point on the kernel that does not have an exact value. I.e. we need to calculate the intermediate kernel value between two definite kernel values. For these purposes, spline interpolation is used to derive offset kernel values to be used during convolution. There are many different spline parameters which will need to have been previously defined. However, these can all be calculated easily by creating asofia_redux.toolkit.splines.spline.Spline
representation of the kernel and parsing the various attributes into this function.- Parameters:
- flat_datanumpy.ndarray (float)
A flattened version of N-dimensional data (data.ravel()) of shape (n,).
- indexnumpy.ndarray (int)
The N-D index on the original data array at which to determine the smoothed value. Must be of shape (n_dimensions,) and by in Numpy (y, x) order.
- 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 onkernel
. These should be of shape (n_dimensions, max_knots) where max_knots is the maximum possible number of knots for a spline representation ofkernel
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 seespline_utils.flat_index_mapping()
for further details.- weightedbool
If
True
, indicates that weighting is required andflat_weight
should be of shape (data.size,). Otherwise, no weighting is required, andflat_weight
may be of shape (0,).- validatedbool
If
True
, indicates that validity checking is required andflat_valid
should be of shape (data.size,). Otherwise,flat_valid
may be of shape (0,).- flat_weightnumpy.ndarray (float)
A flattened version of N-dimensional weights (weight.ravel()). If
weighted
isTrue
, must be of shape (n,).- flat_validnumpy.ndarray (bool)
A flattened version of an N-dimensional validity array (valid.ravel()). If
validated
isTrue
, must be of shape (n,).
- Returns:
- smooth_value, smooth_weightfloat, float
The derived smooth value and associated weight by convolving data with spline representation of the kernel at
index
.