python_codes.DEM_analysis.polyfit2d#

polyfit2d(X, Y, Z, kx, ky, order_max=None)[source]#
Fitting polynomials in 2d dimensions.

Resultant fit can be plotted with: np.polynomial.polynomial.polygrid2d(x, y, p.reshape((kx+1, ky+1)).T)

Parameters
  • X (array_like, shape (M,N)) – 1st coordinate array as output of np.meshgrid.

  • Y (array_like, shape (M,N)) – 2nd coordinate array as output of np.meshgrid.

  • Z (array_like, shape (M,N)) – Surface points to be fitted

  • kx (int) – Degree in the first coordinate.

  • ky (int) – Degree in the second coordinate.

  • order_max (int or None, optional) – If None, all coefficients up to maxiumum kx, ky, ie. up to and including x^kx*y^ky, are considered. If int, coefficients up to a maximum of kx+ky <= order_max are considered (the default is None).

Returns

  • p (ndarray) – Least-squares solution from

  • residuals (ndarray) – Sums of squared residuals.

  • rank (int) – Rank of matrix a.

  • s (ndarray) – Singular values of a.

Examples using python_codes.DEM_analysis.polyfit2d#