Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/ma/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/ma/__pycache__/testutils.cpython-311.pyc

�

�܋f�'�� �dZddlZddlZddlmZmZddlmcmZddl	Zddl	m
Z
mZmZm
Z
mZddlmZmZmZmZmZmZgd�ZddlmZgd	�ZeezZdd
�Zdd�Zd d�Zd�Zd d�Zd d�ZeZ d!d�Z!e!Z"		d"d�Z#d#d�Z$d#d�Z%d$d�Z&d$d�Z'd#d�Z(d d�Z)dS)%z�Miscellaneous functions for testing masked arrays and subclasses

:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: testutils.py 3529 2007-11-13 08:01:14Z jarrod.millman $

�N)�ndarray�float_)�assert_�assert_allclose�assert_array_almost_equal_nulp�
assert_raises�
build_err_msg�)�mask_or�getmask�masked_array�nomask�masked�filled)�almost�approx�assert_almost_equal�assert_array_almost_equal�assert_array_approx_equal�assert_array_compare�assert_array_equal�assert_array_less�assert_close�assert_equal�assert_equal_records�assert_mask_equal�assert_not_equal�fail_if_array_equal)�TestCase)rrrrrT��h㈵��>�:�0�yE>c��tt|��t|����}t|��}t|��}|jjdks|jjdkr'tj||�����Stt|d|���|���	t��}tt|d|���d���	t��}	tjtj
||	z
��||tj
|	��zz��}
|
���S)a�
    Returns true if all components of a and b are equal to given tolerances.

    If fill_value is True, masked values considered equal. Otherwise,
    masked values are considered unequal.  The relative error rtol should
    be positive and << 1.0 The absolute error atol comes into play for
    those elements of b that are very small or zero; it says how small a
    must be also.

    �OF��copy�maskr
)rrr�dtype�char�np�equal�ravelr
�astyper�
less_equal�umath�absolute)�a�b�
fill_value�rtol�atol�m�d1�d2�x�y�ds           �e/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/numpy/ma/testutils.pyrr)s	��	���
�
�G�A�J�J�'�'�A�	����B�	����B�	�x�}����r�x�}��3�3��x��B���%�%�'�'�'��|�B�U��3�3�3�Z�@�@�G�G��O�O�A��|�B�U��3�3�3�Q�7�7�>�>�v�F�F�A�
�
�e�n�Q��U�+�+�T�D�5�>�!�;L�;L�4L�-L�M�M�A��7�7�9�9���c��tt|��t|����}t|��}t|��}|jjdks|jjdkr'tj||�����Stt|d|���|���	t��}tt|d|���d���	t��}tjtj||z
��|��d|zk}	|	���S)z�
    Returns True if a and b are equal up to decimal places.

    If fill_value is True, masked values considered equal. Otherwise,
    masked values are considered unequal.

    r#Fr$r
�$@)
rrrr'r(r)r*r+r
r,r�around�abs)
r0r1�decimalr2r5r6r7r8r9r:s
          r;rr?s���	���
�
�G�A�J�J�'�'�A�	����B�	����B�	�x�}����r�x�}��3�3��x��B���%�%�'�'�'��|�B�U��3�3�3�Z�@�@�G�G��O�O�A��|�B�U��3�3�3�Q�7�7�>�>�v�F�F�A�
�	�"�&��Q��-�-��)�)�T�w�h�-?�?�A��7�7�9�9�r<�c	���tt|��t|��|��tt|����D]%}t||||d|�d|�����&dS)z;
    Asserts the equality of two non-array sequences.

    �item=�
N)r�len�range)�actual�desired�err_msg�ks    r;�_assert_equal_on_sequencesrMRst��
��V���c�'�l�l�G�4�4�4�
�3�w�<�<�
 �
 �F�F���V�A�Y���
�,D�A�,D�,D�7�,D�,D�E�E�E�E�
�Fr<c�<�t|j|j��|jjD]t}tj||��tj||��}}|t
ur?|t
ur6ttj||��tj||�����udS)zI
    Asserts that two records are equal.

    Pretty crude for now.

    N)rr'�names�operator�getitemr)r0r1�f�af�bfs     r;rr]s������!�'�"�"�"�
�W�]�I�I���$�Q��*�*�H�,<�Q��,B�,B�R���f���r�V�|�|���)�!�Q�/�/��1A�!�Q�1G�1G�H�H�H��
�Fr<c	��t|t��r�t|t��s)ttt	|�������tt
|��t
|��|��|���D]@\}}||vrt|�d|�����t||||d|�d|�����AdSt|ttf��r.t|ttf��rt||d���St|t��s>t|t��s)t||g|��}||kst|���dS|tur	|tus|tur-|tur$t||g|dd���}t|���tj|��}tj|��}|j|j}}|jd	krA|jd	kr6t|���|���d���St)|||��S)
z,
    Asserts that two items are equal.

    z not in �key=rFNrC�rK�r8r9)�headerrO�S)�
isinstance�dict�AssertionError�repr�typerrG�items�list�tuplerMrr	r�
ValueErrorr)�
asanyarrayr'r(�tolistr)rIrJrKrL�i�msg�actual_dtype�
desired_dtypes        r;rrlsT���'�4� � ���&�$�'�'�	5� ��d�6�l�l�!3�!3�4�4�4��S��[�[�#�g�,�,��8�8�8��M�M�O�O�	I�	I�D�A�q�����$��%;�%;�6�%;�%;�<�<�<�����G�A�J�0G�q�0G�0G�g�0G�0G�H�H�H�H����'�D�%�=�)�)�G�j��$���.O�.O�G�)�&�'�2�F�F�F�F��v�w�'�'��:�g�w�+G�+G���V�W�-�w�8�8���&� � � ��%�%�%���	�6�	�	�G�v�$5�$5�����&�F�*:�*:��V�W�-�#�B�j�B�B�B����o�o��
�]�6�
"�
"�F��m�G�$�$�G�%+�\�7�=�=�\���C���M�$6�#�$=�$=�)�&�-�-�/�/�*1�.�.�*:�*:�24�6�6�6�	6��f�g�w�7�7�7r<c	���t|t��r�t|t��s)ttt	|�������tt
|��t
|��|��|���D]H\}}||vrtt|�����t||||d|�d|�����IdSt|ttf��r�t|ttf��rott
|��t
|��|��tt
|����D]%}t||||d|�d|�����&dSt|tj��st|tj��rt|||��St||g|��}||kst|���dS)z<
    Raises an assertion error if two items are equal.

    rVrFNrE)r[r\r]r^r_�
fail_if_equalrGr`rarbrHr)rrr	)rIrJrKrLrfrgs      r;rkrk�s���
�'�4� � ���&�$�'�'�	5� ��d�6�l�l�!3�!3�4�4�4��c�&�k�k�3�w�<�<��9�9�9��M�M�O�O�	J�	J�D�A�q�����$�T�!�W�W�-�-�-��&��)�W�Q�Z�1H��1H�1H�w�1H�1H�I�I�I�I����'�D�%�=�)�)��j��$���.O�.O���c�&�k�k�3�w�<�<��9�9�9��s�7�|�|�$�$�	K�	K�A��&��)�W�Q�Z�1I��1I�1I��1I�1I�J�J�J�J����&�"�*�%�%�=��G�R�Z�)H�)H�=�"�6�7�G�<�<�<�
���)�7�
3�
3�C��f����S�!�!�!��r<�c�$�t|tj��st|tj��rt|||||���St	||g||���}tt
||z
��|��dkst|���dS)z~
    Asserts that two items are almost equal.

    The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal).

    )rBrK�verbose)rKrnrN)r[r)rrr	�roundrAr])rIrJrBrKrnrgs      r;rr�s����&�"�*�%�%�K��G�R�Z�)H�)H�K�(���'�18�'�K�K�K�	K�
���)� '��:�:�:�C���W�v�%�&�&��0�0�A�5�5��S�!�!�!�6�5r<c���tt|��t|����}t|d|dd���}t|d|dd���}|tur	|tus|tur.|tur%t	||g|||d���}t|���tj�||�	|��|�	|��|||���S)zn
    Asserts that comparison between two masked arrays is satisfied.

    The comparison is elementwise.

    F)r%r&�	keep_mask�subokrX)rKrnrYrO�rKrnrY)
rrr
rr	rcr)�testingrr)	�
comparisonr8r9rKrnrYr2r5rgs	         r;rr�s���	���
�
�G�A�J�J�'�'�A��Q�U��e�5�I�I�I�A��Q�U��e�5�I�I�I�A�	
�f���q�F�{�{��6�k�k�A��K�K��Q��F�G�W�#)��=�=�=����o�o��
�:�*�*�:�+,�8�8�J�+?�+?�+,�8�8�J�+?�+?�3:�3:�6�	+�K�K�Kr<c�D�ttj||||d���dS)z@
    Checks the elementwise equality of two masked arrays.

    �Arrays are not equalrsN)rrP�__eq__�r8r9rKrns    r;rr�s5��
���!�Q�!(�'� 6�8�8�8�8�8�8r<c�6�d�}t|||||d���dS)zT
    Raises an assertion error if two masked arrays are not equal elementwise.

    c�H�tjt||����S)N)r)�allrrXs  r;�comparez$fail_if_array_equal.<locals>.compare�s���F�6�!�Q�<�<�(�(�(�)r<rwrsN�r)r8r9rKrnr}s     r;rr�s?��
*�*�*���!�Q��� 6�8�8�8�8�8�8r<c�<���fd�}t|||||d���dS)�|
    Checks the equality of two masked arrays, up to given number odecimals.

    The equality is checked elementwise.

    c�0��t||d�z���S)�<Returns the result of the loose comparison between x and y).r?)r3)r�r8r9rBs  �r;r}z*assert_array_approx_equal.<locals>.compare�s����a������1�1�1�1r<�Arrays are not almost equalrsNr~�r8r9rBrKrnr}s  `   r;rr�sL���2�2�2�2�2���!�Q��� =�?�?�?�?�?�?r<c�<���fd�}t|||||d���dS)r�c�&��t||���S)r�)rr�s  �r;r}z*assert_array_almost_equal.<locals>.compares����a��G�$�$�$r<r�rsNr~r�s  `   r;rr�sL���%�%�%�%�%���!�Q��� =�?�?�?�?�?�?r<c�D�ttj||||d���dS)z7
    Checks that x is smaller than y elementwise.

    zArrays are not less-orderedrsN)rrP�__lt__rys    r;rr
s5��
���!�Q�!(�'� =�?�?�?�?�?�?r<c��|turt|tu��|turt|tu��t|||���dS)z-
    Asserts the equality of two masks.

    rWN)rrr)�m1�m2rKs   r;rrsU��

�V�|�|���f�����	�V�|�|���f������r�2�w�/�/�/�/�/�/r<)Tr r!)r=T)rC)rlrCT)rCTrCT)rCT)r=rCT)*�__doc__rP�numpyr)rr�numpy.core.umath�corer.�
numpy.testingrrrrr	rrr
rrr�
__all__masked�unittestr�__some__from_testing�__all__rrrMrrrkrrrrrrrrrr�r<r;�<module>r�s]������������!�!�!�!�!�!�!�!� � � � � � � � � �������������������I�H�H�H�H�H�H�H�H�H�H�H�H�H�H�H����
�����������
�.�
.������,����&�������$8�$8�$8�$8�N"�"�"�"�4!��
"�
"�
"�
"� #��MO�$(�K�K�K�K�28�8�8�8�8�8�8�8�?�?�?�?�?�?�?�?�?�?�?�?�	0�	0�	0�	0�	0�	0r<

Hacked By AnonymousFox1.0, Coded By AnonymousFox