I have this bit of code
def build_tree_base(blocks, x, y, z):
indicies = [
(x ,z ,y ),
(x ,z+1,y ),
(x ,z ,y+1),
(x ,z+1,y+1),
(x+1,z ,y ),
(x+1,z+1,y ),
(x+1,z ,y+1),
(x+1,z+1,y+1),
]
children = [blocks[i] for i in indicies]
return Node(children=children)
Where blocks is a 3 dimensional numpy array.
What I'd like to do is replace the list comprehension with something like numpy.take, however take seems to only deal with single dimension indices. Is there something like take that will work with multidimensional indices?
Also I know you could do this with a transpose, slice and then reshape, but that was slow so I'm looking for a better option.