polyfit2d

sofia_redux.toolkit.fitting.polynomial.polyfit2d(x, y, z, kx=3, ky=3, full=False)[source]

Least squares polynomial fit to a surface

Parameters:
xarray_like of float

(shape1) x-coordinate independent interpolants

yarray_like of float

(shape1) y-coordinate independent interpolants

zarray_like of float

(shape1) dependent interpolant values

kxint, optional

order of polynomial to fit in the x-direction

kyint, optional

order of polynomial to fit in the y-direction

fullbool, optional

If True, will solve using the full polynomial matrix. Otherwise, will use the upper-left triangle of the matrix. See polyinterp2d for further details. Note that if kx != ky, then the full matrix will be solved for.

Returns:
numpy.ndarray

(ky+1, kx+1) array of polynomial coefficients solveable by poly2d.