pynbody.util.indexing_tricks.concatenate_indexing

pynbody.util.indexing_tricks.concatenate_indexing#

pynbody.util.indexing_tricks.concatenate_indexing(i1, i2)[source]#

Given either a numpy array or slice for both i1 and i2, return an object such that ar[i3] == ar[i1][i2].

As a convenience, if i2 is None, i1 is returned.

Parameters:
  • i1 (array-like or slice) – The first indexing or slicing operation to apply

  • i2 (array-like or slice) – The second indexing or slicing operation to apply

Returns:

i3 – The combined indexing or slicing operation

Return type:

array-like or slice