0

I am attempting to index a stacked 3-D Numpy array (named stack) by a group of 2-D indices contained inside of a separate Numpy array (named piece). The separate array contains several groups of 2-D index pairs. Inspection of these indices at the first entry of the array is as follows:

[[0 1]
 [1 0]
 [0 0]
 [1 1]
 [2 0]
 [0 2]
 [2 1]
 [1 2]]

The dimensions of the stacked 3-D array are (1228, 2606, 14), which was created by stacking multiple 2-D arrays to ultimately inspect values along common index value pairs. I've tried indexing stack by piece in several methods, both of which have not produced the desired result:

  1. extraction = stack[tuple(piece), :]
  2. extraction = stack[piece, :]

Attempt #1 was derived from this question here. In both instances, the shape of extraction yields (8, 2, 2606, 14) as opposed to an array that contains 112 values across the 8 provided index pairs. Any insight as to where corrections can be made is appreciated!

TornadoEric
  • 399
  • 3
  • 16

0 Answers0