array-split 0.6.5__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ Copyright (C) 2017 The Australian National University.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
4
+ software and associated documentation files (the "Software"), to deal in the Software
5
+ without restriction, including without limitation the rights to use, copy, modify, merge,
6
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7
+ to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or
10
+ substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
13
+ BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,255 @@
1
+ Metadata-Version: 2.1
2
+ Name: array_split
3
+ Version: 0.6.5
4
+ Summary: The array_split python package is an enhancement to existing numpy.ndarray functions (such as numpy.array_split) which sub-divide a multi-dimensional array into a number of multi-dimensional sub-arrays (slices)
5
+ Author-email: Shane-J-Latham <array.split@gmail.com>, array-split <array.split@gmail.com>
6
+ License: Copyright (C) 2017 The Australian National University.
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
9
+ software and associated documentation files (the "Software"), to deal in the Software
10
+ without restriction, including without limitation the rights to use, copy, modify, merge,
11
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
12
+ to whom the Software is furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all copies or
15
+ substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18
+ BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ Project-URL: Homepage, https://github.com/array-split/array_split
24
+ Project-URL: Documentation, https://array-split.readthedocs.io/en/latest/
25
+ Project-URL: Repository, https://github.com/array-split/array_split
26
+ Project-URL: Issues, https://github.com/array-split/array_split/issues
27
+ Keywords: multi-dimensional-array,array,sub-array,tile,tiling,splitting,split,partition,partitioning,scipy,numpy,ndarray,domain-decomposition,array-decomposition
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/x-rst
33
+ License-File: LICENSE.txt
34
+
35
+
36
+ =============
37
+ `array_split`
38
+ =============
39
+
40
+ .. Start of sphinx doc include.
41
+ .. start long description.
42
+ .. start badges.
43
+
44
+ .. image:: https://img.shields.io/pypi/v/array_split.svg
45
+ :target: https://pypi.python.org/pypi/array_split/
46
+ :alt: array_split python package
47
+ .. image:: https://github.com/array-split/array_split/actions/workflows/python-test.yml/badge.svg
48
+ :target: https://github.com/array-split/array_split/actions/workflows/python-test.yml
49
+ :alt: array_split python package
50
+ .. image:: https://readthedocs.org/projects/array-split/badge/?version=stable
51
+ :target: http://array-split.readthedocs.io/en/stable
52
+ :alt: Documentation Status
53
+ .. image:: https://coveralls.io/repos/github/array-split/array_split/badge.svg
54
+ :target: https://coveralls.io/github/array-split/array_split
55
+ :alt: Coveralls Status
56
+ .. image:: https://img.shields.io/pypi/l/array_split.svg
57
+ :target: https://pypi.python.org/pypi/array_split/
58
+ :alt: MIT License
59
+ .. image:: https://img.shields.io/pypi/pyversions/array_split.svg
60
+ :target: https://pypi.python.org/pypi/array_split/
61
+ :alt: array_split python package
62
+ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.889078.svg
63
+ :target: https://doi.org/10.5281/zenodo.889078
64
+ .. image:: http://joss.theoj.org/papers/10.21105/joss.00373/status.svg
65
+ :target: http://joss.theoj.org/papers/4b59c7430176ef78c80c6a1100031eb6
66
+
67
+ .. end badges.
68
+
69
+ The `array_split <http://array-split.readthedocs.io/en/latest>`_ python package is
70
+ an enhancement to existing
71
+ `numpy.ndarray <http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html>`_ functions,
72
+ such as
73
+ `numpy.array_split <http://docs.scipy.org/doc/numpy/reference/generated/numpy.array_split.html>`_,
74
+ `skimage.util.view_as_blocks <http://scikit-image.org/docs/0.13.x/api/skimage.util.html#view-as-blocks>`_
75
+ and
76
+ `skimage.util.view_as_windows <http://scikit-image.org/docs/0.13.x/api/skimage.util.html#view-as-windows>`_,
77
+ which sub-divide a multi-dimensional array into a number of multi-dimensional sub-arrays (slices).
78
+ Example application areas include:
79
+
80
+ **Parallel Processing**
81
+ A large (dense) array is partitioned into smaller sub-arrays which can be
82
+ processed concurrently by multiple processes
83
+ (`multiprocessing <https://docs.python.org/3/library/multiprocessing.html>`_
84
+ or `mpi4py <http://pythonhosted.org/mpi4py/>`_) or other memory-limited hardware
85
+ (e.g. GPGPU using `pyopencl <https://mathema.tician.de/software/pyopencl/>`_,
86
+ `pycuda <https://mathema.tician.de/software/pycuda/>`_, etc).
87
+ For GPGPU, it is necessary for sub-array not to exceed the GPU memory and
88
+ desirable for the sub-array shape to be a multiple of the *work-group*
89
+ (`OpenCL <https://en.wikipedia.org/wiki/OpenCL>`_)
90
+ or *thread-block* (`CUDA <https://en.wikipedia.org/wiki/CUDA>`_) size.
91
+
92
+ **File I/O**
93
+ A large (dense) array is partitioned into smaller sub-arrays which can be
94
+ written to individual files
95
+ (as, for example, a
96
+ `HDF5 Virtual Dataset <https://support.hdfgroup.org/HDF5/docNewFeatures/NewFeaturesVirtualDatasetDocs.html>`_).
97
+ It is often desirable for the individual files not to exceed a specified number
98
+ of (Giga) bytes and, for `HDF5 <https://support.hdfgroup.org/HDF5/>`_, it is desirable
99
+ to have the individual file sub-array shape a multiple of
100
+ the `chunk shape <https://support.hdfgroup.org/HDF5/doc1.8/Advanced/Chunking/index.html>`_.
101
+ Similarly, `out of core <https://en.wikipedia.org/wiki/Out-of-core_algorithm>`_
102
+ algorithms for large dense arrays often involve processing the entire data-set as
103
+ a series of *in-core* sub-arrays. Again, it is desirable for the individual sub-array shape
104
+ to be a multiple of the
105
+ `chunk shape <https://support.hdfgroup.org/HDF5/doc1.8/Advanced/Chunking/index.html>`_.
106
+
107
+
108
+ The `array_split <http://array-split.readthedocs.io/en/latest>`_ package provides the
109
+ means to partition an array (or array shape) using any of the following criteria:
110
+
111
+ - Per-axis indices indicating the *cut* positions.
112
+ - Per-axis number of sub-arrays.
113
+ - Total number of sub-arrays (with optional per-axis *number of sections* constraints).
114
+ - Specific sub-array shape.
115
+ - Specification of *halo* (*ghost*) elements for sub-arrays.
116
+ - Arbitrary *start index* for the shape to be partitioned.
117
+ - Maximum number of bytes for a sub-array with constraints:
118
+
119
+ - sub-arrays are an even multiple of a specified sub-tile shape
120
+ - upper limit on the per-axis sub-array shape
121
+
122
+
123
+ Quick Start Example
124
+ ===================
125
+
126
+
127
+ >>> from array_split import array_split, shape_split
128
+ >>> import numpy as np
129
+ >>>
130
+ >>> ary = np.arange(0, 4*9)
131
+ >>>
132
+ >>> array_split(ary, 4) # 1D split into 4 sections (like numpy.array_split)
133
+ [array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
134
+ array([ 9, 10, 11, 12, 13, 14, 15, 16, 17]),
135
+ array([18, 19, 20, 21, 22, 23, 24, 25, 26]),
136
+ array([27, 28, 29, 30, 31, 32, 33, 34, 35])]
137
+ >>>
138
+ >>> shape_split(ary.shape, 4) # 1D split into 4 parts, returns slice objects
139
+ array([(slice(0, 9, None),), (slice(9, 18, None),), (slice(18, 27, None),), (slice(27, 36, None),)],
140
+ dtype=[('0', 'O')])
141
+ >>>
142
+ >>> ary = ary.reshape(4, 9) # Make ary 2D
143
+ >>> split = shape_split(ary.shape, axis=(2, 3)) # 2D split into 2*3=6 sections
144
+ >>> split.shape
145
+ (2, 3)
146
+ >>> split
147
+ array([[(slice(0, 2, None), slice(0, 3, None)),
148
+ (slice(0, 2, None), slice(3, 6, None)),
149
+ (slice(0, 2, None), slice(6, 9, None))],
150
+ [(slice(2, 4, None), slice(0, 3, None)),
151
+ (slice(2, 4, None), slice(3, 6, None)),
152
+ (slice(2, 4, None), slice(6, 9, None))]],
153
+ dtype=[('0', 'O'), ('1', 'O')])
154
+ >>> sub_arys = [ary[tup] for tup in split.flatten()] # Create sub-array views from slice tuples.
155
+ >>> sub_arys
156
+ [array([[ 0, 1, 2], [ 9, 10, 11]]),
157
+ array([[ 3, 4, 5], [12, 13, 14]]),
158
+ array([[ 6, 7, 8], [15, 16, 17]]),
159
+ array([[18, 19, 20], [27, 28, 29]]),
160
+ array([[21, 22, 23], [30, 31, 32]]),
161
+ array([[24, 25, 26], [33, 34, 35]])]
162
+
163
+
164
+ Latest sphinx documentation (including more examples)
165
+ at http://array-split.readthedocs.io/en/latest/.
166
+
167
+ .. end long description.
168
+
169
+ Installation
170
+ ============
171
+
172
+ Using ``pip`` (root access required):
173
+
174
+ ``pip install array_split``
175
+
176
+ or local user install (no root access required):
177
+
178
+ ``pip install --user array_split``
179
+
180
+ or local user install from latest github source:
181
+
182
+ ``pip install --user git+git://github.com/array-split/array_split.git#egg=array_split``
183
+
184
+
185
+ Requirements
186
+ ============
187
+
188
+ Requires `numpy <http://docs.scipy.org/doc/numpy/>`_ version `>= 1.6`,
189
+ python-2 version `>= 2.6` or python-3 version `>= 3.2`.
190
+
191
+ Testing
192
+ =======
193
+
194
+ Run tests (unit-tests and doctest module docstring tests) using::
195
+
196
+ python -m array_split.tests
197
+
198
+ or, from the source tree, run::
199
+
200
+ python setup.py test
201
+
202
+
203
+ Travis CI at:
204
+
205
+ https://travis-ci.org/array-split/array_split/
206
+
207
+ and AppVeyor at:
208
+
209
+ https://ci.appveyor.com/project/array-split/array-split
210
+
211
+ Documentation
212
+ =============
213
+
214
+ Latest sphinx generated documentation is at:
215
+
216
+ http://array-split.readthedocs.io/en/latest
217
+
218
+ and at github *gh-pages*:
219
+
220
+ https://array-split.github.io/array_split/
221
+
222
+ Sphinx documentation can be built from the source::
223
+
224
+ python setup.py build_sphinx
225
+
226
+ with the HTML generated in ``docs/_build/html``.
227
+
228
+
229
+ Latest source code
230
+ ==================
231
+
232
+ Source at github:
233
+
234
+ https://github.com/array-split/array_split
235
+
236
+
237
+ Bug Reports
238
+ ===========
239
+
240
+ To search for bugs or report them, please use the bug tracker at:
241
+
242
+ https://github.com/array-split/array_split/issues
243
+
244
+
245
+ Contributing
246
+ ============
247
+
248
+ Check out the `CONTRIBUTING doc <https://github.com/array-split/array_split/blob/dev/CONTRIBUTING.rst>`_.
249
+
250
+
251
+ License information
252
+ ===================
253
+
254
+ See the file `LICENSE.txt <https://github.com/array-split/array_split/blob/dev/LICENSE.txt>`_
255
+ for terms & conditions, for usage and a DISCLAIMER OF ALL WARRANTIES.
@@ -0,0 +1,221 @@
1
+
2
+ =============
3
+ `array_split`
4
+ =============
5
+
6
+ .. Start of sphinx doc include.
7
+ .. start long description.
8
+ .. start badges.
9
+
10
+ .. image:: https://img.shields.io/pypi/v/array_split.svg
11
+ :target: https://pypi.python.org/pypi/array_split/
12
+ :alt: array_split python package
13
+ .. image:: https://github.com/array-split/array_split/actions/workflows/python-test.yml/badge.svg
14
+ :target: https://github.com/array-split/array_split/actions/workflows/python-test.yml
15
+ :alt: array_split python package
16
+ .. image:: https://readthedocs.org/projects/array-split/badge/?version=stable
17
+ :target: http://array-split.readthedocs.io/en/stable
18
+ :alt: Documentation Status
19
+ .. image:: https://coveralls.io/repos/github/array-split/array_split/badge.svg
20
+ :target: https://coveralls.io/github/array-split/array_split
21
+ :alt: Coveralls Status
22
+ .. image:: https://img.shields.io/pypi/l/array_split.svg
23
+ :target: https://pypi.python.org/pypi/array_split/
24
+ :alt: MIT License
25
+ .. image:: https://img.shields.io/pypi/pyversions/array_split.svg
26
+ :target: https://pypi.python.org/pypi/array_split/
27
+ :alt: array_split python package
28
+ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.889078.svg
29
+ :target: https://doi.org/10.5281/zenodo.889078
30
+ .. image:: http://joss.theoj.org/papers/10.21105/joss.00373/status.svg
31
+ :target: http://joss.theoj.org/papers/4b59c7430176ef78c80c6a1100031eb6
32
+
33
+ .. end badges.
34
+
35
+ The `array_split <http://array-split.readthedocs.io/en/latest>`_ python package is
36
+ an enhancement to existing
37
+ `numpy.ndarray <http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html>`_ functions,
38
+ such as
39
+ `numpy.array_split <http://docs.scipy.org/doc/numpy/reference/generated/numpy.array_split.html>`_,
40
+ `skimage.util.view_as_blocks <http://scikit-image.org/docs/0.13.x/api/skimage.util.html#view-as-blocks>`_
41
+ and
42
+ `skimage.util.view_as_windows <http://scikit-image.org/docs/0.13.x/api/skimage.util.html#view-as-windows>`_,
43
+ which sub-divide a multi-dimensional array into a number of multi-dimensional sub-arrays (slices).
44
+ Example application areas include:
45
+
46
+ **Parallel Processing**
47
+ A large (dense) array is partitioned into smaller sub-arrays which can be
48
+ processed concurrently by multiple processes
49
+ (`multiprocessing <https://docs.python.org/3/library/multiprocessing.html>`_
50
+ or `mpi4py <http://pythonhosted.org/mpi4py/>`_) or other memory-limited hardware
51
+ (e.g. GPGPU using `pyopencl <https://mathema.tician.de/software/pyopencl/>`_,
52
+ `pycuda <https://mathema.tician.de/software/pycuda/>`_, etc).
53
+ For GPGPU, it is necessary for sub-array not to exceed the GPU memory and
54
+ desirable for the sub-array shape to be a multiple of the *work-group*
55
+ (`OpenCL <https://en.wikipedia.org/wiki/OpenCL>`_)
56
+ or *thread-block* (`CUDA <https://en.wikipedia.org/wiki/CUDA>`_) size.
57
+
58
+ **File I/O**
59
+ A large (dense) array is partitioned into smaller sub-arrays which can be
60
+ written to individual files
61
+ (as, for example, a
62
+ `HDF5 Virtual Dataset <https://support.hdfgroup.org/HDF5/docNewFeatures/NewFeaturesVirtualDatasetDocs.html>`_).
63
+ It is often desirable for the individual files not to exceed a specified number
64
+ of (Giga) bytes and, for `HDF5 <https://support.hdfgroup.org/HDF5/>`_, it is desirable
65
+ to have the individual file sub-array shape a multiple of
66
+ the `chunk shape <https://support.hdfgroup.org/HDF5/doc1.8/Advanced/Chunking/index.html>`_.
67
+ Similarly, `out of core <https://en.wikipedia.org/wiki/Out-of-core_algorithm>`_
68
+ algorithms for large dense arrays often involve processing the entire data-set as
69
+ a series of *in-core* sub-arrays. Again, it is desirable for the individual sub-array shape
70
+ to be a multiple of the
71
+ `chunk shape <https://support.hdfgroup.org/HDF5/doc1.8/Advanced/Chunking/index.html>`_.
72
+
73
+
74
+ The `array_split <http://array-split.readthedocs.io/en/latest>`_ package provides the
75
+ means to partition an array (or array shape) using any of the following criteria:
76
+
77
+ - Per-axis indices indicating the *cut* positions.
78
+ - Per-axis number of sub-arrays.
79
+ - Total number of sub-arrays (with optional per-axis *number of sections* constraints).
80
+ - Specific sub-array shape.
81
+ - Specification of *halo* (*ghost*) elements for sub-arrays.
82
+ - Arbitrary *start index* for the shape to be partitioned.
83
+ - Maximum number of bytes for a sub-array with constraints:
84
+
85
+ - sub-arrays are an even multiple of a specified sub-tile shape
86
+ - upper limit on the per-axis sub-array shape
87
+
88
+
89
+ Quick Start Example
90
+ ===================
91
+
92
+
93
+ >>> from array_split import array_split, shape_split
94
+ >>> import numpy as np
95
+ >>>
96
+ >>> ary = np.arange(0, 4*9)
97
+ >>>
98
+ >>> array_split(ary, 4) # 1D split into 4 sections (like numpy.array_split)
99
+ [array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
100
+ array([ 9, 10, 11, 12, 13, 14, 15, 16, 17]),
101
+ array([18, 19, 20, 21, 22, 23, 24, 25, 26]),
102
+ array([27, 28, 29, 30, 31, 32, 33, 34, 35])]
103
+ >>>
104
+ >>> shape_split(ary.shape, 4) # 1D split into 4 parts, returns slice objects
105
+ array([(slice(0, 9, None),), (slice(9, 18, None),), (slice(18, 27, None),), (slice(27, 36, None),)],
106
+ dtype=[('0', 'O')])
107
+ >>>
108
+ >>> ary = ary.reshape(4, 9) # Make ary 2D
109
+ >>> split = shape_split(ary.shape, axis=(2, 3)) # 2D split into 2*3=6 sections
110
+ >>> split.shape
111
+ (2, 3)
112
+ >>> split
113
+ array([[(slice(0, 2, None), slice(0, 3, None)),
114
+ (slice(0, 2, None), slice(3, 6, None)),
115
+ (slice(0, 2, None), slice(6, 9, None))],
116
+ [(slice(2, 4, None), slice(0, 3, None)),
117
+ (slice(2, 4, None), slice(3, 6, None)),
118
+ (slice(2, 4, None), slice(6, 9, None))]],
119
+ dtype=[('0', 'O'), ('1', 'O')])
120
+ >>> sub_arys = [ary[tup] for tup in split.flatten()] # Create sub-array views from slice tuples.
121
+ >>> sub_arys
122
+ [array([[ 0, 1, 2], [ 9, 10, 11]]),
123
+ array([[ 3, 4, 5], [12, 13, 14]]),
124
+ array([[ 6, 7, 8], [15, 16, 17]]),
125
+ array([[18, 19, 20], [27, 28, 29]]),
126
+ array([[21, 22, 23], [30, 31, 32]]),
127
+ array([[24, 25, 26], [33, 34, 35]])]
128
+
129
+
130
+ Latest sphinx documentation (including more examples)
131
+ at http://array-split.readthedocs.io/en/latest/.
132
+
133
+ .. end long description.
134
+
135
+ Installation
136
+ ============
137
+
138
+ Using ``pip`` (root access required):
139
+
140
+ ``pip install array_split``
141
+
142
+ or local user install (no root access required):
143
+
144
+ ``pip install --user array_split``
145
+
146
+ or local user install from latest github source:
147
+
148
+ ``pip install --user git+git://github.com/array-split/array_split.git#egg=array_split``
149
+
150
+
151
+ Requirements
152
+ ============
153
+
154
+ Requires `numpy <http://docs.scipy.org/doc/numpy/>`_ version `>= 1.6`,
155
+ python-2 version `>= 2.6` or python-3 version `>= 3.2`.
156
+
157
+ Testing
158
+ =======
159
+
160
+ Run tests (unit-tests and doctest module docstring tests) using::
161
+
162
+ python -m array_split.tests
163
+
164
+ or, from the source tree, run::
165
+
166
+ python setup.py test
167
+
168
+
169
+ Travis CI at:
170
+
171
+ https://travis-ci.org/array-split/array_split/
172
+
173
+ and AppVeyor at:
174
+
175
+ https://ci.appveyor.com/project/array-split/array-split
176
+
177
+ Documentation
178
+ =============
179
+
180
+ Latest sphinx generated documentation is at:
181
+
182
+ http://array-split.readthedocs.io/en/latest
183
+
184
+ and at github *gh-pages*:
185
+
186
+ https://array-split.github.io/array_split/
187
+
188
+ Sphinx documentation can be built from the source::
189
+
190
+ python setup.py build_sphinx
191
+
192
+ with the HTML generated in ``docs/_build/html``.
193
+
194
+
195
+ Latest source code
196
+ ==================
197
+
198
+ Source at github:
199
+
200
+ https://github.com/array-split/array_split
201
+
202
+
203
+ Bug Reports
204
+ ===========
205
+
206
+ To search for bugs or report them, please use the bug tracker at:
207
+
208
+ https://github.com/array-split/array_split/issues
209
+
210
+
211
+ Contributing
212
+ ============
213
+
214
+ Check out the `CONTRIBUTING doc <https://github.com/array-split/array_split/blob/dev/CONTRIBUTING.rst>`_.
215
+
216
+
217
+ License information
218
+ ===================
219
+
220
+ See the file `LICENSE.txt <https://github.com/array-split/array_split/blob/dev/LICENSE.txt>`_
221
+ for terms & conditions, for usage and a DISCLAIMER OF ALL WARRANTIES.
@@ -0,0 +1,81 @@
1
+ """
2
+ ==============================
3
+ The :mod:`array_split` Package
4
+ ==============================
5
+
6
+ .. currentmodule:: array_split
7
+
8
+ Python package for splitting a :obj:`numpy.ndarray` (or just an array shape)
9
+ into a number of sub-arrays.
10
+
11
+ The two main functions are:
12
+
13
+ :func:`array_split.array_split`
14
+ Similar to :func:`numpy.array_split`, returns a list of
15
+ sub-array *views* of the input :obj:`numpy.ndarray`.
16
+ Can split along multiple axes and has more splitting
17
+ criteria (parameters) than :func:`numpy.array_split`.
18
+
19
+ :func:`array_split.shape_split`
20
+ Instead taking an :obj:`numpy.ndarray` as an argument, it
21
+ takes the array *shape* and returns tuples of :obj:`slice`
22
+ objects which indicate the extents of the sub-arrays.
23
+
24
+ These two functions use an instance of the :obj:`array_split.ShapeSplitter` class
25
+ which contains the bulk of the *split* implementation.
26
+ Instances of :obj:`array_split.ShapeSplitter` also
27
+ maintain state related to the computed split.
28
+
29
+ Splitting of multi-dimensional arrays can be performed according to several criteria:
30
+
31
+ * Per-axis indices indicating the *cut* positions.
32
+ * Per-axis number of sub-arrays.
33
+ * Total number of sub-arrays (with optional per-axis *number of sections* constraints).
34
+ * Specific sub-array shape.
35
+ * Specification of *halo* (*ghost*) elements for sub-arrays.
36
+ * Arbitrary *start index* for the shape to be partitioned.
37
+ * Maximum number of bytes for a sub-array with constraints:
38
+
39
+ - sub-arrays are an even multiple of a specified sub-tile shape
40
+ - upper limit on the per-axis sub-array shape
41
+
42
+ The usage documentation is given in the :ref:`array_split-examples` section.
43
+
44
+
45
+ Classes and Functions
46
+ =====================
47
+
48
+ .. autosummary::
49
+ :toctree: generated/
50
+
51
+ shape_split - Splits a shape and returns :obj:`numpy.ndarray` of :obj:`slice` elements.
52
+ array_split - Equivalent to :func:`numpy.array_split`.
53
+ ShapeSplitter - Array shape splitting class.
54
+
55
+ Attributes
56
+ ==========
57
+
58
+ .. autodata:: ARRAY_BOUNDS
59
+ .. autodata:: NO_BOUNDS
60
+
61
+
62
+ """
63
+ from __future__ import absolute_import
64
+ from .license import license as _license, copyright as _copyright
65
+ from . import split # noqa: E402,F401
66
+ from .split import array_split, shape_split, ShapeSplitter # noqa: E402,F401
67
+ from . import _version
68
+
69
+ __author__ = "Shane J. Latham"
70
+ __license__ = _license()
71
+ __copyright__ = _copyright()
72
+ __version__ = _version.get_versions()['version']
73
+
74
+
75
+ #: See :data:`array_split.split.ARRAY_BOUNDS`
76
+ ARRAY_BOUNDS = split.ARRAY_BOUNDS
77
+
78
+ #: See :data:`array_split.split.NO_BOUNDS`
79
+ NO_BOUNDS = split.NO_BOUNDS
80
+
81
+ __all__ = [s for s in dir() if not s.startswith('_')]
@@ -0,0 +1,21 @@
1
+
2
+ # This file was generated by 'versioneer.py' (0.29) from
3
+ # revision-control system data, or from the parent directory name of an
4
+ # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
+ # of this file.
6
+
7
+ import json
8
+
9
+ version_json = '''
10
+ {
11
+ "date": "2024-08-04T15:39:52+1000",
12
+ "dirty": false,
13
+ "error": null,
14
+ "full-revisionid": "3659496c71206fc8903747fd8852f48826c2a337",
15
+ "version": "0.6.5"
16
+ }
17
+ ''' # END VERSION_JSON
18
+
19
+
20
+ def get_versions():
21
+ return json.loads(version_json)
@@ -0,0 +1 @@
1
+ Copyright (C) 2017 The Australian National University.
@@ -0,0 +1,83 @@
1
+ """
2
+ To be replaced.
3
+ """
4
+ # pylint: disable=redefined-builtin
5
+ from __future__ import absolute_import
6
+ import pkg_resources as _pkg_resources
7
+ from . import _version
8
+
9
+ __copyright__ = _pkg_resources.resource_string("array_split", "copyright.txt").decode()
10
+ __license__ = (
11
+ __copyright__
12
+ +
13
+ "\n\n"
14
+ +
15
+ _pkg_resources.resource_string("array_split", "license.txt").decode()
16
+ )
17
+ __author__ = "Shane J. Latham"
18
+ __version__ = _version.get_versions()['version']
19
+
20
+
21
+ def version():
22
+ """
23
+ Returns :mod:`array_split` version string.
24
+
25
+ :rtype: :obj:`str`
26
+ :return: Version string.
27
+ """
28
+ return __version__
29
+
30
+
31
+ def license():
32
+ """
33
+ Returns the :mod:`array_split` license string.
34
+
35
+ :rtype: :obj:`str`
36
+ :return: License string.
37
+ """
38
+ return __license__
39
+
40
+
41
+ def copyright():
42
+ """
43
+ Returns the :mod:`array_split` copyright string.
44
+
45
+ :rtype: :obj:`str`
46
+ :return: Copyright string.
47
+ """
48
+ return __copyright__
49
+
50
+
51
+ __doc__ = \
52
+ """
53
+ =====================================
54
+ The :mod:`array_split.license` Module
55
+ =====================================
56
+
57
+ License and copyright info.
58
+
59
+ .. currentmodule:: array_split.license
60
+
61
+ License
62
+ =======
63
+
64
+ %s
65
+
66
+ Copyright
67
+ =========
68
+
69
+ %s
70
+
71
+ Functions
72
+ =========
73
+
74
+ .. autosummary::
75
+ :toctree: generated/
76
+
77
+ license - Returns :mod:`array_split` license string.
78
+ copyright - Returns :mod:`array_split` copyright string.
79
+ version - Returns :mod:`array_split` version string.
80
+
81
+ """ % (license(), copyright())
82
+
83
+ __all__ = [s for s in dir() if not s.startswith('_')]