B
    îq\€  ã               @   s    d Z ddlZdgZddd„ZdS )z:
Statistic functions used in `~astropy.modeling.fitting`.
é    NÚleastsquarec             C   sP   |dkr||ƒ}n
|||ƒ}|dkr6t  ||  d ¡S t  |||   d ¡S dS )as  
    Least square statistic with optional weights.

    Parameters
    ----------
    measured_vals : `~numpy.ndarray`
        Measured data values.
    updated_model : `~astropy.modeling.Model`
        Model with parameters set by the current iteration of the optimizer.
    weights : `~numpy.ndarray`
        Array of weights to apply to each residual.
    x : `~numpy.ndarray`
        Independent variable "x" to evaluate the model on.
    y : `~numpy.ndarray`, optional
        Independent variable "y" to evaluate the model on, for 2D models.

    Returns
    -------
    res : float
        The sum of least squares.
    Né   )ÚnpÚsum)Zmeasured_valsZupdated_modelZweightsÚxÚyZ
model_vals© r   ú9lib/python3.7/site-packages/astropy/modeling/statistic.pyr      s    

)N)Ú__doc__Znumpyr   Ú__all__r   r   r   r   r	   Ú<module>   s   