# leastsquare_2d¶

astropy.modeling.statistic.leastsquare_2d(measured_vals, updated_model, weights, x, y)[source]

Least square statistic with optional weights. Safer than the general leastsquare() for 2D models by avoiding numpy methods that support broadcasting.

Parameters
measured_valsndarray

Measured data values.

updated_modelModel

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

weightsndarray or None

Array of weights to apply to each residual.

xndarray

Independent variable “x” on which to evaluate the model.

yndarray

Independent variable “y” on which to evaluate the model.

Returns
resfloat

The sum of least squares.