larray.Array.ipoints

Array.ipoints

Allows selection of arbitrary items in the array based on their N-dimensional index.

Examples

>>> arr = ndtest((2, 3, 4))
>>> arr
 a  b\c  c0  c1  c2  c3
a0   b0   0   1   2   3
a0   b1   4   5   6   7
a0   b2   8   9  10  11
a1   b0  12  13  14  15
a1   b1  16  17  18  19
a1   b2  20  21  22  23

To select the two points with index coordinates [0, 0, 0] and [1, 2, 2], you must do:

>>> arr.ipoints[[0, 1], [0, 2], [0, 2]]
a_b_c  a0_b0_c0  a1_b2_c2
              0        22

The number of index(es) on each dimension must be equal:

>>> arr.ipoints[[0, 1], [0, 2], [0, 1, 2]]  
Traceback (most recent call last):
    ...
ValueError: all combined keys should have the same length
>>> arr.ipoints[[0, 1], [0, 2]]
a_b\c  c0  c1  c2  c3
a0_b0   0   1   2   3
a1_b2  20  21  22  23