|
Returns |
|
------- |
|
slices : list of slice objects |
|
A slice along each dimension of `ar_shape`, such that the intersection |
|
of all the slices give the coordinates of regularly spaced points. |
Numpy decided to deprecacte multi-indexing with anything other than a tuple.
regular grid currently returns a list. It might be useful to keep up with numpy's API, and as such, we should return a tuple.
For example, just below in _regular_grid.py
|
grid = regular_grid(ar_shape, n_points) |
|
seed_img = np.zeros(ar_shape, dtype=dtype) |
|
seed_img[grid] = 1 + np.reshape(np.arange(seed_img[grid].size), |
|
seed_img[grid].shape) |
uses the output directly to index a numpy array.
Unfortunately, lists are not tuples, and this would cause a breaking change in the (internal) API.
How should we proceed with this?
Ideas I have:
- Check the numpy version, if greater than
1.15 then we can return a tuple.
- Return a list until numpy decides to change their implementation
- Return a tuple instead of a list.
I kinda like 3, but doesn't seem prudent.
Edit: it seems that this is actually an external facing API.
scikit-image/skimage/util/_regular_grid.py
Lines 21 to 25 in f21c52b
Numpy decided to deprecacte multi-indexing with anything other than a tuple.
regular grid currently returns a list. It might be useful to keep up with numpy's API, and as such, we should return a tuple.
For example, just below in
_regular_grid.pyscikit-image/skimage/util/_regular_grid.py
Lines 101 to 104 in f21c52b
uses the output directly to index a numpy array.
Unfortunately, lists are not tuples, and this would cause a breaking change in the
(internal)API.How should we proceed with this?
Ideas I have:
1.15then we can return a tuple.I kinda like 3, but doesn't seem prudent.
Edit: it seems that this is actually an external facing API.