Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
extras.cpython-313.pyc1536 linesDownload Raw Back to __pycache__
1�

2z�j���3�Sr/SQrSSKrSSKrSSKrSSKrSSKJrJ	r	 SSK4Jr SSKJ
r
 SSKJrJr SS	KJr SS5KJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r' Sr(S<Sjr)\*4S
jr+Sr,Sr-\-S5r.\-S5r/\-S5r0\0"\Rb5r1\0"\Rd5r2\0"\Rf5r3\/"\Rh5=r4r5\/"\Rl5r6\/"\Rn5r7\/"\Rp5r8\/"\Rr5r9\."\Rt5r:\."\Rv5r;Sr<Sr=\RzR\=lSr>\>RbR\R|RS\R|RRS5R�5S-\>lS=\R�S.SjjrBS>SjrCS=SjrDS<SjrES<SjrFSrGSrHS<S jrI\R�4S!jrJ\R�4S"jrKS?S#jrLS@S$jrMSAS%jrNSAS&jrOS@S'jrPS@S(jrQS)rRSAS*jrSSBS+jrTSCS,jrUSBS-jrV"S.S/\
5rW"S0S1\W5rX\X"5rYSDS2jrZS3r[S<S4jr\S5r]S<S6jr^S7r_S8r`S9raS<S:jrb\R�"\R�R\bR5\blSES;jrd\R�"\R�R\dR5\dlg)Fz�6Masked arrays add-ons.7 8A collection of utilities for `numpy.ma`.9 10:author: Pierre Gerard-Marchant11:contact: pierregm_at_uga_dot_edu12 13).�apply_along_axis�apply_over_axes�14atleast_1d�15atleast_2d�16atleast_3d�average�clump_masked�clump_unmasked�column_stack�
compress_cols�compress_nd�compress_rowcols�
compress_rows�count_masked�corrcoef�cov�diagflat�dot�dstack�ediff1d�flatnotmasked_contiguous�flatnotmasked_edges�hsplit�hstack�isin�in1d�intersect1d�	mask_cols�mask_rowcols�	mask_rows�17masked_all�masked_all_like�median�mr_�ndenumerate�notmasked_contiguous�notmasked_edges�polyfit�	row_stack�	setdiff1d�setxor1d�stack�unique�union1d�vander�vstack�N)�array�ndarray)�_ureduce)�AxisConcatenator)�normalize_axis_index�normalize_axis_tuple�)�core)�MAError�MaskedArray�addr1�asarray�concatenate�countr�filled�get_masked_subclass�getdata�getmask�getmaskarray�make_mask_descr�mask_or�masked�masked_array�nomask�ones�sort�zerosc�8�[U[[[45$)z.18Is seq a sequence (ndarray, list or tuple)?19 20)�21isinstancer2�tuple�list)�seqs �UD:\code\apps\devtools\python\user_packages\Python313\site-packages\numpy/ma/extras.py�22issequencerR:s��23�c�G�U�D�1�2�2�c�:�[U5nURU5$)a 24Count the number of masked elements along the given axis.25 26Parameters27----------28arr : array_like29    An array with (possibly) masked elements.30axis : int, optional31    Axis along which to count. If None (default), a flattened32    version of the array is used.33 34Returns35-------36count : int, ndarray37    The total number of masked elements (axis=None) or the number38    of masked elements along each slice of the given axis.39 40See Also41--------42MaskedArray.count : Count non-masked elements.43 44Examples45--------46>>> import numpy as np47>>> a = np.arange(9).reshape((3,3))48>>> a = np.ma.array(a)49>>> a[1, 0] = np.ma.masked50>>> a[1, 2] = np.ma.masked51>>> a[2, 1] = np.ma.masked52>>> a53masked_array(54  data=[[0, 1, 2],55        [--, 4, --],56        [6, --, 8]],57  mask=[[False, False, False],58        [ True, False,  True],59        [False,  True, False]],60  fill_value=999999)61>>> np.ma.count_masked(a)62363 64When the `axis` keyword is used an array is returned.65 66>>> np.ma.count_masked(a, axis=0)67array([1, 1, 1])68>>> np.ma.count_masked(a, axis=1)69array([0, 2, 1])70 71)rC�sum)�arr�axis�ms   rQrrBs��d	�S��A��5�5��;�rSc	�~�[[R"X5[R"U[	U55S9nU$)a'72Empty masked array with all elements masked.73 74Return an empty masked array of the given shape and dtype, where all the75data are masked.76 77Parameters78----------79shape : int or tuple of ints80    Shape of the required MaskedArray, e.g., ``(2, 3)`` or ``2``.81dtype : dtype, optional82    Data type of the output.83 84Returns85-------86a : MaskedArray87    A masked array with all data masked.88 89See Also90--------91masked_all_like : Empty masked array modelled on an existing array.92 93Notes94-----95Unlike other masked array creation functions (e.g. `numpy.ma.zeros`,96`numpy.ma.ones`, `numpy.ma.full`), `masked_all` does not initialize the97values of the array, and may therefore be marginally faster. However,98the values stored in the newly allocated array are arbitrary. For99reproducible behavior, be sure to set each element of the array before100reading.101 102Examples103--------104>>> import numpy as np105>>> np.ma.masked_all((3, 3))106masked_array(107  data=[[--, --, --],108        [--, --, --],109        [--, --, --]],110  mask=[[ True,  True,  True],111        [ True,  True,  True],112        [ True,  True,  True]],113  fill_value=1e+20,114  dtype=float64)115 116The `dtype` parameter defines the underlying data type.117 118>>> a = np.ma.masked_all((3, 3))119>>> a.dtype120dtype('float64')121>>> a = np.ma.masked_all((3, 3), dtype=np.int32)122>>> a.dtype123dtype('int32')124 125��mask)rG�np�emptyrIrD)�shape�dtype�as   rQr r xs3��p	�R�X�X�e�+��'�'�%���)?�@�	B�A��HrSc���[R"U5R[5n[R"UR126[
UR5S9UlU$)a�127Empty masked array with the properties of an existing array.128 129Return an empty masked array of the same shape and dtype as130the array `arr`, where all the data are masked.131 132Parameters133----------134arr : ndarray135    An array describing the shape and dtype of the required MaskedArray.136 137Returns138-------139a : MaskedArray140    A masked array with all data masked.141 142Raises143------144AttributeError145    If `arr` doesn't have a shape attribute (i.e. not an ndarray)146 147See Also148--------149masked_all : Empty masked array with all elements masked.150 151Notes152-----153Unlike other masked array creation functions (e.g. `numpy.ma.zeros_like`,154`numpy.ma.ones_like`, `numpy.ma.full_like`), `masked_all_like` does not155initialize the values of the array, and may therefore be marginally156faster. However, the values stored in the newly allocated array are157arbitrary. For reproducible behavior, be sure to set each element of the158array before reading.159 160Examples161--------162>>> import numpy as np163>>> arr = np.zeros((2, 3), dtype=np.float32)164>>> arr165array([[0., 0., 0.],166       [0., 0., 0.]], dtype=float32)167>>> np.ma.masked_all_like(arr)168masked_array(169  data=[[--, --, --],170        [--, --, --]],171  mask=[[ True,  True,  True],172        [ True,  True,  True]],173  fill_value=np.float64(1e+20),174  dtype=float32)175 176The dtype of the masked array matches the dtype of `arr`.177 178>>> arr.dtype179dtype('float32')180>>> np.ma.masked_all_like(arr).dtype181dtype('float32')182 183�r_)	r\�184empty_like�viewr:rIr^rDr_�_mask)rVr`s  rQr!r!�sB��v	�
�
�c�����,�A��g�g�a�g�g�_�Q�W�W�%=�>�A�G��HrSc�^�U4SjnU$)a�185Decorator to wrap a "_fromnxfunction" function, wrapping a numpy function as a186masked array function, with proper docstring and name.187 188Parameters189----------190_fromnxfunction : ({params}) -> ndarray, {params}) -> masked_array191    Wrapper function that calls the wrapped numpy function192 193Returns194-------195decorator : (f: ({params}) -> ndarray) -> ({params}) -> masked_array196    Function that accepts a numpy function and returns a masked array function197 198c�>^�UU4Sjn[R"UTSS9 [R"TRS5UlU$)Nc�>�T"T/UQ70UD6$�N�)�args�kwargs�_fromnxfunction�npfuncs  ��rQ�wrapper�<_fromnxfunction_function.<locals>.decorator.<locals>.wrapper199s���"�6�;�D�;�F�;�;rS)�__name__�__qualname__)�assignedzHThe function is applied to both the ``_data`` and the ``_mask``, if any.)�	functools�update_wrapper�ma�doc_note�__doc__)rnrorms` �rQ�	decorator�+_fromnxfunction_function.<locals>.decorator	s>���	<�	� � ��&�;W�X��+�+��N�N�V�200����rSrj)rmrys` rQ�_fromnxfunction_functionr{�s��� 	��rSc�x�[U"[R"U5/UQ70UD6U"[U5/UQ70UD6S9$)z�201Wraps a NumPy function that can be called with a single array argument followed by202auxiliary args that are passed verbatim for both the data and mask calls.203��datar[�rGr\r<rC)rnr`rkrls    rQ�_fromnxfunction_singler�sA���
�B�J�J�q�M�
3�D�
3�F�
3�
�L��O�
5�d�
5�f�
5��rSc	�~�[U"[SU55/UQ70UD6U"[SU55/UQ70UD6S9$)z�204Wraps a NumPy function that can be called with a single sequence of arrays followed205by auxiliary args that are passed verbatim for both the data and mask calls.206c3�N# �UHn[R"U5v� M g7fri)r\r<��.0r`s  rQ�	<genexpr>�&_fromnxfunction_seq.<locals>.<genexpr>*s���6��A�"�*�*�Q�-�-��s�#%c3�8# �UHn[U5v� M g7fri)rCr�s  rQr�r�+s���8�4�a�,�q�/�/�4�s�r})rGrN)rn�arysrkrls    rQ�_fromnxfunction_seqr�#sK���
�E�6��6�6�
H��
H��
H�
�E�8�4�8�8�
J�4�
J�6�
J��rSc�^^^�[UU4SjU55n[U5S:XaUS$U$)a�207Wraps a NumPy function that can be called with multiple array arguments.208All args are converted to arrays even if they are not so already.209This makes it possible to process scalars as 1-D arrays.210Only keyword arguments are passed through verbatim for the data and mask calls.211Arrays arguments are processed independently and the results are returned in a list.212If only one arg is present, the return value is just the processed array instead of213a list.214c	3�># �UH:n[T"[R"U540TD6T"[U540TD6S9v� M< g7f)r}Nr)r�r`rlrns  ��rQr��*_fromnxfunction_allargs.<locals>.<genexpr>9sG�����215�A�		���216�217�1�
�0��0���Q��2�6�2�	218��s�AAr7r0)rN�len)rnr�rl�outs` ` rQ�_fromnxfunction_allargsr�.s9�����219���C���X��]�3�q�6�+��+rSc��SnU[U5:waG[XS5(aXXUS-&[XS5(aMUS-
nU[U5:waMGU$)zFlatten a sequence in place.r0�__iter__r7)r��hasattr)rP�ks  rQ�flatten_inplacer�Ts^��	�A���C��=��c�f�j�)�)� �V�C�1�q�5�N��c�f�j�)�)�	�Q���
��C��=��JrSc�x	�[USSS9nURn[X5nS/US-220-n[R"US5n[[
U55nURU5 [SS5Xq'[R"UR5RU5n	URX�5 U"U[UR55/UQ70UD6n221[R"U2225nU(d[!U2235 /nU(Ga4UR%[R"U2245R&5 [	U	[(5n
X�[U5'[R*"U	5nSnX�:a�US==S-
ss'SnUUU	U:�a:USU-225:�a1UUS-226==S-
ss'SUU'US-nUUU	U:�aUSU-227:�aM1URX�5 U"U[UR55/UQ70UD6n228X�[U5'UR%[U2295R&5 US-
nX�:aM�GO�[U230SSS9n231UR-5n[SS5/U232R-UU'URX�5 [R*"U	5nU	n[UR5n	U233RX�'UR%[U2345R&5 [/U	5n	[	U	[(5n
X�[[/UR555'SnX�:a�US==S-
ss'SnUUUU:�a:USU-235:�a1UUS-236==S-
ss'SUU'US-nUUUU:�aUSU-237:�aM1URX�5 URX�5 U"U[UR55/UQ70UD6n238X�[[/UR555'UR%[U2395R&5 US-
nX�:aM�[R&"[R"U5R155n[3US	5(d[R"U
US2409nU$[U
US2419n[4R6"U5UlU$!["a SnGN�f=f)z(242(This docstring should be overwritten)243FT)�copy�subokr0r7�ON�����rerb)r1�ndimr5r\rKrO�range�remove�slicer<r^�take�putrN�tolist�isscalarr��	TypeError�appendr_�object�prodr�r��maxr�rv�default_fill_value�244fill_value)�func1drWrVrkrl�nd�ind�i�indlist�outshape�res�asscalar�dtypes�outarr�Ntotr��n�j�	holdshape�245max_dtypes�results                     rQrr^s����%�t�246,�C�	���B���)�D��#��a��.�C�247����S��A��5��9�o�G��N�N�4���D�$��A�G��z�z�#�)�)�$�)�)�'�2�H��E�E�'��248��U�1�8�8�:�&�'�2499�$�2509�&�2519�C��{�{�3��H��	���H��F���
�
�b�j�j��o�+�+�,��x��(�� �u�S�z���w�w�x� ��
���h���G�q�L�G��A��q�6�X�a�[�(�q�A��F�|��A��E�252�a��253���A���Q����q�6�X�a�[�(�q�A��F�|�
�E�E�'����U�1�8�8�:�.�/�A�$�A�&�A�C�!$�5��:���M�M�'�#�,�,�,�-�
��F�A��h���C�e�4�0��
�F�F�H���$��%�&����1��$��	���g���w�w�x� ���	���	�	�?��������
�
�g�c�l�(�(�)�"�8�,���x��(��58�u�_�Q�X�X�Z�0�1�2�
���h���G�q�L�G��A��q�6�Y�q�\�)��Q��V���A��E�254�a��255���A���Q����q�6�Y�q�\�)��Q��V��
�E�E�'��
�E�E�'����U�1�8�8�:�.�/�A�$�A�&�A�C�9<�5������4�5�6��M�M�'�#�,�,�,�-�
��F�A��h����"�*�*�V�,�0�0�2�3�J��3�� � ����F�*�5���M���z�2���1�1�&�9����M��w�	��H�	�s�:R)�)R9�8R9c�X�[U5nURn[U5RS:XaU4nUHpnUS:aXE-nX54nU"U6nURUR:XaUnM3[R"Xu5nURUR:XaUnMg[S5e U$)z&256(This docstring will be overwritten)257r0z7function is not returning an array of the correct shape)r<r�r1rv�expand_dims�258ValueError)�funcr`�axes�val�NrWrkr�s        rQrr�s����!�*�C�	���A��T�{���1���w�����!�8��8�D��{���D�k���8�8�s�x�x���C��.�.��+�C��x�x�3�8�8�#��� �"8�9�9���JrS�Notesa�259 260    Examples261    --------262    >>> import numpy as np263    >>> a = np.ma.arange(24).reshape(2,3,4)264    >>> a[:,0,1] = np.ma.masked265    >>> a[:,1,:] = np.ma.masked266    >>> a267    masked_array(268      data=[[[0, --, 2, 3],269             [--, --, --, --],270             [8, 9, 10, 11]],271            [[12, --, 14, 15],272             [--, --, --, --],273             [20, 21, 22, 23]]],274      mask=[[[False,  True, False, False],275             [ True,  True,  True,  True],276             [False, False, False, False]],277            [[False,  True, False, False],278             [ True,  True,  True,  True],279             [False, False, False, False]]],280      fill_value=999999)281    >>> np.ma.apply_over_axes(np.ma.sum, a, [0,2])282    masked_array(283      data=[[[46],284             [--],285             [124]]],286      mask=[[[False],287             [ True],288             [False]]],289      fill_value=999999)290 291    Tuple axis arguments to ufuncs are equivalent:292 293    >>> np.ma.sum(a, axis=(0,2)).reshape((1,-1,1))294    masked_array(295      data=[[[46],296             [--],297             [124]]],298      mask=[[[False],299             [ True],300             [False]]],301      fill_value=999999)302    )�keepdimsc�`^^�[T5m[T5nTb[TTRSS9mU[R303La0nOSU0nUc?TR"T40UD6nURRTRT55nGO�[U5n	[TRR[R[R45(a-[R"TRU	RS5n304O+[R"TRU	R5n305TRU	R:wa�Tc[S5eU	R[!U4SjT55:wa[#S5eU	R%[R&"T55n	U	R)[!U4Sj[+TR5555n	U[,La/U	TR.)-n	U	=R.TR.-slU	R0"STU306S	.UD6n[R2"TU	U307S3089R0"T40UD6U-nU(aKURUR:wa.[R4"X�R5R75nXx4$U$)a�309Return the weighted average of array over the given axis.310 311Parameters312----------313a : array_like314    Data to be averaged.315    Masked entries are not taken into account in the computation.316axis : None or int or tuple of ints, optional317    Axis or axes along which to average `a`.  The default,318    `axis=None`, will average over all of the elements of the input array.319    If axis is a tuple of ints, averaging is performed on all of the axes320    specified in the tuple instead of a single axis or all the axes as321    before.322weights : array_like, optional323    An array of weights associated with the values in `a`. Each value in324    `a` contributes to the average according to its associated weight.325    The array of weights must be the same shape as `a` if no axis is326    specified, otherwise the weights must have dimensions and shape327    consistent with `a` along the specified axis.328    If `weights=None`, then all data in `a` are assumed to have a329    weight equal to one.330    The calculation is::331 332        avg = sum(a * weights) / sum(weights)333 334    where the sum is over all included elements.335    The only constraint on the values of `weights` is that `sum(weights)`336    must not be 0.337returned : bool, optional338    Flag indicating whether a tuple ``(result, sum of weights)``339    should be returned as output (True), or just the result (False).340    Default is False.341keepdims : bool, optional342    If this is set to True, the axes which are reduced are left343    in the result as dimensions with size one. With this option,344    the result will broadcast correctly against the original `a`.345    *Note:* `keepdims` will not work with instances of `numpy.matrix`346    or other classes whose methods do not support `keepdims`.347 348    .. versionadded:: 1.23.0349 350Returns351-------352average, [sum_of_weights] : (tuple of) scalar or MaskedArray353    The average along the specified axis. When returned is `True`,354    return a tuple with the average as the first element and the sum355    of the weights as the second element. The return type is `np.float64`356    if `a` is of integer type and floats smaller than `float64`, or the357    input data-type, otherwise. If returned, `sum_of_weights` is always358    `float64`.359 360Raises361------362ZeroDivisionError363    When all weights along axis are zero. See `numpy.ma.average` for a364    version robust to this type of error.365TypeError366    When `weights` does not have the same shape as `a`, and `axis=None`.367ValueError368    When `weights` does not have dimensions and shape consistent with `a`369    along specified `axis`.370 371Examples372--------373>>> import numpy as np374>>> a = np.ma.array([1., 2., 3., 4.], mask=[False, False, True, True])375>>> np.ma.average(a, weights=[3, 1, 0, 0])3761.25377 378>>> x = np.ma.arange(6.).reshape(3, 2)379>>> x380masked_array(381  data=[[0., 1.],382        [2., 3.],383        [4., 5.]],384  mask=False,385  fill_value=1e+20)386>>> data = np.arange(8).reshape((2, 2, 2))387>>> data388array([[[0, 1],389        [2, 3]],390       [[4, 5],391        [6, 7]]])392>>> np.ma.average(data, axis=(0, 1), weights=[[1./4, 3./4], [1., 1./2]])393masked_array(data=[3.4, 4.4],394         mask=[False, False],395   fill_value=1e+20)396>>> np.ma.average(data, axis=0, weights=[[1./4, 3./4], [1., 1./2]])397Traceback (most recent call last):398    ...399ValueError: Shape of weights must be consistent400with shape of a along specified axis.401 402>>> avg, sumweights = np.ma.average(x, axis=0, weights=[1, 2, 3],403...                                 returned=True)404>>> avg405masked_array(data=[2.6666666666666665, 3.6666666666666665],406             mask=[False, False],407       fill_value=1e+20)408 409With ``keepdims=True``, the following result has shape (3, 1).410 411>>> np.ma.average(x, axis=1, keepdims=True)412masked_array(413  data=[[0.5],414        [2.5],415        [4.5]],416  mask=False,417  fill_value=1e+20)418rW)�argnamer��f8z;Axis must be specified when shapes of a and weights differ.c3�B># �UHnTRUv� M g7fri)r^)r��axr`s  �rQr��average.<locals>.<genexpr>�s����!=��"�!�'�'�"�+��s�zIShape of weights must be consistent with shape of a along specified axis.c3�<># �UHupUT;aUOSv� M g7f)r7Nrj)r�r��srWs   �rQr�r��s&����$E�1C���+-��*�Q�!�%;�1C�s�)rWr_rbrj)r<rBr6r�r\�_NoValue�meanr_�typer>�419issubclass�integer�bool�result_typer^r�rNr��	transpose�argsort�reshape�	enumeraterHr[rU�multiply�broadcast_tor�)r`rW�weights�returnedr�rX�keepdims_kw�avg�scl�wgt�result_dtypes``         rQrr�s/���b	��420�A���421�A���#�D�!�&�&�&�A���2�;�;����!�8�,�����f�f�T�)�[�)���i�i�n�n�Q�W�W�T�]�+���g����a�g�g�l�l�R�Z�Z����$9�:�:��>�>�!�'�'�3�9�9�d�C�L��>�>�!�'�'�3�9�9�=�L�
�7�7�c�i�i���|������y�y�E�!=��!=�=�=� �7�8�8�422�-�-��423�424�4� 0�1�C��+�+�e�$E�1:�1�7�7�1C�$E�E�F�C�
�F�?��!�&�&��/�C��H�H�����H��g�g�C�4�|�C�{�C���k�k�!�S� ,�.�.1�c�2�26�G�:E�G�IL�M����9�9��	�	�!��/�/�#�y�y�1�6�6�8�C��x���425rSc	���[US5(dZ[R"[USS9UX#US9n[	U[R4265(aSUR::a427[USS9$U$[U[XAUUS9$)	a[428Compute the median along the specified axis.429 430Returns the median of the array elements.431 432Parameters433----------434a : array_like435    Input array or object that can be converted to an array.436axis : int, optional437    Axis along which the medians are computed. The default (None) is438    to compute the median along a flattened version of the array.439out : ndarray, optional440    Alternative output array in which to place the result. It must441    have the same shape and buffer length as the expected output442    but the type will be cast if necessary.443overwrite_input : bool, optional444    If True, then allow use of memory of input array (a) for445    calculations. The input array will be modified by the call to446    median. This will save memory when you do not need to preserve447    the contents of the input array. Treat the input as undefined,448    but it will probably be fully or partially sorted. Default is449    False. Note that, if `overwrite_input` is True, and the input450    is not already an `ndarray`, an error will be raised.451keepdims : bool, optional452    If this is set to True, the axes which are reduced are left453    in the result as dimensions with size one. With this option,454    the result will broadcast correctly against the input array.455 456Returns457-------458median : ndarray459    A new array holding the result is returned unless out is460    specified, in which case a reference to out is returned.461    Return data-type is `float64` for integers and floats smaller than462    `float64`, or the input data-type, otherwise.463 464See Also465--------466mean467 468Notes469-----470Given a vector ``V`` with ``N`` non masked values, the median of ``V``471is the middle value of a sorted copy of ``V`` (``Vs``) - i.e.472``Vs[(N-1)/2]``, when ``N`` is odd, or ``{Vs[N/2 - 1] + Vs[N/2]}/2``473when ``N`` is even.474 475Examples476--------477>>> import numpy as np478>>> x = np.ma.array(np.arange(8), mask=[0]*4 + [1]*4)479>>> np.ma.median(x)4801.5481 482>>> x = np.ma.array(np.arange(10).reshape(2, 5), mask=[0]*6 + [1]*4)483>>> np.ma.median(x)4842.5485>>> np.ma.median(x, axis=-1, overwrite_input=True)486masked_array(data=[2.0, 5.0],487             mask=[False, False],488       fill_value=1e+20)489 490r[T�r�)rWr��overwrite_inputr�r7F�r�)r�r�rWr�r�)491r�r\r"rArMr2r�rGr3�_median)r`rWr�r�r�rXs      rQr"r"�sx��B�1�f����I�I�g�a�t�,�4��'�
)���a����$�$��a�f�f�����.�.��H��A�G�h�s�$3�5�5rSc�4^^�[R"UR[R5(a[RnOSnU(a6Tc UR5mTR
US9 OUR
TUS9 UmO[
UTUS9mTcSmO[TTR5mTRTS:XaU[S5/TR-n[SS5UT'[U5n[RRTUTUS9$TRS:XGa:[[T5S5upgTXg-S-492US-n[R"TR[R5(aiTR S:�aYUR#US9n	U(d[R$"U	SS	US4939n	[R&R(R+TU	T5n	OURUS9n	[RR-U	5(aD[R."TR05(d[RR3T5$U	$[TTSS9n494U495S-nU496S-S:Hn[R4"X{US-4975n[R6"X�/TS
9n
[R8"TU
TS
9nUU4SjnU"U5 [R"TR[R5(aw[RR#UTUS9n	[R$"U	R:SSU	R:S4989 [R&R(R+TU	T5n	U	$[RRUTUS9n	U	$)N)r�)rWr�r0)rWr�r7�)r�g@�safe)�castingr�T�rWr��rWc�">�[RRU5(aj[R"TRTSS9)UR-n[RRT5URU'SURU'gg)NTr�F)r\rv�	is_masked�allr[�minimum_fill_valuer~)r��rep�asortedrWs  ��rQ�replace_masked�_median.<locals>.replace_masked1sh���499�5�5�?�?�1����F�F�7�<�<�d�T�B�B�a�f�f�L�C��%�%�2�2�7�;�A�F�F�3�K��A�F�F�3�K�rS�unsafe)r\�500issubdtyper_�inexact�inf�ravelrJr5r�r^r�rNrvr��divmodr>�sizerU�true_divide�lib�_utils_impl�_median_nancheckr�r�r[r��wherer=�take_along_axisr~)r`rWr�r�r��indexer�idx�odd�midr��counts�h�l�lh�low_highr�r�s `              @rQr�r��s����501�}�}�Q�W�W�b�j�j�)�)��V�V�502��503���<��g�g�i�G��L�L�J�L�/�
�F�F���F�4��G��q�t�504�;���|���#�D�'�,�,�7���}�}�T��a����;�-�'�,�,�.���a�����
���.���u�u�z�z�'�'�*��3�z�?�?��|�|�q���%��.�!�,����c�i�!�m�C�!�G�,��
�=�=�����505�506�3�3����q�8H����C�� �A���N�N�1�b�&�c�B�����"�"�3�3�G�Q��E�A����S��!�A�507�5�5�?�?�1���b�f�f�W�\�\�&:�&:��5�5�+�+�G�4�4���
�7���
5�F��!��A��1�*��/�C�508�����Q���A�	�����T�	*�B��!�!�'�2�D�9�H� ��8��	�}�}�W�]�]�B�J�J�/�/��E�E�I�I�h�T�s�I�3��509���q�v�v�r�8����@��F�F���/�/���D�A��
�H�
�E�E�J�J�x�d��J�4���HrSc510�&�[U5n[U5nUc[[UR55nO[XR5nU[LdUR5(dUR$UR5(a[/5$URnUHgn[[[U55[[US-UR55-5nU[S54U-URUS9)4-nMi U$)a�Suppress slices from multiple dimensions which contain masked values.511 512Parameters513----------514x : array_like, MaskedArray515    The array to operate on. If not a MaskedArray instance (or if no array516    elements are masked), `x` is interpreted as a MaskedArray with `mask`517    set to `nomask`.518axis : tuple of ints or int, optional519    Which dimensions to suppress slices from can be configured with this520    parameter.521    - If axis is a tuple of ints, those are the axes to suppress slices from.522    - If axis is an int, then that is the only axis to suppress slices from.523    - If axis is None, all axis are selected.524 525Returns526-------527compress_array : ndarray528    The compressed array.529 530Examples531--------532>>> import numpy as np533>>> arr = [[1, 2], [3, 4]]534>>> mask = [[0, 1], [0, 0]]535>>> x = np.ma.array(arr, mask=mask)536>>> np.ma.compress_nd(x, axis=0)537array([[3, 4]])538>>> np.ma.compress_nd(x, axis=1)539array([[1],540       [3]])541>>> np.ma.compress_nd(x)542array([[3]])543 544Nr7r�)
r<rBrNr�r�r6rH�any�_datar��nxarrayrOr�)�xrWrXr~r�r�s      rQrrIs���H	��545�A���546�A��|��U�1�6�6�]�#��#�D�&�&�1��	�F�{�!�%�%�'�'��w�w���u�u�w�w��r�{���7�7�D����T�%��)�_�t�E�"�q�&�!�&�&�,A�'B�B�C���U�4�[�N�R�'�A�E�E�t�E�,<�+<�*>�>�?����KrSc�\�[U5RS:wa[S5e[XS9$)a547Suppress the rows and/or columns of a 2-D array that contain548masked values.549 550The suppression behavior is selected with the `axis` parameter.551 552- If axis is None, both rows and columns are suppressed.553- If axis is 0, only rows are suppressed.554- If axis is 1 or -1, only columns are suppressed.555 556Parameters557----------558x : array_like, MaskedArray559    The array to operate on.  If not a MaskedArray instance (or if no array560    elements are masked), `x` is interpreted as a MaskedArray with561    `mask` set to `nomask`. Must be a 2D array.562axis : int, optional563    Axis along which to perform the operation. Default is None.564 565Returns566-------567compressed_array : ndarray568    The compressed array.569 570Examples571--------572>>> import numpy as np573>>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],574...                                                   [1, 0, 0],575...                                                   [0, 0, 0]])576>>> x577masked_array(578  data=[[--, 1, 2],579        [--, 4, 5],580        [6, 7, 8]],581  mask=[[ True, False, False],582        [ True, False, False],583        [False, False, False]],584  fill_value=999999)585 586>>> np.ma.compress_rowcols(x)587array([[7, 8]])588>>> np.ma.compress_rowcols(x, 0)589array([[6, 7, 8]])590>>> np.ma.compress_rowcols(x, 1)591array([[1, 2],592       [4, 5],593       [7, 8]])594 595r�z*compress_rowcols works for 2D arrays only.r�)r<r��NotImplementedErrorr)rrWs  rQr
r
�s,��f�q�z���!��!�"N�O�O��q�$�$rSc�f�[U5nURS:wa[S5e[US5$)a596Suppress whole rows of a 2-D array that contain masked values.597 598This is equivalent to ``np.ma.compress_rowcols(a, 0)``, see599`compress_rowcols` for details.600 601Parameters602----------603x : array_like, MaskedArray604    The array to operate on. If not a MaskedArray instance (or if no array605    elements are masked), `x` is interpreted as a MaskedArray with606    `mask` set to `nomask`. Must be a 2D array.607 608Returns609-------610compressed_array : ndarray611    The compressed array.612 613See Also614--------615compress_rowcols616 617Examples618--------619>>> import numpy as np620>>> a = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],621...                                                   [1, 0, 0],622...                                                   [0, 0, 0]])623>>> np.ma.compress_rows(a)624array([[6, 7, 8]])625 626r�z'compress_rows works for 2D arrays only.r0�r<r�r
r
�r`s rQrr�s2��B	��627�A��v�v��{�!�"K�L�L��A�q�!�!rSc�f�[U5nURS:wa[S5e[US5$)a4628Suppress whole columns of a 2-D array that contain masked values.629 630This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see631`compress_rowcols` for details.632 633Parameters634----------635x : array_like, MaskedArray636    The array to operate on.  If not a MaskedArray instance (or if no array637    elements are masked), `x` is interpreted as a MaskedArray with638    `mask` set to `nomask`. Must be a 2D array.639 640Returns641-------642compressed_array : ndarray643    The compressed array.644 645See Also646--------647compress_rowcols648 649Examples650--------651>>> import numpy as np652>>> a = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],653...                                                   [1, 0, 0],654...                                                   [0, 0, 0]])655>>> np.ma.compress_cols(a)656array([[1, 2],657       [4, 5],658       [7, 8]])659 660r�z'compress_cols works for 2D arrays only.r7rrs rQrr�s2��F	��661�A��v�v��{�!�"K�L�L��A�q�!�!rSc��[USS9nURS:wa[S5e[U5nU[LdUR5(dU$UR
5nURR5UlU(d [U[R"US5'US;a$[USS2[R"US54'U$)	a�662Mask rows and/or columns of a 2D array that contain masked values.663 664Mask whole rows and/or columns of a 2D array that contain665masked values.  The masking behavior is selected using the666`axis` parameter.667 668  - If `axis` is None, rows *and* columns are masked.669  - If `axis` is 0, only rows are masked.670  - If `axis` is 1 or -1, only columns are masked.671 672Parameters673----------674a : array_like, MaskedArray675    The array to mask.  If not a MaskedArray instance (or if no array676    elements are masked), the result is a MaskedArray with `mask` set677    to `nomask` (False). Must be a 2D array.678axis : int, optional679    Axis along which to perform the operation. If None, applies to a680    flattened version of the array.681 682Returns683-------684a : MaskedArray685    A modified version of the input array, masked depending on the value686    of the `axis` parameter.687 688Raises689------690NotImplementedError691    If input array `a` is not 2D.692 693See Also694--------695mask_rows : Mask rows of a 2D array that contain masked values.696mask_cols : Mask cols of a 2D array that contain masked values.697masked_where : Mask where a condition is met.698 699Notes700-----701The input array's mask is modified by this function.702 703Examples704--------705>>> import numpy as np706>>> a = np.zeros((3, 3), dtype=int)707>>> a[1, 1] = 1708>>> a709array([[0, 0, 0],710       [0, 1, 0],711       [0, 0, 0]])712>>> a = np.ma.masked_equal(a, 1)713>>> a714masked_array(715  data=[[0, 0, 0],716        [0, --, 0],717        [0, 0, 0]],718  mask=[[False, False, False],719        [False,  True, False],720        [False, False, False]],721  fill_value=1)722>>> np.ma.mask_rowcols(a)723masked_array(724  data=[[0, --, 0],725        [--, --, --],726        [0, --, 0]],727  mask=[[False,  True, False],728        [ True,  True,  True],729        [False,  True, False]],730  fill_value=1)731 732Fr�r�z&mask_rowcols works for 2D arrays only.r0)Nr7r�Nr7)r1r�r
rBrHr�nonzerorer�rFr\r,)r`rWrX�	maskedvals    rQrrs���R	�a�u��A��v�v��{�!�"J�K�K���733�A��F�{�!�%�%�'�'����	�	��I��g�g�l�l�n�A�G��%+��"�)�)�I�a�L�734!�"��}��(.��!�R�Y�Y�y��|�
$�735$�%��HrSc�t�U[RLa[R"S[SS9 [US5$)aA736Mask rows of a 2D array that contain masked values.737 738This function is a shortcut to ``mask_rowcols`` with `axis` equal to 0.739 740See Also741--------742mask_rowcols : Mask rows and/or columns of a 2D array.743masked_where : Mask where a condition is met.744 745Examples746--------747>>> import numpy as np748>>> a = np.zeros((3, 3), dtype=int)749>>> a[1, 1] = 1750>>> a751array([[0, 0, 0],752       [0, 1, 0],753       [0, 0, 0]])754>>> a = np.ma.masked_equal(a, 1)755>>> a756masked_array(757  data=[[0, 0, 0],758        [0, --, 0],759        [0, 0, 0]],760  mask=[[False, False, False],761        [False,  True, False],762        [False, False, False]],763  fill_value=1)764 765>>> np.ma.mask_rows(a)766masked_array(767  data=[[0, 0, 0],768        [--, --, --],769        [0, 0, 0]],770  mask=[[False, False, False],771        [ True,  True,  True],772        [False, False, False]],773  fill_value=1)774 775�TThe axis argument has always been ignored, in future passing it will raise TypeErrorr���776stacklevelr0�r\r��warnings�warn�DeprecationWarningr�r`rWs  rQrrds9��T�2�;�;��	�
�
�
#�$6�1�	F���1��rSc�t�U[RLa[R"S[SS9 [US5$)aC777Mask columns of a 2D array that contain masked values.778 779This function is a shortcut to ``mask_rowcols`` with `axis` equal to 1.780 781See Also782--------783mask_rowcols : Mask rows and/or columns of a 2D array.784masked_where : Mask where a condition is met.785 786Examples787--------788>>> import numpy as np789>>> a = np.zeros((3, 3), dtype=int)790>>> a[1, 1] = 1791>>> a792array([[0, 0, 0],793       [0, 1, 0],794       [0, 0, 0]])795>>> a = np.ma.masked_equal(a, 1)796>>> a797masked_array(798  data=[[0, 0, 0],799        [0, --, 0],800        [0, 0, 0]],801  mask=[[False, False, False],802        [False,  True, False],803        [False, False, False]],804  fill_value=1)805>>> np.ma.mask_cols(a)806masked_array(807  data=[[0, --, 0],808        [0, --, 0],809        [0, --, 0]],810  mask=[[False,  True, False],811        [False,  True, False],812        [False,  True, False]],813  fill_value=1)814 815rr�rr7rrs  rQrr�s9��R�2�;�;��	�
�
�
#�$6�1�	F���1��rSc���[R"U5RnUSSUSS-816nU/nUbURSU5 UbUR	U5 [U5S:wa[
U5nU$)a�817Compute the differences between consecutive elements of an array.818 819This function is the equivalent of `numpy.ediff1d` that takes masked820values into account, see `numpy.ediff1d` for details.821 822See Also823--------824numpy.ediff1d : Equivalent function for ndarrays.825 826Examples827--------828>>> import numpy as np829>>> arr = np.ma.array([1, 2, 4, 7, 0])830>>> np.ma.ediff1d(arr)831masked_array(data=[ 1,  2,  3, -7],832             mask=False,833       fill_value=999999)834 835r7Nr�r0)rv�836asanyarray�flat�insertr�r�r)rV�to_end�to_begin�ed�arrayss     rQrr�sw��*
�-�-��837�838!�839!�C�	�Q�R��3�s��8�	�B��T�F����
�
�a��"�
���
�
�f��840�6�{�a���F�^��
�IrSc���[R"UUUS9n[U[5(a3[	U5nUSR[5US'[U5nU$UR[5nU$)a�841Finds the unique elements of an array.842 843Masked values are considered the same element (masked). The output array844is always a masked array. See `numpy.unique` for more details.845 846See Also847--------848numpy.unique : Equivalent function for ndarrays.849 850Examples851--------852>>> import numpy as np853>>> a = [1, 2, 1000, 2, 3]854>>> mask = [0, 0, 1, 0, 0]855>>> masked_a = np.ma.masked_array(a, mask)856>>> masked_a857masked_array(data=[1, 2, --, 2, 3],858            mask=[False, False,  True, False, False],859    fill_value=999999)860>>> np.ma.unique(masked_a)861masked_array(data=[1, 2, 3, --],862            mask=[False, False, False,  True],863    fill_value=999999)864>>> np.ma.unique(masked_a, return_index=True)865(masked_array(data=[1, 2, 3, --],866            mask=[False, False, False,  True],867    fill_value=999999), array([0, 1, 4, 2]))868>>> np.ma.unique(masked_a, return_inverse=True)869(masked_array(data=[1, 2, 3, --],870            mask=[False, False, False,  True],871    fill_value=999999), array([0, 1, 3, 1, 2]))872>>> np.ma.unique(masked_a, return_index=True, return_inverse=True)873(masked_array(data=[1, 2, 3, --],874            mask=[False, False, False,  True],875    fill_value=999999), array([0, 1, 4, 2]), array([0, 1, 3, 1, 2]))876)�return_index�return_inverser0)r\r,rMrNrOrdr:)�ar1r(r)�outputs    rQr,r,�sn��L�Y�Y�s�$0�&4�6�F��&�%� � ��f����1�I�N�N�;�/��q�	��v����M����[�)���MrSc���U(a[R"X45nO*[R"[U5[U545nUR5 USSUSSUSS:H$)a877Returns the unique elements common to both arrays.878 879Masked values are considered equal one to the other.880The output is always a masked array.881 882See `numpy.intersect1d` for more details.883 884See Also885--------886numpy.intersect1d : Equivalent function for ndarrays.887 888Examples889--------890>>> import numpy as np891>>> x = np.ma.array([1, 3, 3, 3], mask=[0, 0, 0, 1])892>>> y = np.ma.array([3, 1, 1, 1], mask=[0, 0, 0, 1])893>>> np.ma.intersect1d(x, y)894masked_array(data=[1, 3, --],895             mask=[False, False,  True],896       fill_value=999999)897 898Nr�r7)rvr=r,rJ)r*�ar2�
assume_unique�auxs    rQrr%s_��0��n�n�c�Z�(���n�n�f�S�k�6�#�;�7�8���H�H�J��s��8�C���G�s�3�B�x�'�(�(rSc�2�U(d[U5n[U5n[R"X4SS9nURS:XaU$UR	5 UR5n[R"S/USSUSS:gS/45nUSSUSS:HnX6$)a�899Set exclusive-or of 1-D arrays with unique elements.900 901The output is always a masked array. See `numpy.setxor1d` for more details.902 903See Also904--------905numpy.setxor1d : Equivalent function for ndarrays.906 907Examples908--------909>>> import numpy as np910>>> ar1 = np.ma.array([1, 2, 3, 2, 4])911>>> ar2 = np.ma.array([2, 3, 5, 7, 5])912>>> np.ma.setxor1d(ar1, ar2)913masked_array(data=[1, 4, 5, 7],914             mask=False,915       fill_value=999999)916 917Nr�r0Tr7r�)r,rvr=r�rJr?)r*r-r.r/�auxf�flag�flag2s       rQr*r*Fs���*��S�k���S�k��918�.�.�#��$�919/�C�920�x�x�1�}��921��H�H�J��:�:�<�D�
�>�>�D�6�D���H��S�b�	�$9�T�F�C�D�D�
�!�"�X��c�r��
"�E��:�rSc�X�U(d[USS9up[U5n[R"X45nURSS9nXVnU(aUSSUSS:gnOUSSUSS:Hn[R"X�/45n	URSS9S[	U5n922U(aX�$X�W$)a�923Test whether each element of an array is also present in a second924array.925 926The output is always a masked array.927 928We recommend using :func:`isin` instead of `in1d` for new code.929 930See Also931--------932isin       : Version of this function that preserves the shape of ar1.933 934Examples935--------936>>> import numpy as np937>>> ar1 = np.ma.array([0, 1, 2, 5, 0])938>>> ar2 = [0, 2]939>>> np.ma.in1d(ar1, ar2)940masked_array(data=[ True, False,  True, False,  True],941             mask=False,942       fill_value=True)943 944T)r)�	mergesort)�kindr7Nr�)r,rvr=r�r�)r*r-r.�invert�rev_idx�ar�order�sar�bool_arr2�indxs           rQrrks���0��c�$�7����S�k��	����945�	#�B�
�J�J�K�J�(�E�946�)�C�
��q�r�7�c�#�2�h�&���q�r�7�c�#�2�h�&��
�>�>�7�H�-�.�D��=�=�k�=�*�9�C��H�5�D���z���z�'�"�"rSc�v�[R"U5n[XUUS9RUR5$)a/947Calculates `element in test_elements`, broadcasting over948`element` only.949 950The output is always a masked array of the same shape as `element`.951See `numpy.isin` for more details.952 953See Also954--------955in1d       : Flattened version of this function.956numpy.isin : Equivalent function for ndarrays.957 958Examples959--------960>>> import numpy as np961>>> element = np.ma.array([1, 2, 3, 4, 5, 6])962>>> test_elements = [0, 2]963>>> np.ma.isin(element, test_elements)964masked_array(data=[False,  True, False, False, False, False],965             mask=False,966       fill_value=True)967 968�r.r7)rvr<rr�r^)�element�
test_elementsr.r7s    rQrr�s4��0�j�j��!�G���m���&�w�w�}�}�5�6rSc�@�[[R"X4SS95$)a�969Union of two arrays.970 971The output is always a masked array. See `numpy.union1d` for more details.972 973See Also974--------975numpy.union1d : Equivalent function for ndarrays.976 977Examples978--------979>>> import numpy as np980>>> ar1 = np.ma.array([1, 2, 3, 4])981>>> ar2 = np.ma.array([3, 4, 5, 6])982>>> np.ma.union1d(ar1, ar2)983masked_array(data=[1, 2, 3, 4, 5, 6],984         mask=False,985   fill_value=999999)986 987Nr�)r,rvr=)r*r-s  rQr-r-�s��*�"�.�.�#��$�7�8�8rSc��U(a%[R"U5R5nO[U5n[U5nU[	XSSS9$)a�988Set difference of 1D arrays with unique elements.989 990The output is always a masked array. See `numpy.setdiff1d` for more991details.992 993See Also994--------995numpy.setdiff1d : Equivalent function for ndarrays.996 997Examples998--------999>>> import numpy as np1000>>> x = np.ma.array([1, 2, 3, 4], mask=[0, 1, 0, 1])1001>>> np.ma.setdiff1d(x, [1, 2])1002masked_array(data=[3, --],1003             mask=[False,  True],1004       fill_value=999999)1005 1006Tr?)rvr<r�r,r)r*r-r.s   rQr)r)�sC��*��j�j��o�#�#�%���S�k���S�k���t�C�D��>�?�?rSc�8�[R"USS[S9n[R"U5nU(d UR	5(a[S5eURSS:XaSn[[U55nSU-1007nU(a[S5S4nO
S[S54nUcnURSS:�dURSS:�a[RnO[Rn[R"U5RU5nGOj[US	S[S10089n[R"U5n	U(d U	R	5(a[S5eUR	5(dU	R	5(aYURUR:Xa?[R"XI5n1009U1010[ La U1011=n=Ul=Uln	S	UlS	Ul[R&"X4U5nURSS:�dURSS:�a[RnO[Rn[R"[R&"XI4U55RU5nXR)US9U-nXU4$)zS1012Private function for the computation of covariance and correlation1013coefficients.1014 1015r�T)�ndminr�r_zCannot process masked data.r0r7NiF)r�rEr_r�)rvr1�floatrCrr�r^�intr�r�r\�float64�float32�logical_not�astype�1016logical_orrHre�_sharedmaskr=r�)r�y�rowvar�allow_masked�xmaskrW�tup�	xnm_dtype�xnotmask�ymask�common_masks           rQ�1017_covhelperrW�s��	����!�$�e�4�A��O�O�A��E��E�I�I�K�K��6�7�7��w�w�q�z�Q����
��f��
�F��v�:�D�
��T�{�D�!���U�4�[�!���y�
�7�7�1�:���1�7�7�1�:��#7��1018�1019�I��1020�1021�I��>�>�%�(�/�/�	�:���!�%�q��6������"����	�	����:�;�;��9�9�;�;�%�)�)�+�+��w�w�!�'�'�!� �m�m�E�9���f�,�8C�C�E�C�A�G�C�a�g��$)�A�M�$)�A�M��N�N�A�6�4�(��
�7�7�1�:���1�7�7�1�:��#7��1022�1023�I��1024�1025�I��>�>�"�.�.�%���"F�G�N�N��1026�����V��	�S�	!�!�A�
�� � rSc���UbU[U5:wa[S5eUcU(aSnOSn[XX$5upnU(d�[R"UR1027U5U-1028n[R"US[S9n[R"SSS9 [R"[UR1029S5[UR5S55U-n	SSS5 [R"W	US9R5n1030U1031$[R"XfR10325U-1033n[R"US[S9n[R"SSS9 [R"[US5[UR1034R5S55U-n	SSS5 [R"W	US9R5n1035U1036$!,(df   N�=f!,(df   ND=f)	aQ	1037Estimate the covariance matrix.1038 1039Except for the handling of missing data this function does the same as1040`numpy.cov`. For more details and examples, see `numpy.cov`.1041 1042By default, masked values are recognized as such. If `x` and `y` have the1043same shape, a common mask is allocated: if ``x[i,j]`` is masked, then1044``y[i,j]`` will also be masked.1045Setting `allow_masked` to False will raise an exception if values are1046missing in either of the input arrays.1047 1048Parameters1049----------1050x : array_like1051    A 1-D or 2-D array containing multiple variables and observations.1052    Each row of `x` represents a variable, and each column a single1053    observation of all those variables. Also see `rowvar` below.1054y : array_like, optional1055    An additional set of variables and observations. `y` has the same1056    shape as `x`.1057rowvar : bool, optional1058    If `rowvar` is True (default), then each row represents a1059    variable, with observations in the columns. Otherwise, the relationship1060    is transposed: each column represents a variable, while the rows1061    contain observations.1062bias : bool, optional1063    Default normalization (False) is by ``(N-1)``, where ``N`` is the1064    number of observations given (unbiased estimate). If `bias` is True,1065    then normalization is by ``N``. This keyword can be overridden by1066    the keyword ``ddof`` in numpy versions >= 1.5.1067allow_masked : bool, optional1068    If True, masked values are propagated pair-wise: if a value is masked1069    in `x`, the corresponding value is masked in `y`.1070    If False, raises a `ValueError` exception when some values are missing.1071ddof : {None, int}, optional1072    If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is1073    the number of observations; this overrides the value implied by1074    ``bias``. The default value is ``None``.1075 1076Raises1077------1078ValueError1079    Raised if some values are missing and `allow_masked` is False.1080 1081See Also1082--------1083numpy.cov1084 1085Examples1086--------1087>>> import numpy as np1088>>> x = np.ma.array([[0, 1], [1, 1]], mask=[0, 1, 0, 1])1089>>> y = np.ma.array([[1, 0], [0, 1]], mask=[0, 0, 1, 1])1090>>> np.ma.cov(x, y)1091masked_array(1092data=[[--, --, --, --],1093      [--, --, --, --],1094      [--, --, --, --],1095      [--, --, --, --]],1096mask=[[ True,  True,  True,  True],1097      [ True,  True,  True,  True],1098      [ True,  True,  True,  True],1099      [ True,  True,  True,  True]],1100fill_value=1e+20,1101dtype=float64)1102 1103Nzddof must be an integerr0r7rb�ignore)�divide�invalidrZ)rGr�rWr\r�T�1104less_equalr��errstater?�conjrvr1�squeeze)rrNrO�biasrP�ddofrT�factr[r~r�s           rQrr,sl��L��D�C��I�-��2�3�3��|���D��D�&�q�V�B��Q�&���v�v�h�j�j�(�+�d�2���}�}�T�1�D�1��
�[�[��(�
;��6�6�&����a�.�&�����1�*=�>��E�D�<����$�T�*�2�2�4���M��v�v�h�1105�1106�+�d�2���}�}�T�1�D�1��
�[�[��(�
;��6�6�&��A�,��q�s�s�x�x�z�1�(=�>��E�D�<����$�T�*�2�2�4���M�<�
;��<�
;�s�AG�AG!�1107G�!1108G/c���[XX#S9n[R"[R"U55nU[RRXU5-nU$![a [R1109"5s$f=f)a�1110Return Pearson product-moment correlation coefficients.1111 1112Except for the handling of missing data this function does the same as1113`numpy.corrcoef`. For more details and examples, see `numpy.corrcoef`.1114 1115Parameters1116----------1117x : array_like1118    A 1-D or 2-D array containing multiple variables and observations.1119    Each row of `x` represents a variable, and each column a single1120    observation of all those variables. Also see `rowvar` below.1121y : array_like, optional1122    An additional set of variables and observations. `y` has the same1123    shape as `x`.1124rowvar : bool, optional1125    If `rowvar` is True (default), then each row represents a1126    variable, with observations in the columns. Otherwise, the relationship1127    is transposed: each column represents a variable, while the rows1128    contain observations.1129allow_masked : bool, optional1130    If True, masked values are propagated pair-wise: if a value is masked1131    in `x`, the corresponding value is masked in `y`.1132    If False, raises an exception.  Because `bias` is deprecated, this1133    argument needs to be treated as keyword only to avoid a warning.1134 1135See Also1136--------1137numpy.corrcoef : Equivalent function in top-level NumPy module.1138cov : Estimate the covariance matrix.1139 1140Examples1141--------1142>>> import numpy as np1143>>> x = np.ma.array([[0, 1], [1, 1]], mask=[0, 1, 0, 1])1144>>> np.ma.corrcoef(x)1145masked_array(1146  data=[[--, --],1147        [--, --]],1148  mask=[[ True,  True],1149        [ True,  True]],1150  fill_value=1e+20,1151  dtype=float64)1152 1153)rP)rrv�sqrt�diagonalr��MaskedConstantr��outer)rrNrOrP�corr�stds      rQrr�sm��`�q�V�7�D�#��g�g�b�k�k�$�'�(��	�B�K�K���c�'�'�D��K���#�� � �"�"�#�s�*A�A<�;A<c�V^�\rSrSrSrSr\"\5r\U4Sj5r	U4Sjr1154SrU=r$)�MAxisConcatenatori�z�1155Translate slice objects to concatenation along an axis.1156 1157For documentation on usage, see `mr_class`.1158 1159See Also1160--------1161mr_class1162 1163rjc�Z>�[TU]URSS9n[X!RS9$)NFr�rZ)�super�makematr~r1r[)�clsrVr~�	__class__s   �rQro�MAxisConcatenator.makemat�s*����w��s�x�x�e��4���T���)�)rSc�b>�[U[5(a[S5e[TU]U5$)NzUnavailable for masked array.)rM�strr9rn�__getitem__)�self�keyrqs  �rQru�MAxisConcatenator.__getitem__�s,����c�3����9�:�:��w�"�3�'�'rS)
rq�1164__module__rr�__firstlineno__rx�	__slots__�staticmethodr=�classmethodroru�__static_attributes__�
__classcell__)rqs@rQrlrl�s5���	��I��{�+�K��*��*�(�(rSrlc�"�\rSrSrSrSrSrSrg)�mr_classi�aJ1165Translate slice objects to concatenation along the first axis.1166 1167This is the masked array version of `r_`.1168 1169See Also1170--------1171r_1172 1173Examples1174--------1175>>> import numpy as np1176>>> np.ma.mr_[np.ma.array([1,2,3]), 0, 0, np.ma.array([4,5,6])]1177masked_array(data=[1, 2, 3, ..., 4, 5, 6],1178             mask=False,1179       fill_value=999999)1180 1181rjc�0�[RUS5 g)Nr0)rl�__init__)rvs rQr��mr_class.__init__�s���"�"�4��+rSN)rqryrrrzrxr{r�r~rjrSrQr�r��s���$�I�,rSr�c#��# �[[R"U5[U5R5H(up#U(dUv� MU(aMUS[11824v� M* g7f)a�1183Multidimensional index iterator.1184 1185Return an iterator yielding pairs of array coordinates and values,1186skipping elements that are masked. With `compressed=False`,1187`ma.masked` is yielded as the value of masked elements. This1188behavior differs from that of `numpy.ndenumerate`, which yields the1189value of the underlying data array.1190 1191Notes1192-----1193.. versionadded:: 1.23.01194 1195Parameters1196----------1197a : array_like1198    An array with (possibly) masked elements.1199compressed : bool, optional1200    If True (default), masked elements are skipped.

Showing the first 1,200 of 1536 lines. Download the file for the rest.

codekingpro/portable-devtools · Team Ai