pynbody.util.indexing_tricks.index_before_slice

pynbody.util.indexing_tricks.index_before_slice#

pynbody.util.indexing_tricks.index_before_slice(s, index)[source]#

Return an index array new_index such that ar[s][new_index] == ar[index].

Parameters:
  • s (slice) – The slice to apply to the array

  • index (array-like) – The index array to apply to the sliced array

Returns:

new_index – The index array that will pick out the same elements of the sliced array as index does of the original array

Return type:

array-like