§
    fŠtjN"  ã                   ó^  — d Z ddlZddlmZ g d¢Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ Z G d„ de¦  «        Z e¦   «         Zd„ Z G d„ de¦  «        Z e¦   «         Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z G d„ de¦  «        Z e¦   «         Z G d„ d e¦  «        Z  e ¦   «         Z!dS )!zI Collection of Model instances for use with the odrpack fitting package.
é    N)ÚModel)r   ÚexponentialÚmultilinearÚ	unilinearÚ	quadraticÚ
polynomialc                 ó¢   — | d         | dd …         }}|                      |j        d         df¦  «        }|||z                       d¬¦  «        z   S ©Nr   é   ©Úaxis)ÚreshapeÚshapeÚsum)ÚBÚxÚaÚbs       úO/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/odr/_models.pyÚ_lin_fcnr   
   sO   € ØˆQŒ4��1�2�2”€q€AØ	�	Š	�1”7˜1”:˜q�/Ñ"Ô"€Aà��!‘�yŠy˜aˆyÑ Ô Ñ Ð ó    c                 óö   — t          j        |j        d         t          ¦  «        }t          j        ||                     ¦   «         f¦  «        }|                     | j        d         |j        d         f¦  «        S ©Néÿÿÿÿ)ÚnpÚonesr   ÚfloatÚconcatenateÚravelr   )r   r   r   Úress       r   Ú_lin_fjbr!      sW   € Ý
Œ�”˜”�UÑ#Ô#€AÝ
Œ.˜!˜QŸWšW™YœY˜Ñ
(Ô
(€CØ�;Š;˜œ œ Q¤W¨R¤[Ð1Ñ2Ô2Ð2r   c                 ó¬   — | dd …         }t          j        ||j        d         f|j        d         z  d¬¦  «        }|                     |j        ¦  «        S )Nr   r   r   r   )r   Úrepeatr   r   )r   r   r   s      r   Ú_lin_fjdr$      sL   € Ø	ˆ!ˆ"ˆ"Œ€AÝ
Œ	�!�a”g˜b”k�^ A¤G¨B¤KÑ/°aÐ8Ñ8Ô8€AØ�9Š9�Q”WÑÔÐr   c                 ó¢   — t          | j        j        ¦  «        dk    r| j        j        d         }nd}t          j        |dz   ft
          ¦  «        S ©Né   r   r   )Úlenr   r   r   r   r   )ÚdataÚms     r   Ú_lin_estr+      sG   € õ
 ˆ4Œ6Œ<ÑÔ˜AÒÐØŒFŒL˜ŒOˆˆàˆåŒ7�A˜‘E�8�UÑ#Ô#Ð#r   c                 óÈ   — | d         | dd …         }}|                      |j        d         df¦  «        }|t          j        |t          j        ||¦  «        z  d¬¦  «        z   S r
   ©r   r   r   r   Úpower)r   r   Úpowersr   r   s        r   Ú	_poly_fcnr0   *   s]   € ØˆQŒ4��1�2�2”€q€AØ	�	Š	�1”7˜1”:˜q�/Ñ"Ô"€Aà�rŒv�a�"œ( 1 fÑ-Ô-Ñ-°AÐ6Ñ6Ô6Ñ6Ð6r   c                 óþ   — t          j        t          j        |j        d         t          ¦  «        t          j        ||¦  «        j        f¦  «        }|                     | j        d         |j        d         f¦  «        S r   )r   r   r   r   r   r.   Úflatr   )r   r   r/   r    s       r   Ú_poly_fjacbr3   1   sa   € Ý
Œ.�"œ' !¤'¨"¤+­uÑ5Ô5Ýœ( 1 fÑ-Ô-Ô2ð4ñ 5ô 5€Cà�;Š;˜œ œ Q¤W¨R¤[Ð1Ñ2Ô2Ð2r   c                 óÂ   — | dd …         }|                      |j        d         df¦  «        }||z  }t          j        |t          j        ||dz
  ¦  «        z  d¬¦  «        S )Nr   r   r   r-   )r   r   r/   r   s       r   Ú_poly_fjacdr5   7   s]   € Ø	ˆ!ˆ"ˆ"Œ€AØ	�	Š	�1”7˜1”:˜q�/Ñ"Ô"€Aà	ˆF‰
€AåŒ6�!•b”h˜q &¨¡(Ñ+Ô+Ñ+°!Ð4Ñ4Ô4Ð4r   c                 óN   — | d         t          j        | d         |z  ¦  «        z   S ©Nr   r   ©r   Úexp©r   r   s     r   Ú_exp_fcnr;   @   ó#   € ØˆQŒ4•"”&˜˜1œ ™Ñ"Ô"Ñ"Ð"r   c                 óN   — | d         t          j        | d         |z  ¦  «        z  S )Nr   r8   r:   s     r   Ú_exp_fjdr>   D   r<   r   c                 óô   — t          j        t          j        |j        d         t          ¦  «        |t          j        | d         |z  ¦  «        z  f¦  «        }|                     d|j        d         f¦  «        S )Nr   r   r'   )r   r   r   r   r   r9   r   )r   r   r    s      r   Ú_exp_fjbr@   H   s\   € Ý
Œ.�"œ' !¤'¨"¤+­uÑ5Ô5°q½2¼6À!ÀAÄ$ÈÁ(Ñ;KÔ;KÑ7KÐLÑ
MÔ
M€CØ�;Š;˜˜1œ7 2œ;Ð'Ñ(Ô(Ð(r   c                 ó.   — t          j        ddg¦  «        S )Nç      ð?)r   Úarray©r)   s    r   Ú_exp_estrE   M   s   € åŒ8�R˜�HÑÔÐr   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú_MultilinearModelaÎ  
    Arbitrary-dimensional linear model

    .. deprecated:: 1.17.0
        `scipy.odr` is deprecated and will be removed in SciPy 1.19.0. Please use
        `pypi.org/project/odrpack/ <https://pypi.org/project/odrpack/>`_
        instead.


    This model is defined by :math:`y=\beta_0 + \sum_{i=1}^m \beta_i x_i`

    Examples
    --------
    We can calculate orthogonal distance regression with an arbitrary
    dimensional linear model:

    >>> from scipy import odr
    >>> import numpy as np
    >>> x = np.linspace(0.0, 5.0)
    >>> y = 10.0 + 5.0 * x
    >>> data = odr.Data(x, y)
    >>> odr_obj = odr.ODR(data, odr.multilinear)
    >>> output = odr_obj.run()
    >>> print(output.beta)
    [10.  5.]

    c           
      ó„   •— t          ¦   «                              t          t          t          t
          ddddœ¬¦  «         d S )NzArbitrary-dimensional Linearz y = B_0 + Sum[i=1..m, B_i * x_i]z&$y=\beta_0 + \sum_{i=1}^m \beta_i x_i$©ÚnameÚequÚTeXequ)ÚfjacbÚfjacdÚestimateÚmeta)ÚsuperÚ__init__r   r!   r$   r+   ©ÚselfÚ	__class__s    €r   rR   z_MultilinearModel.__init__o   sQ   ø€ Ý‰Œ×ÒÝ�H­H½xØ8Ø;ØEðGð Gð 	ñ 	Hô 	Hð 	Hð 	Hð 	Hr   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__rR   Ú__classcell__©rU   s   @r   rG   rG   R   sK   ø€ € € € € ðð ð8Hð Hð Hð Hð Hð Hð Hð Hð Hr   rG   c                 óP  — t          j        | ¦  «        }|j        dk    rt          j        d|dz   ¦  «        }|                     t          |¦  «        df¦  «        }t          |¦  «        dz   }|fd„}t          t          t          t          ||fdd|dz
  z  d|dz
  z  dœ¬¦  «        S )	az  
    Factory function for a general polynomial model.

    .. deprecated:: 1.17.0
        `scipy.odr` is deprecated and will be removed in SciPy 1.19.0. Please use
        `pypi.org/project/odrpack/ <https://pypi.org/project/odrpack/>`_
        instead.

    Parameters
    ----------
    order : int or sequence
        If an integer, it becomes the order of the polynomial to fit. If
        a sequence of numbers, then these are the explicit powers in the
        polynomial.
        A constant term (power 0) is always included, so don't include 0.
        Thus, polynomial(n) is equivalent to polynomial(range(1, n+1)).

    Returns
    -------
    polynomial : Model instance
        Model instance.

    Examples
    --------
    We can fit an input data using orthogonal distance regression (ODR) with
    a polynomial model:

    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> from scipy import odr
    >>> x = np.linspace(0.0, 5.0)
    >>> y = np.sin(x)
    >>> poly_model = odr.polynomial(3)  # using third order polynomial model
    >>> data = odr.Data(x, y)
    >>> odr_obj = odr.ODR(data, poly_model)
    >>> output = odr_obj.run()  # running ODR fitting
    >>> poly = np.poly1d(output.beta[::-1])
    >>> poly_y = poly(x)
    >>> plt.plot(x, y, label="input data")
    >>> plt.plot(x, poly_y, label="polynomial ODR")
    >>> plt.legend()
    >>> plt.show()

    © r   c                 ó8   — t          j        |ft          ¦  «        S )N)r   r   r   )r)   Úlen_betas     r   Ú	_poly_estzpolynomial.<locals>._poly_est°   s   € åŒw˜�{¥EÑ*Ô*Ð*r   zSorta-general Polynomialz$y = B_0 + Sum[i=1..%s, B_i * (x**i)]z)$y=\beta_0 + \sum_{i=1}^{%s} \beta_i x^i$rI   )rN   rM   rO   Ú
extra_argsrP   )
r   Úasarrayr   Úaranger   r(   r   r0   r5   r3   )Úorderr/   r`   ra   s       r   r   r   z   sÆ   € õ\ ŒZ˜ÑÔ€FØ„|�rÒÐå”˜1˜f q™jÑ)Ô)ˆà�^Š^�S ™[œ[¨!Ð,Ñ-Ô-€FÝ�6‰{Œ{˜Q‰€Hà!)ð +ð +ð +ð +õ •¥+µ[Ø#°°	Ø9Ø>À(È1Á*ÑMØGØ! !™ñ%ð&ð &ð'ñ 'ô 'ð 'r   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú_ExponentialModela§  
    Exponential model

    .. deprecated:: 1.17.0
        `scipy.odr` is deprecated and will be removed in SciPy 1.19.0. Please use
        `pypi.org/project/odrpack/ <https://pypi.org/project/odrpack/>`_
        instead.

    This model is defined by :math:`y=\beta_0 + e^{\beta_1 x}`

    Examples
    --------
    We can calculate orthogonal distance regression with an exponential model:

    >>> from scipy import odr
    >>> import numpy as np
    >>> x = np.linspace(0.0, 5.0)
    >>> y = -10.0 + np.exp(0.5*x)
    >>> data = odr.Data(x, y)
    >>> odr_obj = odr.ODR(data, odr.exponential)
    >>> output = odr_obj.run()
    >>> print(output.beta)
    [-10.    0.5]

    c           
      ó„   •— t          ¦   «                              t          t          t          t
          ddddœ¬¦  «         d S )NÚExponentialzy= B_0 + exp(B_1 * x)z$y=\beta_0 + e^{\beta_1 x}$rI   ©rN   rM   rO   rP   )rQ   rR   r;   r>   r@   rE   rS   s    €r   rR   z_ExponentialModel.__init__×   sQ   ø€ Ý‰Œ×Ò�­½Ý"*Ø'4Ø&=Ø)GðIð Ið 	ñ 	Jô 	Jð 	Jð 	Jð 	Jr   rV   r\   s   @r   rg   rg   ¼   óK   ø€ € € € € ðð ð4Jð Jð Jð Jð Jð Jð Jð Jð Jr   rg   c                 ó*   — || d         z  | d         z   S r7   r^   r:   s     r   Ú_unilinrm   â   s   € ØˆQˆqŒT‰6�A�a”D‰=Ðr   c                 óR   — t          j        |j        t          ¦  «        | d         z  S )Nr   )r   r   r   r   r:   s     r   Ú_unilin_fjdro   æ   s   € ÝŒ7�1”7�EÑ"Ô" Q q¤TÑ)Ð)r   c                 ó¢   — t          j        |t          j        |j        t          ¦  «        f¦  «        }|                     d|j        z   ¦  «        S )N)r'   ©r   r   r   r   r   r   ©r   r   Ú_rets      r   Ú_unilin_fjbrt   ê   s<   € ÝŒ>˜1�bœg a¤g­uÑ5Ô5Ð6Ñ7Ô7€DØ�<Š<˜˜qœw™Ñ'Ô'Ð'r   c                 ó   — dS )N)rB   rB   r^   rD   s    r   Ú_unilin_estrv   ï   s   € Øˆ8r   c                 óB   — ||| d         z  | d         z   z  | d         z   S )Nr   r   r'   r^   r:   s     r   Ú
_quadraticrx   ó   s&   € Øˆa��!”‰f�q˜”t‰mÑ˜q œtÑ#Ð#r   c                 ó0   — d|z  | d         z  | d         z   S r&   r^   r:   s     r   Ú	_quad_fjdrz   ÷   s   € ØˆQ‰3ˆq�Œt‰8�a˜”d‰?Ðr   c                 óª   — t          j        ||z  |t          j        |j        t          ¦  «        f¦  «        }|                     d|j        z   ¦  «        S )N)é   rq   rr   s      r   Ú	_quad_fjbr}   û   sB   € ÝŒ>˜1˜Q™3 ¥2¤7¨1¬7µEÑ#:Ô#:Ð;Ñ<Ô<€DØ�<Š<˜˜qœw™Ñ'Ô'Ð'r   c                 ó   — dS )N)rB   rB   rB   r^   rD   s    r   Ú	_quad_estr      s   € Øˆ:r   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú_UnilinearModela™  
    Univariate linear model

    .. deprecated:: 1.17.0
        `scipy.odr` is deprecated and will be removed in SciPy 1.19.0. Please use
        `pypi.org/project/odrpack/ <https://pypi.org/project/odrpack/>`_
        instead.

    This model is defined by :math:`y = \beta_0 x + \beta_1`

    Examples
    --------
    We can calculate orthogonal distance regression with an unilinear model:

    >>> from scipy import odr
    >>> import numpy as np
    >>> x = np.linspace(0.0, 5.0)
    >>> y = 1.0 * x + 2.0
    >>> data = odr.Data(x, y)
    >>> odr_obj = odr.ODR(data, odr.unilinear)
    >>> output = odr_obj.run()
    >>> print(output.beta)
    [1. 2.]

    c           
      ó„   •— t          ¦   «                              t          t          t          t
          ddddœ¬¦  «         d S )NzUnivariate Linearzy = B_0 * x + B_1z$y = \beta_0 x + \beta_1$rI   rj   )rQ   rR   rm   ro   rt   rv   rS   s    €r   rR   z_UnilinearModel.__init__  sQ   ø€ Ý‰Œ×Ò�­½;Ý"-Ø':Ø&9Ø)FðHð Hð 	ñ 	Iô 	Ið 	Ið 	Ið 	Ir   rV   r\   s   @r   r�   r�     sK   ø€ € € € € ðð ð4Ið Ið Ið Ið Ið Ið Ið Ið Ir   r�   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú_QuadraticModela°  
    Quadratic model

    .. deprecated:: 1.17.0
        `scipy.odr` is deprecated and will be removed in SciPy 1.19.0. Please use
        `pypi.org/project/odrpack/ <https://pypi.org/project/odrpack/>`_
        instead.

    This model is defined by :math:`y = \beta_0 x^2 + \beta_1 x + \beta_2`

    Examples
    --------
    We can calculate orthogonal distance regression with a quadratic model:

    >>> from scipy import odr
    >>> import numpy as np
    >>> x = np.linspace(0.0, 5.0)
    >>> y = 1.0 * x ** 2 + 2.0 * x + 3.0
    >>> data = odr.Data(x, y)
    >>> odr_obj = odr.ODR(data, odr.quadratic)
    >>> output = odr_obj.run()
    >>> print(output.beta)
    [1. 2. 3.]

    c           
      ó„   •— t          ¦   «                              t          t          t          t
          ddddœ¬¦  «         d S )NÚ	Quadraticzy = B_0*x**2 + B_1*x + B_2z&$y = \beta_0 x^2 + \beta_1 x + \beta_2rI   rj   )rQ   rR   rx   rz   r}   r   rS   s    €r   rR   z_QuadraticModel.__init__E  sQ   ø€ Ý‰Œ×ÒÝ�i­yÅ9Ø%Ø5ØGðIð Ið 	ñ 	Jô 	Jð 	Jð 	Jð 	Jr   rV   r\   s   @r   r„   r„   *  rk   r   r„   )"rZ   Únumpyr   Úscipy.odr._odrpackr   Ú__all__r   r!   r$   r+   r0   r3   r5   r;   r>   r@   rE   rG   r   r   rg   r   rm   ro   rt   rv   rx   rz   r}   r   r�   r   r„   r   r^   r   r   ú<module>rŠ      sy  ððð à Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $ðð ð €ð!ð !ð !ð3ð 3ð 3ðð ð ð
$ð 
$ð 
$ð7ð 7ð 7ð3ð 3ð 3ð5ð 5ð 5ð#ð #ð #ð#ð #ð #ð)ð )ð )ð
ð ð ð
"Hð "Hð "Hð "Hð "H˜ñ "Hô "Hð "HðJ  ÐÑ!Ô!€ð?'ð ?'ð ?'ðD Jð  Jð  Jð  Jð  J˜ñ  Jô  Jð  JðF  ÐÑ!Ô!€ðð ð ð*ð *ð *ð(ð (ð (ð
ð ð ð$ð $ð $ðð ð ð(ð (ð (ð
ð ð ð Ið  Ið  Ið  Ið  I�eñ  Iô  Ið  IðF ˆOÑÔ€	ð Jð  Jð  Jð  Jð  J�eñ  Jô  Jð  JðF ˆOÑÔ€	€	€	r   