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

newaxis #120

Closed bjlittle closed 9 years ago

bjlittle commented 9 years ago

@rhattersley Is it the hope that #116 will resolve:

>>> c = biggus.ConstantArray((2, 3, 4, 5))
>>> t = biggus.TransposedArray(c, (3, 1, 0, 2))
>>> print t
TransposedArray(<ConstantArray shape=(2, 3, 4, 5) dtype=dtype('float64')>, [3, 1, 0, 2])
>>> t[:2, 0, :, np.newaxis, :]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/h05/itwl/projects/git/biggus/biggus/__init__.py", line 1029, in __getitem__
    new_arr = self.pre_transposed[tuple(remapped_keys)]
  File "/home/h05/itwl/projects/git/biggus/biggus/__init__.py", line 587, in __getitem__
    keys = self._normalise_keys(keys)
  File "/home/h05/itwl/projects/git/biggus/biggus/__init__.py", line 537, in _normalise_keys
    raise IndexError('too many keys')
IndexError: too many keys
rhattersley commented 9 years ago

Yes. I've rebased the branch for #116 and I don't get that error any more.

pelson commented 9 years ago

With master:

>>> t[:2, 0, :, np.newaxis, :]
TransposedArray(<ConstantArray shape=(2, 4, 2, 1) dtype=dtype('float64')>, [2, 0, 3, 1])