calculate_adaptive_distance_weights_scaled

sofia_redux.toolkit.resampling.calculate_adaptive_distance_weights_scaled(coordinates, reference, adaptive_alpha)[source]

Returns distance weights based on offsets and scaled adaptive weighting.

Given a set of \(K\) dimensional coordinates (\(x\)), a single reference position (\(x_{ref}\)), and scaling factors adaptive_alpha (\(A\)), returns the weighting factor:

\[w(x) = exp \left( -\sum_{i=1}^{K} \sum_{j=1}^{K} {{\Delta x}_i A_{i,j} {\Delta x}_j} \right)\]

where \({\Delta x}_k = x_{ref, k} - x_k\) for dimension \(k\).

Unlike calculate_distance_weights_from_matrix(), this function applies the function over multiple sets. In this context, a single set will contain the same independent values (coordinates) as all other sets in a reduction, but the dependent data values may vary between sets. Therefore, it is necessary for the adaptive weighting values to also vary between sets.

The algorithm is equivalent to calculate_adaptive_distance_weights_shaped() except when no rotation is applied, and therefore only a 1-dimensional array, rather than a matrix, is required to perform the transform. The third axis of adaptive_alpha is set to one to allow numba to compile the function successfully, also indicating that there is no need to store the off-diagonal elements since they are all zero. All stretching will therefore occur along the dimensional axes.

Parameters:
coordinatesnumpy.ndarray (n_dimensions, n_coordinates)
referencenumpy.ndarray (n_dimensions,)
adaptive_alphanumpy.ndarray

(n_coordinates, n_sets, 1, n_dimensions) array containing the scaled adaptive weighting factors.

Returns:
weightsnumpy.ndarray (n_sets, n_coordinates)

The distance weighting factors.