leastsquare

astropy.modeling.statistic.leastsquare(measured_vals, updated_model, weights, x, y=None)[source] [edit on github]

Least square statistic with optional weights.

Parameters:
measured_vals : ndarray

Measured data values.

updated_model : Model

Model with parameters set by the current iteration of the optimizer.

weights : ndarray

Array of weights to apply to each residual.

x : ndarray

Independent variable “x” to evaluate the model on.

y : ndarray, optional

Independent variable “y” to evaluate the model on, for 2D models.

Returns:
res : float

The sum of least squares.