calculate_distance_weights¶
- sofia_redux.toolkit.resampling.calculate_distance_weights(coordinates, reference, alpha)[source]¶
Returns a distance weighting based on coordinate offsets.
Given a set of \(K\) dimensional
coordinates
(\(x\)), a singlereference
position (\(x_{ref}\)), and the scaling factoralpha
(\(\alpha\)), returns the weighting factor:\[w(x) = exp \left( \sum_{k=1}^{K}{\frac{-(x_{ref, k} - x_k)^2}{\alpha_k}} \right)\]- Parameters:
- coordinatesnumpy.ndarray (n_dimensions, N)
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.
- alphanumpy.ndarray (1 or n_dimensions,)
The distance scaling factor. If an array of size 1 is supplied, it will be applied over all dimensions. Otherwise, a value must be provided for each dimension.
- Returns:
- weightsnumpy.ndarray (N,)
The distance weighting factors.
Notes
alpha
relates to the standard deviation (\(\sigma\)) in a normal distribution as \(\alpha = 2\sigma^2\).