polynd

sofia_redux.toolkit.fitting.polynomial.polynd(v, coefficients, exponents=None, covariance=None, product=None, info=None)[source]

Evaluate a polynomial in multiple features

Parameters:
varray_like of float (ndim, npoints)

where v[dimension] contains the independent values for the given dimension at which to evaluate the coefficients.

coefficientsarray_like of float

(ncoeffs,) or (full_poly_shape) array of polynomial coefficients. If exponents is not supplied, then a full set of polynomial coefficients will be generated based on the shape of coefficients. Otherwise, the number of coefficients should match exponents.shape[0].

exponentsarray_like of int, optional

(ncoeffs, ndim) array of polynomial exponents. If not supplied will be generated using polynomial_exponents based on the shape of coefficients. Note that in this case we must return the full set of polynomial coefficients. The dimensional order of the exponents should match the dimensional order of v.

covariancearray_like of float (ncoeffs, ncoeffs), optional

Covariance matrix. var will be output in addition to z if supplied.

productnumpy.ndarray of numpy.float64

Pre-computed products the powers for each exponent.

infodict, optional

If provided will be updated with exponents and product.

Returns:
z, [var]numpy.ndarray, [numpy.ndarray]

z are coefficients evaluated at v. If covar was provided then the variance is also returned.