array-split 0.5.2__tar.gz → 0.6.4__tar.gz

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.
Files changed (52) hide show
  1. array_split-0.6.4/PKG-INFO +255 -0
  2. {array_split-0.5.2 → array_split-0.6.4}/README.rst +7 -6
  3. {array_split-0.5.2 → array_split-0.6.4}/array_split/__init__.py +3 -2
  4. array_split-0.6.4/array_split/_version.py +21 -0
  5. {array_split-0.5.2 → array_split-0.6.4}/array_split/license.py +2 -1
  6. {array_split-0.5.2 → array_split-0.6.4}/array_split/logging.py +2 -2
  7. {array_split-0.5.2 → array_split-0.6.4}/array_split/split.py +29 -26
  8. array_split-0.6.4/array_split/split_plot.py +43 -0
  9. {array_split-0.5.2 → array_split-0.6.4}/array_split/split_test.py +2 -2
  10. {array_split-0.5.2 → array_split-0.6.4}/array_split/tests.py +2 -0
  11. array_split-0.6.4/array_split.egg-info/PKG-INFO +255 -0
  12. array_split-0.6.4/array_split.egg-info/SOURCES.txt +22 -0
  13. array_split-0.6.4/array_split.egg-info/not-zip-safe +1 -0
  14. array_split-0.6.4/pyproject.toml +48 -0
  15. {array_split-0.5.2 → array_split-0.6.4}/setup.cfg +1 -1
  16. array_split-0.6.4/setup.py +14 -0
  17. array_split-0.5.2/.appveyor.yml +0 -54
  18. array_split-0.5.2/.gitignore +0 -8
  19. array_split-0.5.2/.pylintrc +0 -425
  20. array_split-0.5.2/.travis.yml +0 -59
  21. array_split-0.5.2/CONTRIBUTING.rst +0 -84
  22. array_split-0.5.2/PKG-INFO +0 -147
  23. array_split-0.5.2/array_split/git_describe.txt +0 -1
  24. array_split-0.5.2/array_split/version.txt +0 -1
  25. array_split-0.5.2/array_split.egg-info/PKG-INFO +0 -147
  26. array_split-0.5.2/array_split.egg-info/SOURCES.txt +0 -43
  27. array_split-0.5.2/docs/joss/codemeta.json +0 -23
  28. array_split-0.5.2/docs/joss/paper.bib +0 -82
  29. array_split-0.5.2/docs/joss/paper.md +0 -51
  30. array_split-0.5.2/docs/source/_templates/autosummary/class.rst +0 -32
  31. array_split-0.5.2/docs/source/_templates/autosummary/inherits_TestCase_class.rst +0 -32
  32. array_split-0.5.2/docs/source/about/index.rst +0 -7
  33. array_split-0.5.2/docs/source/conf.py +0 -422
  34. array_split-0.5.2/docs/source/contributing/index.rst +0 -4
  35. array_split-0.5.2/docs/source/examples/index.rst +0 -622
  36. array_split-0.5.2/docs/source/index.rst +0 -39
  37. array_split-0.5.2/docs/source/reference/array_split.rst +0 -1
  38. array_split-0.5.2/docs/source/reference/array_split_license.rst +0 -1
  39. array_split-0.5.2/docs/source/reference/array_split_logging.rst +0 -1
  40. array_split-0.5.2/docs/source/reference/array_split_split.rst +0 -1
  41. array_split-0.5.2/docs/source/reference/array_split_split_test.rst +0 -1
  42. array_split-0.5.2/docs/source/reference/array_split_tests.rst +0 -1
  43. array_split-0.5.2/docs/source/reference/array_split_unittest.rst +0 -1
  44. array_split-0.5.2/docs/source/reference/index.rst +0 -13
  45. array_split-0.5.2/setup.py +0 -166
  46. {array_split-0.5.2 → array_split-0.6.4}/LICENSE.txt +0 -0
  47. {array_split-0.5.2 → array_split-0.6.4}/array_split/copyright.txt +0 -0
  48. {array_split-0.5.2 → array_split-0.6.4}/array_split/license.txt +0 -0
  49. {array_split-0.5.2 → array_split-0.6.4}/array_split/unittest.py +0 -0
  50. {array_split-0.5.2 → array_split-0.6.4}/array_split.egg-info/dependency_links.txt +0 -0
  51. {array_split-0.5.2 → array_split-0.6.4}/array_split.egg-info/requires.txt +0 -0
  52. {array_split-0.5.2 → array_split-0.6.4}/array_split.egg-info/top_level.txt +0 -0
@@ -0,0 +1,255 @@
1
+ Metadata-Version: 2.1
2
+ Name: array_split
3
+ Version: 0.6.4
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.
@@ -10,12 +10,9 @@
10
10
  .. image:: https://img.shields.io/pypi/v/array_split.svg
11
11
  :target: https://pypi.python.org/pypi/array_split/
12
12
  :alt: array_split python package
13
- .. image:: https://travis-ci.org/array-split/array_split.svg?branch=dev
14
- :target: https://travis-ci.org/array-split/array_split
15
- :alt: TravisCI Status
16
- .. image:: https://ci.appveyor.com/api/projects/status/oprsw5rfr07m77o0?svg=true
17
- :target: https://ci.appveyor.com/project/array-split/array-split
18
- :alt: AppVeyor Status
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
19
16
  .. image:: https://readthedocs.org/projects/array-split/badge/?version=stable
20
17
  :target: http://array-split.readthedocs.io/en/stable
21
18
  :alt: Documentation Status
@@ -28,6 +25,10 @@
28
25
  .. image:: https://img.shields.io/pypi/pyversions/array_split.svg
29
26
  :target: https://pypi.python.org/pypi/array_split/
30
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
31
32
 
32
33
  .. end badges.
33
34
 
@@ -61,14 +61,15 @@ Attributes
61
61
 
62
62
  """
63
63
  from __future__ import absolute_import
64
- from .license import license as _license, copyright as _copyright, version as _version
64
+ from .license import license as _license, copyright as _copyright
65
65
  from . import split # noqa: E402,F401
66
66
  from .split import array_split, shape_split, ShapeSplitter # noqa: E402,F401
67
+ from . import _version
67
68
 
68
69
  __author__ = "Shane J. Latham"
69
70
  __license__ = _license()
70
71
  __copyright__ = _copyright()
71
- __version__ = _version()
72
+ __version__ = _version.get_versions()['version']
72
73
 
73
74
 
74
75
  #: See :data:`array_split.split.ARRAY_BOUNDS`
@@ -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:27:48+1000",
12
+ "dirty": false,
13
+ "error": null,
14
+ "full-revisionid": "a5b1cb7c6fbd1db5829249f13a00b42267ac865e",
15
+ "version": "0.6.4"
16
+ }
17
+ ''' # END VERSION_JSON
18
+
19
+
20
+ def get_versions():
21
+ return json.loads(version_json)
@@ -4,6 +4,7 @@ To be replaced.
4
4
  # pylint: disable=redefined-builtin
5
5
  from __future__ import absolute_import
6
6
  import pkg_resources as _pkg_resources
7
+ from . import _version
7
8
 
8
9
  __copyright__ = _pkg_resources.resource_string("array_split", "copyright.txt").decode()
9
10
  __license__ = (
@@ -14,7 +15,7 @@ __license__ = (
14
15
  _pkg_resources.resource_string("array_split", "license.txt").decode()
15
16
  )
16
17
  __author__ = "Shane J. Latham"
17
- __version__ = _pkg_resources.resource_string("array_split", "version.txt").decode().strip()
18
+ __version__ = _version.get_versions()['version']
18
19
 
19
20
 
20
21
  def version():
@@ -94,7 +94,7 @@ class _Python2SplitStreamHandler(_builtin_logging.Handler):
94
94
  stream.flush()
95
95
  except (KeyboardInterrupt, SystemExit):
96
96
  raise
97
- except:
97
+ except Exception:
98
98
  self.handleError(record)
99
99
 
100
100
 
@@ -162,7 +162,7 @@ class _Python3SplitStreamHandler(_builtin_logging.Handler):
162
162
  self.flush()
163
163
  except (KeyboardInterrupt, SystemExit): # pragma: no cover
164
164
  raise
165
- except:
165
+ except Exception:
166
166
  self.handleError(record)
167
167
 
168
168
 
@@ -179,7 +179,7 @@ def pad_with_none(sequence, new_length):
179
179
  def shape_factors(n, dim=2):
180
180
  """
181
181
  Returns a :obj:`numpy.ndarray` of factors :samp:`f` such
182
- that :samp:`(len(f) == {dim}) and (numpy.product(f) == {n})`.
182
+ that :samp:`(len(f) == {dim}) and (numpy.prod(f) == {n})`.
183
183
  The returned factors are as *square* (*cubic*, etc) as possible.
184
184
  For example::
185
185
 
@@ -225,7 +225,7 @@ def calculate_tile_shape_for_max_bytes(
225
225
  ):
226
226
  """
227
227
  Returns a tile shape :samp:`tile_shape`
228
- such that :samp:`numpy.product(tile_shape)*numpy.sum({array_itemsize}) <= {max_tile_bytes}`.
228
+ such that :samp:`numpy.prod(tile_shape)*numpy.sum({array_itemsize}) <= {max_tile_bytes}`.
229
229
  Also, if :samp:`{max_tile_shape} is not None`
230
230
  then :samp:`numpy.all(tile_shape <= {max_tile_shape}) is True` and
231
231
  if :samp:`{sub_tile_shape} is not None`
@@ -340,7 +340,7 @@ def calculate_tile_shape_for_max_bytes(
340
340
  and
341
341
  (
342
342
  (
343
- _np.product(tile_sub_tile_split_shape * sub_tile_shape + _np.sum(halo, axis=1))
343
+ _np.prod(tile_sub_tile_split_shape * sub_tile_shape + _np.sum(halo, axis=1))
344
344
  *
345
345
  array_itemsize
346
346
  )
@@ -355,7 +355,7 @@ def calculate_tile_shape_for_max_bytes(
355
355
  max_tile_bytes
356
356
  //
357
357
  (
358
- _np.product(
358
+ _np.prod(
359
359
  tile_sub_tile_split_shape *
360
360
  sub_tile_shape +
361
361
  _np.sum(
@@ -375,10 +375,10 @@ def calculate_tile_shape_for_max_bytes(
375
375
  (
376
376
  (max_tile_bytes / float(array_itemsize))
377
377
  -
378
- _np.sum(halo[current_axis]) * _np.product(sub_tile_shape_h[0:current_axis])
378
+ _np.sum(halo[current_axis]) * _np.prod(sub_tile_shape_h[0:current_axis])
379
379
  )
380
380
  /
381
- float(_np.product(sub_tile_shape_h))
381
+ float(_np.prod(sub_tile_shape_h))
382
382
  ))
383
383
  current_axis += 1
384
384
 
@@ -399,7 +399,7 @@ def calculate_num_slices_per_axis(num_slices_per_axis, num_slices, max_slices_pe
399
399
  """
400
400
  Returns a :obj:`numpy.ndarray` (:samp:`return_array` say) where non-positive elements of
401
401
  the :samp:`{num_slices_per_axis}` sequence have been replaced with
402
- positive integer values such that :samp:`numpy.product(return_array) == num_slices`
402
+ positive integer values such that :samp:`numpy.prod(return_array) == num_slices`
403
403
  and::
404
404
 
405
405
  numpy.all(
@@ -417,13 +417,13 @@ def calculate_num_slices_per_axis(num_slices_per_axis, num_slices, max_slices_pe
417
417
  :type num_slices: integer
418
418
  :param num_slices: Indicates the number of slices (rectangular sub-arrays)
419
419
  formed by performing sub-divisions per axis. The returned array :samp:`return_array`
420
- has elements assigned such that :samp:`numpy.product(return_array) == {num_slices}`.
420
+ has elements assigned such that :samp:`numpy.prod(return_array) == {num_slices}`.
421
421
  :type max_slices_per_axis: sequence of :obj:`int` (or :samp:`None`)
422
422
  :param max_slices_per_axis: Constraint specifying maximum number of per-axis sub-divisions.
423
423
  If :samp:`None` defaults to :samp:`numpy.array([numpy.inf,]*len({num_slices_per_axis}))`.
424
424
  :rtype: :obj:`numpy.ndarray`
425
425
  :return: An array :samp:`return_array`
426
- such that :samp:`numpy.product(return_array) == num_slices`.
426
+ such that :samp:`numpy.prod(return_array) == num_slices`.
427
427
 
428
428
 
429
429
  Examples::
@@ -451,7 +451,7 @@ def calculate_num_slices_per_axis(num_slices_per_axis, num_slices, max_slices_pe
451
451
  raise ValueError("Got non-positive value in max_slices_per_axis=%s" % max_slices_per_axis)
452
452
 
453
453
  while _np.any(ret_array <= 0):
454
- prd = _np.product(ret_array[_np.where(ret_array > 0)]) # returns 1 for zero-length array
454
+ prd = _np.prod(ret_array[_np.where(ret_array > 0)]) # returns 1 for zero-length array
455
455
  if (num_slices < prd) or ((num_slices % prd) > 0):
456
456
  raise ValueError(
457
457
  (
@@ -470,10 +470,10 @@ def calculate_num_slices_per_axis(num_slices_per_axis, num_slices, max_slices_pe
470
470
  for i in range(ridx[0].shape[0]):
471
471
  if f[i] >= max_slices_per_axis[ridx[0][i]]:
472
472
  ret_array[ridx[0][i]] = max_slices_per_axis[ridx[0][i]]
473
- prd = _np.product(ret_array[_np.where(ret_array > 0)])
473
+ prd = _np.prod(ret_array[_np.where(ret_array > 0)])
474
474
  while (num_slices % prd) > 0:
475
475
  ret_array[ridx[0][i]] -= 1
476
- prd = _np.product(ret_array[_np.where(ret_array > 0)])
476
+ prd = _np.prod(ret_array[_np.where(ret_array > 0)])
477
477
  logger.debug(
478
478
  "ridx=%s, f=%s, ret_array=%s, max_slices_per_axis=%s",
479
479
  ridx, f, ret_array, max_slices_per_axis
@@ -670,7 +670,7 @@ class ShapeSplitter(object):
670
670
  >>> split
671
671
  array([(slice(0, 4, None),), (slice(4, 7, None),), (slice(7, 10, None),)],
672
672
  dtype=[('0', 'O')])
673
- >>> [ary[slyce] for slyce in split.flatten()]
673
+ >>> [ary[slyce] for slyce in split.flatten().tolist()]
674
674
  [array([0, 1, 2, 3]), array([4, 5, 6]), array([7, 8, 9])]
675
675
  >>>
676
676
  >>> splitter.split_shape # equivalent to split.shape above
@@ -1229,20 +1229,20 @@ class ShapeSplitter(object):
1229
1229
  tuple(
1230
1230
  [
1231
1231
  slice(
1232
- max([
1232
+ int(max([
1233
1233
  self.split_begs[d][idx[d]]
1234
1234
  + self.array_start[d]
1235
1235
  - self.halo[d, 0]
1236
1236
  * (self.split_ends[d][idx[d]] > self.split_begs[d][idx[d]]),
1237
1237
  self.tile_beg_min[d]
1238
- ]),
1239
- min([
1238
+ ])),
1239
+ int(min([
1240
1240
  self.split_ends[d][idx[d]]
1241
1241
  + self.array_start[d]
1242
1242
  + self.halo[d, 1]
1243
1243
  * (self.split_ends[d][idx[d]] > self.split_begs[d][idx[d]]),
1244
1244
  self.tile_end_max[d]
1245
- ])
1245
+ ]))
1246
1246
  )
1247
1247
  for d in range(len(self.split_shape))
1248
1248
  ]
@@ -1250,8 +1250,8 @@ class ShapeSplitter(object):
1250
1250
  for idx in
1251
1251
  _np.array(
1252
1252
  _np.unravel_index(
1253
- _np.arange(0, _np.product(self.split_shape)),
1254
- self.split_shape
1253
+ _np.arange(0, _np.prod(self.split_shape)),
1254
+ self.split_shape if self.split_shape is not None else tuple()
1255
1255
  )
1256
1256
  ).T
1257
1257
  ],
@@ -1302,8 +1302,8 @@ class ShapeSplitter(object):
1302
1302
  for idx in
1303
1303
  _np.array(
1304
1304
  _np.unravel_index(
1305
- _np.arange(0, _np.product(self.split_shape)),
1306
- self.split_shape
1305
+ _np.arange(0, _np.prod(self.split_shape)),
1306
+ self.split_shape if self.split_shape is not None else tuple()
1307
1307
  )
1308
1308
  ).T
1309
1309
  ],
@@ -1373,7 +1373,7 @@ class ShapeSplitter(object):
1373
1373
  and
1374
1374
  _np.all([s > 0 for s in self.split_num_slices_per_axis])
1375
1375
  ):
1376
- self.split_size = _np.product(self.split_num_slices_per_axis)
1376
+ self.split_size = _np.prod(self.split_num_slices_per_axis)
1377
1377
  else:
1378
1378
  raise ValueError(
1379
1379
  (
@@ -1517,7 +1517,10 @@ class ShapeSplitter(object):
1517
1517
  """
1518
1518
 
1519
1519
  self.set_split_extents()
1520
- return self.calculate_split_from_extents()
1520
+ slyces = self.calculate_split_from_extents()
1521
+ self.logger.debug("type(slyces)=%s", type(slyces))
1522
+ self.logger.debug("slyces=%s", slyces)
1523
+ return slyces
1521
1524
 
1522
1525
 
1523
1526
  ShapeSplitter([0, ]).__init__.__func__.__doc__ = \
@@ -1596,7 +1599,7 @@ def array_split(
1596
1599
  halo=None
1597
1600
  ):
1598
1601
  "To be replaced."
1599
- return [
1602
+ return list(
1600
1603
  ary[slyce]
1601
1604
  for slyce in
1602
1605
  shape_split(
@@ -1611,8 +1614,8 @@ def array_split(
1611
1614
  sub_tile_shape=sub_tile_shape,
1612
1615
  halo=halo,
1613
1616
  tile_bounds_policy=ARRAY_BOUNDS
1614
- ).flatten()
1615
- ]
1617
+ ).flatten().tolist()
1618
+ )
1616
1619
 
1617
1620
 
1618
1621
  array_split.__doc__ =\
@@ -0,0 +1,43 @@
1
+ """
2
+ ========================================
3
+ The :mod:`array_split.split_plot` Module
4
+ ========================================
5
+
6
+ Uses :mod:`matplotlib` to plot a split.
7
+
8
+ Classes and Functions
9
+ =====================
10
+
11
+ .. autosummary::
12
+ :toctree: generated/
13
+
14
+ SplitPlotter - Plots a split.
15
+ plot - Plots split shapes.
16
+
17
+ """
18
+
19
+ from __future__ import absolute_import
20
+
21
+ from .license import license as _license, copyright as _copyright, version as _version
22
+
23
+ __author__ = "Shane J. Latham"
24
+ __license__ = _license()
25
+ __copyright__ = _copyright()
26
+ __version__ = _version()
27
+
28
+
29
+ class SplitPlotter(object):
30
+ """
31
+ Plots a split.
32
+ """
33
+
34
+ def __init__(self):
35
+ """
36
+ """
37
+ pass
38
+
39
+
40
+ def plot(split):
41
+ """
42
+ Plots a split.
43
+ """
@@ -1455,7 +1455,7 @@ class SplitTest(_unittest.TestCase):
1455
1455
  splt = splitter.calculate_split()
1456
1456
  splt_halos = splitter.calculate_split_halos_from_extents()
1457
1457
  self.assertSequenceEqual(splt.shape, splt_halos.shape)
1458
- self.assertTrue(_np.all(splt_halos.astype(_np.int64) == 0))
1458
+ self.assertTrue(_np.all(_np.asarray(splt_halos.tolist()) == 0))
1459
1459
 
1460
1460
  # Some tiles narrower than halo width
1461
1461
  splitter = ShapeSplitter((15, 13), axis=[3, 3], halo=5, tile_bounds_policy=ARRAY_BOUNDS)
@@ -1474,7 +1474,7 @@ class SplitTest(_unittest.TestCase):
1474
1474
  splt = splitter.calculate_split()
1475
1475
  splt_halos = splitter.calculate_split_halos_from_extents()
1476
1476
  self.assertSequenceEqual(splt.shape, splt_halos.shape)
1477
- self.assertTrue(_np.all(splt_halos.astype(_np.int64) == 0))
1477
+ self.assertTrue(_np.all(_np.asarray(splt_halos.tolist()) == 0))
1478
1478
 
1479
1479
  # Tiles narrower than halo width
1480
1480
  splitter = ShapeSplitter((5, 13), axis=[5, 3], halo=5, tile_bounds_policy=ARRAY_BOUNDS)
@@ -142,4 +142,6 @@ def load_tests(loader, tests, pattern): # pylint: disable=unused-argument
142
142
  __all__ = [s for s in dir() if not s.startswith('_')]
143
143
 
144
144
  if __name__ == "__main__":
145
+ # import logging
146
+ # logging.basicConfig(level=logging.DEBUG)
145
147
  _unittest.main()