polyinterp2d

sofia_redux.toolkit.fitting.polynomial.polyinterp2d(x, y, z, xout, yout, kx=None, ky=None, order=3, full=False)[source]

Interpolate 2D data using polynomial regression (global)

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

xoutarray_like of float

(shape2) x-coordinates to interpolate to

youtarray_like of float

(shape2) y-coordinates to interpolate to

kxint, optional

order of polynomial to fit in the x-direction

kyint, optional

order of polynomial to fit in the y-direction

orderint, optional

order of polynomial to fit in both the x and y directions if not directly specified via kx or ky

fullbool, optional

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

Returns:
numpy.ndarray

(shape2) z interpolated to (xout, yout)

Notes

If full is False then only the upper-left triangle of polynomial coefficients will be calculated and applied. For example, if order = 3:

F(x,y) = a(0,0) + a(0,1)x + a(0,2)x^2 + a(0,3)x^3 +

a(1,0)y + a(1,1)x.y + a(1,2)y.x^2 + a(2,0)y^2 + a(2,1)x.y^2 + a(3,0)y^3

If full=True or kx != ky then for the order = 3:

F(x,y) = a(0,0) + a(0,1)x + a(0,2)x^2 + a(0,3)x^3 +

a(1,0)y + a(1,1)y.x + a(1,2)y.x^2 + a(1,3)y.x^3 + a(2,0)y^2 + a(2,1)y^2.x + a(2,2)y^2.x^2 + a(2,3)y^2.x^3 + a(3,0)y^3 + a(3,1)y^3.x + a(3,2)y^3.x^2 + a(3,3)y^3.x^3