Let's say I have two vectors of size n containing coordinates (point1 and point2), and some large Numpy array with n dimensions (len(array.shape) == 3).
Now, all values of point1 are smaller than point2 and I want to extract the subarray contained between point1 and point2. If I knew the number of dimensions n beforehand (e.g. n=3), I would access it like this:
array[point1[0]:point2[0], point1[1]:point2[1], point1[2]:point2[2]]
I was wondering if there was a clean pythonic way to do this in Numpy that would work for any number of dimensions?
Thanks!