calculate_distance_weights_from_matrix¶
- sofia_redux.toolkit.resampling.calculate_distance_weights_from_matrix(coordinates, reference, alpha_matrix)[source]¶
Returns distance weights based on coordinate offsets and matrix operation.
Given a set of \(K\) dimensional
coordinates
(\(x\)), a singlereference
position (\(o\)), and the symmetric matrixalpha_matrix
(\(A\)), returns the weighting factor:\[w(x) = exp(-\Delta x^T A \Delta x)\]where \({\Delta x}_k = o_k - x_k\) for dimension \(k\).
- Parameters:
- coordinatesnumpy.ndarray (n_dimensions, n_coordinates)
An array of N coordinates in n_dimensions.
- referencenumpy.ndarray (n_dimensions,)
The reference position from which to determine distance offsets for the weighting function.
- alpha_matrixnumpy.ndarray (n_dimensions, n_dimensions)
Defines the matrix operation to perform on the coordinate offsets. Note that in this implementation, it should be a symmetric matrix such that \(A = A^T\). As such, only the upper triangle is iterated over and any off-diagonal elements in the lower triangle are ignored.
- Returns:
- weightsnumpy.ndarray (N,)
The distance weighting factors.