/usr/local/lib64/python3.6/site-packages/numpy/lib/__pycache__
NameSizeModeActions
arraypad.cpython-36.pyc218270644editdlrm
arraysetops.cpython-36.pyc218080644editdlrm
arrayterator.cpython-36.pyc70210644editdlrm
financial.cpython-36.pyc300600644editdlrm
format.cpython-36.pyc251790644editdlrm
function_base.cpython-36.pyc1372260644editdlrm
histograms.cpython-36.pyc320230644editdlrm
index_tricks.cpython-36.pyc279100644editdlrm
mixins.cpython-36.pyc71120644editdlrm
nanfunctions.cpython-36.pyc544600644editdlrm
npyio.cpython-36.pyc670620644editdlrm
polynomial.cpython-36.pyc381770644editdlrm
recfunctions.cpython-36.pyc473250644editdlrm
scimath.cpython-36.pyc153490644editdlrm
setup.cpython-36.pyc5500644editdlrm
shape_base.cpython-36.pyc358480644editdlrm
stride_tricks.cpython-36.pyc83150644editdlrm
twodim_base.cpython-36.pyc280230644editdlrm
type_check.cpython-36.pyc192370644editdlrm
ufunclike.cpython-36.pyc78410644editdlrm
user_array.cpython-36.pyc113380644editdlrm
utils.cpython-36.pyc246410644editdlrm
_datasource.cpython-36.pyc204000644editdlrm
_iotools.cpython-36.pyc259030644editdlrm
_version.cpython-36.pyc48190644editdlrm
__init__.cpython-36.pyc15700644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/numpy/lib/__pycache__/arrayterator.cpython-36.pyc (7021B)
3 Eg@s4dZddlmZddlmZdgZGdddZdS)a$ A buffered iterator for big arrays. This module solves the problem of iterating over a big file-based array without having to read it into memory. The `Arrayterator` class wraps an array object, and when iterated it will return sub-arrays with at most a user-specified number of elements. )mul)reduce Arrayteratorc@sReZdZdZdddZddZddZd d Zed d Z ed dZ ddZ dS)ra Buffered iterator for big arrays. `Arrayterator` creates a buffered iterator for reading big arrays in small contiguous blocks. The class is useful for objects stored in the file system. It allows iteration over the object *without* reading everything in memory; instead, small blocks are read and iterated over. `Arrayterator` can be used with any object that supports multidimensional slices. This includes NumPy arrays, but also variables from Scientific.IO.NetCDF or pynetcdf for example. Parameters ---------- var : array_like The object to iterate over. buf_size : int, optional The buffer size. If `buf_size` is supplied, the maximum amount of data that will be read into memory is `buf_size` elements. Default is None, which will read as many element as possible into memory. Attributes ---------- var buf_size start stop step shape flat See Also -------- ndenumerate : Multidimensional array iterator. flatiter : Flat array iterator. memmap : Create a memory-map to an array stored in a binary file on disk. Notes ----- The algorithm works by first finding a "running dimension", along which the blocks will be extracted. Given an array of dimensions ``(d1, d2, ..., dn)``, e.g. if `buf_size` is smaller than ``d1``, the first dimension will be used. If, on the other hand, ``d1 < buf_size < d1*d2`` the second dimension will be used, and so on. Blocks are extracted along this dimension, and when the last block is returned the process continues from the next dimension, until all elements have been read. Examples -------- >>> a = np.arange(3 * 4 * 5 * 6).reshape(3, 4, 5, 6) >>> a_itor = np.lib.Arrayterator(a, 2) >>> a_itor.shape (3, 4, 5, 6) Now we can iterate over ``a_itor``, and it will return arrays of size two. Since `buf_size` was smaller than any dimension, the first dimension will be iterated over first: >>> for subarr in a_itor: ... if not subarr.all(): ... print(subarr, subarr.shape) # doctest: +SKIP >>> # [[[[0 1]]]] (1, 1, 1, 2) NcCsF||_||_dd|jD|_dd|jD|_dd|jD|_dS)NcSsg|]}dqS)r).0dimrrB/usr/local/lib64/python3.6/site-packages/numpy/lib/arrayterator.py Xsz)Arrayterator.__init__..cSsg|]}|qSrr)rrrrrr YscSsg|]}dqS)r)rrrrrr Zs)varbuf_sizeshapestartstopstep)selfr r rrr__init__Ts zArrayterator.__init__cCs t|j|S)N)getattrr )rattrrrr __getattr__\szArrayterator.__getattr__c CsXt|ts|f}g}t||j}}xf|D]^}|tkr\|jtdg||dt|}q*t|tr~|jt||ddq*|j|q*Wt|}t||kr|tdf|t|7}|j |j |j }xt t |j|j|j|D]l\}\}} } }||jpd|j|<| |jpd|j|<||jp0| ||j|<t| |j||j|<qW|S)z- Return a new arrayterator. Nr r) isinstancetuplelenndimEllipsisextendsliceintappend __class__r r enumerateziprrrmin) rindexZfixedlengthZdimsslice_outirrrrrr __getitem___s,     &zArrayterator.__getitem__cCs*tddt|j|j|jD}|j|S)z- Return corresponding data. css|]}t|VqdS)N)r)rtrrr sz)Arrayterator.__array__..)rr!rrrr )rr%rrr __array__s zArrayterator.__array__ccsx|D]}|jEdHqWdS)aG A 1-D flat iterator for Arrayterator objects. This iterator returns elements of the array to be iterated over in `Arrayterator` one by one. It is similar to `flatiter`. See Also -------- Arrayterator flatiter Examples -------- >>> a = np.arange(3 * 4 * 5 * 6).reshape(3, 4, 5, 6) >>> a_itor = np.lib.Arrayterator(a, 2) >>> for subarr in a_itor.flat: ... if not subarr: ... print(subarr, type(subarr)) ... 0 N)flat)rblockrrrr,s zArrayterator.flatcCs tddt|j|j|jDS)zk The shape of the array to be iterated over. For an example, see `Arrayterator`. css(|] \}}}||d|dVqdS)r Nr)rrrrrrrr*sz%Arrayterator.shape..)rr!rrr)rrrrr szArrayterator.shapec csdd|jDrdS|jdd}|jdd}|jdd}|jj}xR|jpZtt|j}d}xt |dddD]~}|dkr||d||<n:||j|kr|||||||<|}n|j|||<t |j|||||<||j|}qrWt ddt |||D}|j|V||||<xZt |ddd D]F}|||j|kr8|j|||<||d|j|d7<q8W|d|jdkrJdSqJWdS) NcSsg|]}|dkr|qS)rr)rrrrrr sz)Arrayterator.__iter__..rr css|]}t|VqdS)N)r)rr)rrrr*sz(Arrayterator.__iter__..r.r.) r rrrr rr rrranger"rr!) rrrrZndimscountZrundimr'r%rrr__iter__s6  $zArrayterator.__iter__)N) __name__ __module__ __qualname____doc__rrr(r+propertyr,r r1rrrrrsB    N)r5operatorr functoolsr__all__rrrrr s