calculate_adaptive_distance_weights_shaped

sofia_redux.toolkit.resampling.calculate_adaptive_distance_weights_shaped(coordinates, reference, shape_matrices)[source]

Returns distance weights based on offsets and shaped adaptive weighting.

Given a set of \(K\) dimensional coordinates (\(x\)), a single reference position (\(o\)), and the symmetric matrix shape_matrices (\(A\)), returns the weighting factor:

\[w(x) = exp(-\Delta x^T A^{-1} \Delta x)\]

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

This function is applied to multiple coordinates 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.

Unlike calculate_adaptive_distance_weights_scaled(), the matrix \(A\) allows for the kernel weighting function to be stretched along arbitrarily rotated orthogonal axes.

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

(n_coordinates, n_sets, n_dimensions, n_dimensions) array containing the shaped adaptive weighting matrix for all coordinates and sets.

Returns:
weightsnumpy.ndarray (n_sets, n_coordinates)

The distance weighting factors.