SciTools / biggus

:no_entry: [DEPRECATED] Virtual large arrays and lazy evaluation.
http://biggus.readthedocs.io/
GNU Lesser General Public License v3.0
54 stars 27 forks source link

Indexing a TransposedArray with multiple ellipsis #121

Closed bjlittle closed 9 years ago

bjlittle commented 9 years ago

Commit 5c01bc0c7fc5a89f8ccb33baeb6244e2729132d5

>>> a = np.empty((2, 3, 4, 5))
>>> t = biggus.TransposedArray(a, (3, 1, 0, 2))
>>> t.shape
(5, 3, 2, 4)
>>> b = np.empty(t.shape)
>>> b[:, ..., 0, ..., :].shape
(5, 2, 4)
>>> t[:, ..., 0, ..., :].shape
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/h05/itwl/projects/git/biggus/biggus/__init__.py", line 1013, in __getitem__
    keys = _full_keys(keys, self.ndim)
  File "/home/h05/itwl/projects/git/biggus/biggus/__init__.py", line 2315, in _full_keys
    raise IndexError('Dimensions are over specified for indexing.')
IndexError: Dimensions are over specified for indexing.
pelson commented 9 years ago

Looks like I missed the fact that the last Ellipsis can represent a null operation, not just slice(None) all of the time.

pelson commented 9 years ago

After #124:

>>> t[:, ..., 0, ..., :].shape
(5, 2, 4)