pynbody.halo.details.iord_mapping.IordToOffsetSparse

pynbody.halo.details.iord_mapping.IordToOffsetSparse#

class pynbody.halo.details.iord_mapping.IordToOffsetSparse(iord_array)[source]#

Bases: IordToOffset

Class for efficiently mapping from iords to offsets in the iord array, even if iord values are large.

WARNING: if a query is made with iords that are not themselves in ascending order, a sort takes place ahead of the query and therefore the set returned is correct but the ordering is not preserved.

Methods

map_ignoring_order(iord_values)

Given an array of iord values, return the corresponding fpos values.

__init__(iord_array)[source]#
map_ignoring_order(iord_values: ndarray | int) ndarray | int[source]#

Given an array of iord values, return the corresponding fpos values.

Warning: The returned values are not guaranteed to be in the same order as the input iord array.