
    d%                         d Z ddlZddlZddlZddlmZ ddlmZ ddl	m
Z
mZmZ ddlmZ ddlmZmZmZmZmZmZ d	Z G d
 dej        e          Z G d de          ZdS )z Here is defined the Array class.    N   )hdf5extension)Filters)	flavor_ofarray_as_internalinternal_to_flavor)Leaf)is_idxconvert_to_np_atom2SizeTypelazyattr
byteordersquantizez2.4c                       e Zd ZdZdZed             Zed             Zed             Z	ed             Z
	 	 	 d! fd
	Zd Zd Zd Zd"dZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd#dZd$dZd Z d  Z! xZ"S )%Arraya	  This class represents homogeneous datasets in an HDF5 file.

    This class provides methods to write or read data to or from array objects
    in the file. This class does not allow you neither to enlarge nor compress
    the datasets on disk; use the EArray class (see :ref:`EArrayClassDescr`) if
    you want enlargeable dataset support or compression features, or CArray
    (see :ref:`CArrayClassDescr`) if you just want compression.

    An interesting property of the Array class is that it remembers the
    *flavor* of the object that has been saved so that if you saved, for
    example, a list, you will get a list during readings afterwards; if you
    saved a NumPy array, you will get a NumPy object, and so forth.

    Note that this class inherits all the public attributes and methods that
    Leaf (see :ref:`LeafClassDescr`) already provides. However, as Array
    instances have no internal I/O buffers, it is not necessary to use the
    flush() method they inherit from Leaf in order to save their internal state
    to disk.  When a writing method call returns, all the data is already on
    disk.

    Parameters
    ----------
    parentnode
        The parent :class:`Group` object.

        .. versionchanged:: 3.0
           Renamed from *parentNode* to *parentnode*

    name : str
        The name of this node in its parent group.
    obj
        The array or scalar to be saved.  Accepted types are NumPy
        arrays and scalars as well as native Python sequences and
        scalars, provided that values are regular (i.e. they are not
        like ``[[1,2],2]``) and homogeneous (i.e. all the elements are
        of the same type).

        .. versionchanged:: 3.0
           Renamed form *object* into *obj*.
    title
        A description for this node (it sets the ``TITLE`` HDF5 attribute on
        disk).
    byteorder
        The byteorder of the data *on disk*, specified as 'little' or 'big'.
        If this is not specified, the byteorder is that of the given `object`.
    track_times
        Whether time data associated with the leaf are recorded (object
        access time, raw data modification time, metadata change time, object
        birth time); default True.  Semantics of these times depend on their
        implementation in the HDF5 library: refer to documentation of the
        H5O_info_t data structure.  As of HDF5 1.8.15, only ctime (metadata
        change time) is implemented.

        .. versionadded:: 3.4.3

    ARRAYc                     | j         j        S )z9The NumPy ``dtype`` that most closely matches this array.)atomdtypeselfs    ,lib/python3.11/site-packages/tables/array.pyr   zArray.dtypeU   s     y    c                 Z    | j         dk    rt          d          S | j         | j                 S )z The number of rows in the array. r   )shaper   maindimr   s    r   nrowszArray.nrowsZ   s,     :A;;:dl++r   c                 v    | j         }| j        j        }t          | j                  D ]\  }}||k    r||z  }|S )zLThe size of the rows in bytes in dimensions orthogonal to
        *maindim*.)r   r   size	enumerater   )r   r   rowsizeidims        r   r"   zArray.rowsizeb   sI     ,).
++ 	 	FAsG||3r   c                      | j         | j        z  S )zSThe size of this array's data in bytes when it is fully loaded into
        memory.)r   r"   r   s    r   size_in_memoryzArray.size_in_memorym   s     zDL((r   N Tc	           	         d | _         	 |d ux| _        }		 || _        	 || _        	 d| _        	 d | _        	 d | _        	 d | _        	 d | _        	 d | _	        	 d | _
        	 d | _        	 d| _        	 d | _        	 || _        	 d | _        	 d | _        	 d| _        	 t%                                          |||	t)                      |||           d S )NTF)
_v_version_v_new_v_new_title_obj
_v_convert_start_stop_step
_nrowsread_startb_stopb_row_initlistarrr   r   nrowextdimsuper__init__r   )r   
parentnodenameobjtitle	byteorder_log_atomtrack_timesnew	__class__s             r   r;   zArray.__init__s   s
   
 /tO+c?!&		 D 5
5
2G./	2
M* 		 
,	A5 	T3		9d$	& 	& 	& 	& 	&r   c                 T   t           | _        	 t          | j                  x| _        }t          | j        |          }n%# t          $ r |                     d            w xY w|j        j	        dv rt          d          d| _        |                     ||j        j                  }	 |                     || j        | j                  \  | _        | _        | _        n%# t          $ r |                     d            w xY w|                                 | _        d| _        | j        S )zSave a new array in file.r   )flush)VUOzGArray objects cannot currently deal with void, unicode or object arraysN)	obversionr*   r   r-   _flavorr   	Exceptioncloser   kind	TypeError_g_fix_byteorder_datar@   _create_arrayr,   r   _v_objectidr   _calc_nrowsinbuf
nrowsinbuf_v_chunkshape)r   flavornparrs      r   	_g_createzArray._g_create   sI    $	$-di$8$88DL6%di88EE 	 	 	JJQJ	 ;.. 7 8 8 8 	 **5%+2GHH		 9=8J8Jt($)95 955Ttz499 	 	 	JJQJ	 //11!s   0? "A!)4C "D c                     |                                  \  }| _        | _        | _        |                                 | _        |S )z+Get the metadata info for an array in file.)_open_arrayr   r   rV   rT   rU   )r   oids     r   _g_openzArray._g_open   s>     <@;K;K;M;M8diT%7//11
r   c                 h    | j         j        dk    rt          d| j        z            | j         j        S )a  Get the enumerated type associated with this array.

        If this array is of an enumerated type, the corresponding Enum instance
        (see :ref:`EnumClassDescr`) is returned. If it is not of an enumerated
        type, a TypeError is raised.

        enumz)array ``%s`` is not of an enumerated type)r   rO   rP   _v_pathnamer_   r   s    r   get_enumzArray.get_enum   s?     9>V##G"./ 0 0 0 y~r   c                     	 |                      |||          \  | _        | _        | _        n# t          $ r Y dS w xY w|                                  | S )ax  Iterate over the rows of the array.

        This method returns an iterator yielding an object of the current
        flavor for each selected row in the array.  The returned rows are taken
        from the *main dimension*.

        If a range is not supplied, *all the rows* in the array are iterated
        upon - you can also use the :meth:`Array.__iter__` special method for
        that purpose.  If you only want to iterate over a given *range of rows*
        in the array, you may use the start, stop and step parameters.

        Examples
        --------

        ::

            result = [row for row in arrayInstance.iterrows(step=4)]

        .. versionchanged:: 3.0
           If the *start* parameter is provided and *stop* is None then the
           array is iterated from *start* to the last line.
           In PyTables < 3.0 only one element was returned.

        r   )_process_ranger/   r0   r1   
IndexError
_init_loop)r   startstopsteps       r   iterrowszArray.iterrows   sk    4	484G4GtT5# 5#1T[$*djj 	 	 	22	 	s   *- 
;;c                 p    | j         s.d| _        | j        | _        d| _        |                                  | S )az  Iterate over the rows of the array.

        This is equivalent to calling :meth:`Array.iterrows` with default
        arguments, i.e. it iterates over *all the rows* in the array.

        Examples
        --------

        ::

            result = [row[2] for row in array]

        Which is equivalent to::

            result = [row[2] for row in array.iterrows()]

        r   r   )r6   r/   r   r0   r1   re   r   s    r   __iter__zArray.__iter__  s:    & z 	DKDJDJOOr   c                     | j         | _        | j         | _        d| _        d| _        t          | j         | j        z
            | _        dS )z)Initialization for the __iter__ iterator.r)   TN)r/   r2   r3   r5   r6   r   r1   r8   r   s    r   re   zArray._init_loop1  s@     +{	
T[4:566			r   c                    | j         | j        k    rd| _        d| _        t          | j        dz   | j        k    s| j        dk     r| j        | j        | j        z  z   | _	        | j	        | j        k    r| j        | _	        | 
                    | j        | j	        | j                  }| j        dk    r|                    | j        d          }t          || j                  | _        d| _        | j	        | _        | xj        dz  c_        | xj        | j        z  c_        | xj         | j        z  c_         | j        r| j        | j                 S | j        S )zGet the next element of the array during an iteration.

        The element is returned as an object of the current flavor.

        FNr   r   r)   )r2   r0   r6   r7   StopIterationr5   rU   r3   r1   r4   _readr9   swapaxesr   rW   r8   r   )r   r7   s     r   __next__zArray.__next__:  s+    ?dj((DJDL y1}//49q=="lTZ$/-II;++"&*DK**T\4;
KK;??%..t{A>>G1'4;GG	#{IINIIII#IIOOtz)OO z $|DI..|#r   c           	         t          | j                  }|f}t          j        |t                    }t          j        |t                    }t          j        |t                    }t          j        |t                    }t          |t                    s|f}t          |          }d}	|D ]}}
d}t          |
t          t                              rPd}t          |	t          | j                  ||	z
  z
  dz             D ]!}d||	<   | j        |         ||	<   d||	<   |	dz  }	"n|	|k    rt          d| j        z            t          |
          rpt          j        |
          }
|
| j        |	         k    rt          d          |
dk     r|
| j        |	         z  }
|                     |
|
dz   d|	          \  }}}d||	<   nTt          |
t"                    r-|                     |
j        |
j        |
j        |	          \  }}}nt+          d|
z            |s|||	<   |||	<   |||	<   |	dz  }	|	t          | j                  k     rDt          |	t          | j                            D ]!}d||	<   | j        |         ||	<   d||	<   |	dz  }	"g }t          t          | j                            D ]U}	t          t          ||	         ||	         ||	                             }|dk    r||	         s|                    |           V||||fS )z4Internal routine used by __getitem__ and __setitem__r   r   r   r   z Too many indices for object '%s'zIndex out of range)r$   zNon-valid index or slice: %s)lenr   npemptyr   zeros
isinstancetupletypeEllipsisrangerd   r`   r
   operatorindexrc   slicerf   rg   rh   rP   append)r   keysmaxlenr   startlstoplstepl	stop_Nonenkeysr$   keyellipsisdimlrf   rg   rh   new_dims                    r   _interpret_indexingzArray._interpret_indexing_  sL    TZ	X666uH555uH555H5999	$&& 	7DD		  !	 !	CH#tH~~.. F!#s4:%#+'F'JKK  D"#F3K!%D!1E#J!"E#J1HCC	
  !C!%!1"2 3 3 3 FnS)) $*S/))$%9:::774:c?*C$($7$7q! %8 %. %.!tT!"	#C'' F$($7$7Isxs %8 %< %<!tTT   > DEEE #s!c
!c
q TZ  c3tz??33  s!Z-c
c
q TZ)) 	& 	&C%sU3ZsDDEEGqLLYs^LW%%%ueU**r   c                    d }d }d }g }g }t          |t                    s|f} ||t          | j                            }d}d}t	          t          || j                            D ]`\  }	\  }
}t          |
t                    r@ ||
|          \  }}}|                    ||||	df           |                    |           ^	 t          |
          }
|                    t          |
                     n(# t          $ r |
g}
|                    d           Y nw xY wt          |
          dk    rt          d|	z            t          |
          d	k    r|rt          d
          d}nt          |
d         t          t          j        f          rJt          |
d         t          j                  r9t          j        |
d         j        t          j                  st          d          t          j        |
d          }t          j        |dk     ||z   |          }t          |          t          t          j        |                    k    rt          d          |                                }|j        t          |
          fk    sLt          j        t          j        |t          j        t          |
                    z
                      dk    r9|t          d          t+          d |D                       d	z
  }||f}||         }t1          t          |          d	z             D ]}|t          |          k     r |||         |           |dk    rd}|d         }n=|t          |          k    r|d         d	z   }||z
  }n||d	z
           d	z   }||         |z
  }|dk    r|                    ||d	|	df           bt          d |D                       }|||fS )a3  Performs a NumPy-style fancy selection in `self`.

        Implements advanced NumPy-style selection operations in
        addition to the standard slice-and-int behavior.

        Indexing arguments may be ints, slices or lists of indices.

        Note: This is a backport from the h5py project.

        c                     	 t          |           } n # t          $ r t          d| z            w xY w| |dz
  k    rt          d| z            dS )z1Validate a list member for the given axis length.zIllegal index: %rr   zIndex out of bounds: %dN)intrP   rd   )numlengths     r   validate_numberz/Array._fancy_selection.<locals>.validate_number  sn    ;#hh ; ; ; 3c 9:::;VaZ !:S!@AAA  s    /c                    t          d | D                       }|dk    rt          d          |dk    rt          |           |k    r| t          fz   } g }t          |           }t	          |           D ]P\  }}|t          u r-|                    t          d          f||z
  dz   z             ;|                    |           Qt          |          |k    rt          d          |S )z1Expand ellipsis objects and fill in missing axes.c              3   ,   K   | ]}|t           u d V  dS )r   N)r{   ).0args     r   	<genexpr>zBArray._fancy_selection.<locals>.expand_ellipsis.<locals>.<genexpr>  s&      <<SC8OOqOOOO<<r   r   zOnly one ellipsis may be used.r   NzToo many indices.)sumrd   rt   r{   r!   extendr   r   )argsrankn_el
final_argsn_argsidxr   s          r   expand_ellipsisz/Array._fancy_selection.<locals>.expand_ellipsis  s     <<D<<<<<Daxx !ABBBs4yyD00xk)JYYF%dOO + +S(??%%uT{{nv8I&JKKKK%%c****:%% !4555r   c                 h   | j         | j        | j        }}}|d}nt          |          }||}nt          |          }|d}nt          |          }|dk     rt	          d|z            ||k    rt	          d          ||k     rt	          d          |dk     r||z   }|dk     r||z   }d|cxk    r	|dz
  k    sn t	          d||dz
  fz            d|cxk    r|k    sn t	          d||fz            ||z
  |z  }||z
  |z  dk    r|dz  }||z   |k    rt	          d	||z   |fz            |||fS )
zGiven a slice object, return a 3-tuple (start, count, step)

            This is for for use with the hyperslab selection routines.

            Nr   r   zStep must be >= 1 (got %d)z&Zero-length selections are not allowedz(Reverse-order selections are not allowedz"Start index %s out of range (0-%d)z!Stop index %s out of range (1-%d)z)Selection out of bounds (%d; axis has %d))rf   rg   rh   r   rd   )expr   rf   rg   rh   counts         r   translate_slicez/Array._fancy_selection.<locals>.translate_slice  s    !$	38SX4E}E

|4yy|4yyaxx !=!DEEEu}} !IJJJe|| !KLLLqyyaxx}----&1*---- 8E6A:;NNP P P&&&&&&&& 74.HJ J J E\d*Eu$))
u}v%% ?U]F+,- - - %%%r   FNANDr   z*Empty selections are not allowed (axis %d)r   z"Only one selection list is allowedTz!Only integer coordinates allowed.i8r   z+Selection lists cannot have repeated valuesz(Only one selection list can be unorderedc              3   &   K   | ]}|d k    dV  dS )r   r   Nr   r   xs     r   r   z)Array._fancy_selection.<locals>.<genexpr>6  s&      'D'DaQ!VVVVVV'D'Dr   r)   NOTBc              3   &   K   | ]}|d k    |V  dS )r   Nr   r   s     r   r   z)Array._fancy_selection.<locals>.<genexpr>N  s&      33QAFFqFFFF33r   )rx   ry   rt   r   r!   zipr   r   listrP   rd   r   ru   integerndarray
issubdtyper   asarraywhereuniqueargsortr   absaranger|   )r   r   r   r   r   mshape	selection	list_seenreorderr   r   r   rf   r   rh   nexpnewordercorrected_idx
select_idxs                      r   _fancy_selectionzArray._fancy_selection  sN   	B 	B 	B	 	 	,0	& 0	& 0	&f 	$&& 	7DtS__55	"+Cdj,A,A"B"B ?	I ?	IC#v#u%% >I%4_S&%A%A"ud  %c5!ABBBe$$$$,s))C
 MM#c((++++	 ! % % %%CMM!$$$$$%
 s88q==$DsJL L LXX\\  )()MNNN$(		&s1vRZ/@AA M#CFBJ77MM#a&,
CCM ((KLLLz#T222xq&4->> t99BIdOO 4 444$EG G G<<>>Ns3xxk11rvh3s881D1D&DEEFF!KK*(FH H H$''D'D6'D'D'D$D$Dq$HM,h7G>D"'D		A"6"6 I IJ "CII--'Z(8&AAA!Q ! $Q#s4yy00 $R1 & $Z!^ 4q 8 $Z 05 8qyy!((%3)GHHH'I* 33&33333'6))s   	C;;"D D c                    |                                   	 |                     |          \  }}}}|                     ||||          }n|# t          $ ro 	 |                     |          }|                     |          }n@# t          $ r3 |                     |          \  }}	}|                     ||	|          }Y nw xY wY nw xY w| j        dk    s| j	        s|S t          || j                  S )ac  Get a row, a range of rows or a slice from the array.

        The set of tokens allowed for the key is the same as that for extended
        slicing in Python (including the Ellipsis or ... token).  The result is
        an object of the current flavor; its shape depends on the kind of slice
        used as key and the shape of the array itself.

        Furthermore, NumPy-style fancy indexing, where a list of indices in a
        certain axis is specified, is also supported.  Note that only one list
        per selection is supported right now.  Finally, NumPy-style point and
        boolean selections are supported as well.

        Examples
        --------

        ::

            array1 = array[4]                       # simple selection
            array2 = array[4:1000:2]                # slice selection
            array3 = array[1, ..., ::2, 1:4, 4:]    # general slice selection
            array4 = array[1, [1,5,10], ..., -1]    # fancy selection
            array5 = array[np.where(array[:] > 4)]  # point selection
            array6 = array[array[:] > 4]            # boolean selection

        numpy)_g_check_openr   _read_slicerP   _point_selection_read_coordsr   _read_selectionrW   r.   r   )
r   r   r   r   r   r   arrcoordsr   r   s
             r   __getitem__zArray.__getitem__Q  s#   6 		F*.*B*B3*G*G'FE5%""65%??CC 	F 	F 	FF..s33''// F F F,0,A,A#,F,F)	7E**9guEEF	F ;'!!!J!#t{333s5   2A	 	
C*A?>C?:B<9C;B<<CCc                 n   |                                   t          || j                  }|j        dk    rdS | j        j        >t          j        |j        t          j	                  st          || j        j                  }	 |                     |          \  }}}}|                     |||||           dS # t          $ rs 	 |                     |          }|                     ||           Y dS # t          $ r6 |                     |          \  }	}
}|                     |	|
||           Y Y dS w xY ww xY w)aB  Set a row, a range of rows or a slice in the array.

        It takes different actions depending on the type of the key parameter:
        if it is an integer, the corresponding array row is set to value (the
        value is broadcast when needed).  If key is a slice, the row slice
        determined by it is set to value (as usual, if the slice to be updated
        exceeds the actual shape of the array, only the values in the existing
        range are updated).

        If value is a multidimensional object, then its shape must be
        compatible with the shape determined by key, otherwise, a ValueError
        will be raised.

        Furthermore, NumPy-style fancy indexing, where a list of indices in a
        certain axis is specified, is also supported.  Note that only one list
        per selection is supported right now.  Finally, NumPy-style point and
        boolean selections are supported as well.

        Examples
        --------

        ::

            a1[0] = 333        # assign an integer to a Integer Array row
            a2[0] = 'b'        # assign a string to a string Array row
            a3[1:4] = 5        # broadcast 5 to slice 1:4
            a4[1:4:2] = 'xXx'  # broadcast 'xXx' to slice 1:4:2

            # General slice update (a5.shape = (4,3,2,8,5,10).
            a5[1, ..., ::2, 1:4, 4:] = numpy.arange(1728, shape=(4,3,2,4,3,6))
            a6[1, [1,5,10], ..., -1] = arr    # fancy selection
            a7[np.where(a6[:] > 4)] = 4       # point selection + broadcast
            a8[arr > 4] = arr2                # boolean selection

        r   N)r   r   r   r    filtersleast_significant_digitru   r   r   signedintegerr   r   _write_slicerP   r   _write_coordsr   _write_selection)r   r   valuerX   r   r   r   r   r   r   r   s              r   __setitem__zArray.__setitem__  sn   J 	 $E4955:??F L0<M%+r/?@@ =UDL$HIIE
	H*.*B*B3*G*G'FE5%feUE5AAAAA 	H 	H 	HH..s33""65111111 H H H,0,A,A#,F,F)	7E%%i%GGGGGGGH	Hs*   3B7 7
D4+C00;D0+D4/D00D4c                     |j         || j        j        j         z   k    r't          j        || j        j                  }||d<   |S |S )zTest that nparr shape is consistent with underlying object.

        If not, try creating a new nparr object, using broadcasting if
        necessary.

        rs   .)r   r   r   ru   rv   )r   rX   slice_shapenarrs       r   _check_shapezArray._check_shape  sJ     ;;)>>??8+TY_EEED DIKLr   c                     t          j        | j        j        |          }d|vr|                     ||||           |j        dk    r|d         }|S )z4Read a slice based on `startl`, `stopl` and `stepl`.r   r   r   r   )ru   rv   r   r   _g_read_slicer   )r   r   r   r   r   rX   s         r   r   zArray._read_slice  sZ     tye<<<E>>vueU;;;;""IEr   c                     t          j        | j        j        t	          |                    }t	          |          dk    r|                     ||           |j        dk    r|d         }|S )z)Read a set of points defined by `coords`.r   r   r   )ru   rv   r   r   rt   _g_read_coordsr   r   r   rX   s      r   r   zArray._read_coords  sb     tyc&kkBBBv;;??...;""IEr   c                 d   t          j        | j        j        |          }|                     ||           |j        dk    r	|d         }ne|c|\  }}t          d          gt          |          z  }|                                ||<   |t          |                   
                                }|S )z<Read a `selection`.

        Reorder if necessary.

        r   r   N)ru   rv   r   r   _g_read_selectionr   r   rt   r   ry   copyr   r   r   r   rX   r   r   ks           r   r   zArray._read_selection  s     tye<<<y%000;""IEE #MCtE

*A%%''AcF %((O((**Er   c                     |                      |t          |                    }||z
  dz
  |z  dz   }|                     ||||           dS )z@Write `nparr` in a slice based on `startl`, `stopl` and `stepl`.r   N)r   ry   _g_write_slice)r   r   r   r   r   rX   countls          r   r   zArray._write_slice  sW     !!%u666>A%%/14FE6599999r   c                     t          |          dk    r<|                     |t          |          f          }|                     ||           dS dS )z?Write `nparr` values in points defined by `coords` coordinates.r   N)rt   r   _g_write_coordsr   s      r   r   zArray._write_coords	  sS     v;;??%%ec&kk^<<E  ///// ?r   c                    |                      |t          |                    }|Q|\  }}t          d          gt          |          z  }|||<   |t          |                                                   }|                     ||           dS )zFWrite `nparr` in `selection`.

        Reorder if necessary.

        N)r   ry   r   rt   r   _g_write_selectionr   s           r   r   zArray._write_selection  s     !!%u66#MCtE

*AAcF %((O((**E	511111r   c                    t          t          |||                    }t          | j                  }|r
||| j        <   |!t          j        | j        j        |          }nN| j	        |z  }||j
        k    rt          d|j
         d| d          |j        d         st          d          |}d|vr|                     ||||           |:t          |j        j                 t           j        k    r|                    d	           |S )
z<Read the array from disk without slice or flavor processing.Nr   zoutput array size invalid, got z bytes, need z bytesC_CONTIGUOUSzoutput array not C contiguousr   T)rt   r|   r   r   r   ru   rv   r   r   r"   nbytes
ValueErrorflags_read_arrayr   r@   sysbyteswap)	r   rf   rg   rh   outnrowstoreadr   r   bytes_requireds	            r   ro   zArray._read"  s4    %tT2233TZ   	."-E$,;(>>>CC!\K7N++  "H3: "H "H1?"H "H "H I I I9^, B !@AAACE>>UD$444 O39./3=@@LL
r   c                 &   |                                   |4| j        dk    r)d                    | j                  }t          |          |                     |||          \  }}}|                     ||||          }t          || j                  S )ar  Get data in the array as an object of the current flavor.

        The start, stop and step parameters can be used to select only a
        *range of rows* in the array.  Their meanings are the same as in
        the built-in range() Python function, except that negative values
        of step are not allowed yet. Moreover, if only start is specified,
        then stop will be set to start + 1. If you do not specify neither
        start nor stop, then *all the rows* in the array are selected.

        The out parameter may be used to specify a NumPy array to receive
        the output data.  Note that the array must have the same size as
        the data selected with the other parameters.  Note that the array's
        datatype is not checked and no type casting is performed, so if it
        does not match the datatype on disk, the output will not be correct.
        Also, this parameter is only valid when the array's flavor is set
        to 'numpy'.  Otherwise, a TypeError will be raised.

        When data is read from disk in NumPy format, the output will be
        in the current system's byteorder, regardless of how it is stored
        on disk.
        The exception is when an output buffer is supplied, in which case
        the output will be in the byteorder of that output buffer.

        .. versionchanged:: 3.0
           Added the *out* parameter.

        Nr   zXOptional 'out' argument may only be supplied if array flavor is 'numpy', currently is {})r   rW   formatrP   _process_range_readro   r   )r   rf   rg   rh   r   msgr   s          r   readz
Array.read?  s    : 	?t{g5589?9L9L C.. "66udDIIdjjdC00!#t{333r   c
                    |                      |||          \  }}}| j        r| |||         }n| d         }t          |||||	| j                  }t	          j        | j        t                    | j        j        z  }||fS )z2Private part of Leaf.copy() for each kind of leaf.r   )r?   rA   rB   r   )r   r   r   r   ru   prodr   r    )r   groupr=   rf   rg   rh   r?   r   
chunkshaperA   kwargsr   object_r   s                 r   _g_copy_with_statszArray._g_copy_with_statse  s    
 #66udDIId : 	uT$'CCr(C
 tSD"i) ) )8444ty~E  r   c                 Z    |  d| j         d| j        d| j        d| j        d| j        S )z;This provides more metainfo in addition to standard __str__z
  atom := z
  maindim := z
  flavor := z
  byteorder := z
  chunkshape := )r   r   rW   r@   r   r   s    r   __repr__zArray.__repr__{  sg      ' '9' 'l' ' [' ' 	' '
 ' ' 	'r   )Nr'   NTNT)NNN)N)NNNN)#__name__
__module____qualname____doc__
_c_classidr   r   propertyr   r"   r&   r;   rY   r]   ra   ri   rk   re   rq   r   r   r   r   r   r   r   r   r   r   r   ro   r   r   r  __classcell__)rE   s   @r   r   r      s/       7 7t J  X , , X,   X ) ) X) "$26!:& :& :& :& :& :&x)  )  ) V    ! ! ! !F  87 7 7#$ #$ #$JA+ A+ A+Fm* m* m*^.4 .4 .4`<H <H <H|  &  	 	 	  0: : :0 0 02 2 2$   :$4 $4 $4 $4L! ! !,' ' ' ' ' ' 'r   r   c                       e Zd ZdZdZdS )
ImageArrayzArray containing an image.

    This class has no additional behaviour or functionality compared to
    that of an ordinary array.  It simply enables the user to open an
    ``IMAGE`` HDF5 node as a normal `Array` node in PyTables.

    IMAGEN)r  r  r  r  r  r   r   r   r  r    s          JJJr   r  )r  r}   r   r   ru   r'   r   r   r   rW   r   r   r   leafr	   utilsr
   r   r   r   r   r   rK   r   r  r   r   r   <module>r     s@   & &  



                 D D D D D D D D D D      * * * * * * * * * * * * * * * * 	k' k' k' k' k'M k' k' k'\
 
 
 
 
 
 
 
 
 
r   