hyb
2026-01-09 4cb426cb3ae31e772a09d4ade5b2f0242aaeefa0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Ë
Kñúhãó:—dZddlmZddlmZdgZGd„d«Zy)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.
 
é)Úreduce)ÚmulÚ ArrayteratorcóV—eZdZdZdZd d„Zd„Zd„Zd d„Zed„«Z    ed    „«Z
d
„Z y) 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
    --------
    numpy.ndenumerate : Multidimensional array iterator.
    numpy.flatiter : Flat array iterator.
    numpy.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
    --------
    >>> import numpy as np
    >>> 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)
 
    z    numpy.libNcóä—||_||_|jDcgc]}d‘Œc}|_t    |j«|_|jDcgc]}d‘Œc}|_ycc}wcc}w)Nré)ÚvarÚbuf_sizeÚshapeÚstartÚlistÚstopÚstep)Úselfr    r
Údims    úOH:\Change_password\venv_build\Lib\site-packages\numpy/lib/_arrayterator_impl.pyÚ__init__zArrayterator.__init__XsS€ØˆŒØ ˆŒ à#&§9¡9Ö-˜C’aÒ-ˆŒ
ܘŸ™“OˆŒ    Ø"%§)¡)Ö,˜3’QÒ,ˆ    ùò.ùâ,s     A(Á    A-có.—t|j|«S©N)Úgetattrr    )rÚattrs  rÚ __getattr__zArrayterator.__getattr__`s€Üt—x‘x Ó&Ð&ócó®—t|t«s|f}g}t|«|j}}|D]{}|tur0|j t d«g||z
dzz«t|«}Œ;t|t«r |jt ||dzd««Œk|j|«Œ}t|«}t|«|kr|t d«f|t|«z
zz }|j|j|j«}tt|j|j|j |««D]“\}\}}    }
}||jxsdz|j|<|
|j xsdz|j |<||jxs|    |z
z|j|<t#|    |j|«|j|<Œ•|S)z-
        Return a new arrayterator.
 
        Nrr)Ú
isinstanceÚtupleÚlenÚndimÚEllipsisÚextendÚsliceÚintÚappendÚ    __class__r    r
Ú    enumerateÚzipr rrÚmin) rÚindexÚfixedÚlengthÚdimsÚslice_ÚoutÚir rrs            rÚ __getitem__zArrayterator.__getitem__cs€ô ˜%¤Ô'ؐHˆE؈ܘ5“z 4§9¡9ˆØò    %ˆFØœÑ!Ø— ‘ œe D›k˜]¨d°V©m¸aÑ.?Ñ@ÔAܘU›‘ܘF¤CÔ(Ø— ‘ œU 6¨6°A©:°qÓ9Õ:à— ‘ ˜VÕ$ð    %ôe“ ˆÜ ˆu‹:˜Ò Ø ”e˜D“k^ t¬c°%«jÑ'8Ñ9Ñ 9ˆEðn‰n˜TŸX™X t§}¡}Ó5ˆÜ.7ܐD—J‘J §    ¡    ¨4¯9©9°eÓ<ó/>ò    1Ñ *ˆAÑ*t˜T 6à  F§L¡LÒ$5°AÑ6ˆCI‰Ia‰LØ &§+¡+Ò"2°Ñ3ˆCH‰HQ‰KØ 6§;¡;Ò#>°$¸±,Ñ?ˆCH‰HQ‰Kܘd C§H¡H¨Q¡KÓ0ˆCH‰HQŠKð     1ð ˆ
rcó–—td„t|j|j|j«D««}|j
|S)z-
        Return corresponding data.
 
        c3ó,K—|] }t|Ž–—Œy­wr©r!©Ú.0Úts  rú    <genexpr>z)Arrayterator.__array__.<locals>.<genexpr>ˆsèø€ò3 Q”u˜a”yñ3ùó‚)rr&r rrr    )rÚdtypeÚcopyr,s    rÚ    __array__zArrayterator.__array__ƒsA€ô
ñ3¬#Ø—
‘
˜DŸI™I t§y¡yó+2ô3ó3ˆàx‰x˜ÑÐrc#óFK—|D]}|jEd{–—†Œy7Œ­w)aX
        A 1-D flat iterator for Arrayterator objects.
 
        This iterator returns elements of the array to be iterated over in
        `~lib.Arrayterator` one by one.
        It is similar to `flatiter`.
 
        See Also
        --------
        lib.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 <class 'numpy.int64'>
 
        N)Úflat)rÚblocks  rr<zArrayterator.flatŒs'èø€ð4ò    "ˆEØ—z‘z× !Ñ !ñ    "Ø !ús ‚!—˜!cóx—td„t|j|j|j«D««S)zk
        The shape of the array to be iterated over.
 
        For an example, see `Arrayterator`.
 
        c3ó@K—|]\}}}||z
dz
|zdz–—Œy­w)rN©)r4r rrs    rr6z%Arrayterator.shape.<locals>.<genexpr>±s.èø€ò7Ñ:K¸%ÀÀtt˜e‘| aÑ'¨DÑ0°1Õ4ñ7ùs‚)rr&r rr)rs rr zArrayterator.shape©s3€ôñ7ܐD—J‘J §    ¡    ¨4¯9©9Ó5ô7ó7ð    7rc#ó¦K—|jDcgc]
}|dksŒ    |‘Œ c}ry|jdd}|jdd}|jdd}|jj
}    |j xstt|j«}d}t|dz
dd«D]|}|dk(r ||dz||<n8||j|kr|||||zz||<|}n|j|||<t|j|||«||<||j|z}Œ~td„t|||«D««}    |j|    –—||||<t|dz
dd«D]J}|||j|k\sŒ|j|||<||dz
xx|j|dz
z cc<ŒL|d|jdk\ryŒdcc}w­w)Nrréÿÿÿÿc3ó,K—|] }t|Ž–—Œy­wrr2r3s  rr6z(Arrayterator.__iter__.<locals>.<genexpr>Õsèø€ÒE¨œ5 !œ9ÑEùr7) r r rrr    rr
rrÚranger'rr&)
rrr rrÚndimsÚcountÚrundimr.r,s
          rÚ__iter__zArrayterator.__iter__´sÛèø€àŸ:™:Ö 2C¨°«ŠCÓ 2Ø à—
‘
™1 ˆØy‰y™ˆ|ˆØy‰y™ˆ|ˆØ—‘— ‘ ˆàØ—M‘MÒ<¤V¬C°·±Ó%<ˆEð
ˆFܘ5 1™9 b¨"Ó-ò /ð˜A’:Ø# A™h¨™lD˜’GؘdŸj™j¨™mÒ+à# A™h¨°°a±©Ñ8D˜‘GØ‘Fð#Ÿi™i¨™lD˜‘GܘdŸi™i¨™l¨D°©GÓ4Q‘Ø §¡¨A¡Ñ.‘ð /ô ÑE¬c°%¸¸tÓ.DÔEÓEˆFØ—(‘(˜6Ñ"Ò "ð! ™LˆE&‰Mܘ5 1™9 a¨Ó,ò 5Ø˜‘8˜tŸy™y¨™|Ó+Ø#Ÿz™z¨!™}E˜!‘Hؘ!˜a™%“L D§I¡I¨a°!©eÑ$4Ñ4”Lð 5ðQ‰x˜4Ÿ9™9 Q™<Ò'ØñEùò 3ùs‚G‘
G œG  EGÆAGr)NN) Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrr/r:Úpropertyr<r rHr@rrrrsR„ñCðJ€Jó-ò'òó@ ðñ"óð"ð8ñ7óð7ó,rN)rLÚ    functoolsrÚoperatorrÚ__all__rr@rrú<module>rQs&ðñõÝà Ð
€÷PòPr