I am sorry if a similar question has been already posted in some way, but I could not find it anywhere so far. My problem is the following:
Suppose I have a 4D numpy matrix like this one
M= array([[[[0. , 0. , 0. ],
[0. , 0. , 0.01]],
[[0. , 0.01, 0. ],
[0. , 0.01, 0.01]]],
[[[0.01, 0. , 0. ],
[0.01, 0. , 0.01]],
[[0.01, 0.01, 0. ],
[0.01, 0.01, 0.01]]]])
Which can be seen as a 3D meshgrid, where each point in space is a triplet of values (rows / axis=3 of the matrix). I have another 2D np array, corresponding to a set of points (in this case 2):
Points= array([[0.01, 0.01, 0.], [0., 0., 0.]])
I would like to look into M and find the coordinates, or indices, corresponding to those points. Something like this
coordinates= array([[1,1,0], [0,0,0]])
Unfortunately I have to avoid for loops as much as possible. I am looking for an equivalent of numpy.where() for such cases.
Thanks!