Suppose I have a Numpy array A that has a certain number of dimensions. For the rest of the question I will consider that A is a 4-dimensional array:
>>>A.shape
(2,2,2,2)
Sometimes, I would like to access the elements
A[:,:,1,:]
, but also sometimes I would like to access the elements
A[:,1,:,:]
, and so on (the position of the '1' in the '1'-colon indexing "chain" is a variable).
How can I do that?