point_aligned_smooth¶
- sofia_redux.scan.utilities.numba_functions.point_aligned_smooth(flat_data, flat_kernel, flat_weight, flat_valid, data_index, kernel_indices, kernel_reference_index, data_shape, data_steps, validated, weighted)[source]¶
Perform direct kernel convolution at a single point.
This low-level function is designed to return the convolved result and associated weight of data with a kernel at a given point, where all kernel points perfectly align with points in the data array.
- Parameters:
- flat_datanumpy.ndarray (float)
A flattened version of N-dimensional data (data.ravel()) of shape (n,).
- flat_kernelnumpy.ndarray (float)
A flattened version of an N-dimensions kernel (kernel.ravel()) of shape (m,).
- 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,).- data_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).
- data_shapenumpy.ndarray (int)
The shape of
data
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,).
- Returns:
- smooth_value, smooth_weightfloat, float
The derived smooth value and associated weight by convolving data with kernel at
data_index
.