I found a very similar question to mine, but not quite the same. This: here
However, in ntimes case, the size of the array corresponds to the number of sizes that the tuple points to. In my case, I have a 4-dimensional array and a two-dimensional tuple, like this:
from numpy.random import rand
big_array=rand(3,3,4,5)
tup=(2,2)
I want to use a tuple as an index for the first two dimensions and manually index the last two. Sort of:
big_array[tup,3,2]
However, I get a repetition of the first dimension with index = 2 in the fourth dimension (since it was not technically indexed). This is because this indexing interprets double indexing for the first dimension instead of one value for each dimension,
eg.
| dim 0:(index 2 AND index 2) , dim 1:(index 3), dim 2:(index 2), dim 3:(no index)|
instead of
|dim 0(index 2), dim 1(index 2), dim 2:(index 3), dim 3:(index 2)|.
How can I "unzip" this tuple? Any ideas? thank!