NumPy arrays may be indexed with other arrays. To illustrate:
>>> import numpy as np
>>> arr = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0et ], 'f4')
>>> ids = np.array([0, 2], 'i4')
arr[ids]
array([ 0., 2.], dtype=float32)
But what if I wanted to have a multiarray with the value pointed by the index plus the three subsequents elements?
>>> arr[ids:(ids+4)]
Traceback (most recent call last):
File "<console>", line 1, in <module>
IndexError: invalid slice
Expected:
array([[0. 1. 2. 3.], [2. 3. 4. 5.]], dtype=float32)
How to make this possible?