a = np.random.randint(0, 10, (3, 4, 5))
axis = 1
idx = np.argmax(a, axis=axis)
print(a[index_at(idx, a.shape, axis=axis)])
print(np.max(a, axis=axis))
numpy 3d to 2d transformation based on 2d mask array