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

Fix indexing of aggregations for which axis != 0. #95

Closed pp-mo closed 10 years ago

pp-mo commented 10 years ago

Aggregation.getitem was behaving always as if self._axis == 0 (a previous restriction). Problem case example:

>>> data = np.zeros((5,4,3))
>>> data = biggus.NumpyArrayAdapter(data)
>>> mean = biggus.mean(data, axis=1)
>>> print 'Mean:', mean
Mean: <_Aggregation shape=(5, 3) dtype=dtype('float64')>
>>> print 'Mean[0]:', mean[0]
Mean[0]: <_Aggregation shape=(5,) dtype=dtype('float64')>

-- shape should be (3,) instead of (5,)

It was also only tested for axis==0. Fixed that by just looping the existing test over all axes.

rhattersley commented 10 years ago

NB. The diff for the test looks a lot more obvious if you ignore whitespace. (Note the w=1 in the URL.)

rhattersley commented 10 years ago

Thanks @pp-mo! :smile: