polynomial_terms

sofia_redux.toolkit.resampling.polynomial_terms(coordinates, exponents)[source]

Derive polynomial terms given coordinates and polynomial exponents.

Raises a single coordinate or multiple coordinates by a power and then calculates the product over all dimensions. For example, the output of an (x, y) vector with exponent=[[2, 3]] would be \(x^2y^3\).

Note that multiple sets of exponents are expected to be provided during this operation, so the exponents parameter should be a 2-dimensional array. If a single N-dimensional vector is provided, the output will be a 1-dimensional array with a single value for each exponent set. If multiple vectors are provided, the output will be of shape (number of exponent sets, number of vectors).

Parameters:
coordinatesnumpy.ndarray (N, n_vectors) or (N,)

Sets of coordinates in N-dimensions or a single coordinate of N-dimensions.

exponentsnumpy.ndarray (n_exponents, N)

Sets of polynomial exponents to apply to coordinates.

Returns:
numpy.ndarray of numpy.float64 (n_exponents, n_vectors) or (n_exponents,)

The polynomial terms.