xscale.signal.fitting.polyfit

xscale.signal.fitting.polyfit(array, deg=1, dim=None, coord=None)

Least squares polynomial fit. Fit a polynomial p(x) = p[deg] * x ** deg + ... + p[0] of degree deg Returns a vector of coefficients p that minimises the squared error.

Parameters:
x : xarray.DataArray

The array to fit

deg : int, optional

Degree of the fitting polynomial, Default is 1.

dim : str, optional

The dimension along which the data will be fitted. If not precised, the first dimension will be used

coord : xarray.Coordinate, optional

The coordinates used to based the fitting on.

Returns:
output : xarray.DataArray

Polynomial coefficients with a new dimension to sort the polynomial coefficients by degree