pynbody.halo.details.particle_indices.HaloParticleIndices#

class pynbody.halo.details.particle_indices.HaloParticleIndices(particle_ids: ndarray[tuple[Any, ...], dtype[int]] = None, boundaries: ndarray[Any, 2, int] = None)[source]#

Bases: object

Methods

get_halo_number_per_particle(sim_length, ...)

Return an array of halo numbers, one per particle.

get_particle_index_list_for_halo(halo_index)

Get the index list for the specified halo index

__init__(particle_ids: ndarray[tuple[Any, ...], dtype[int]] = None, boundaries: ndarray[Any, 2, int] = None)[source]#

An IndexList represents abstract information about halo membership

  • particle_ids: array of particle IDs (mutually exclusive with halo_number_per_particle), length Npart_in_halos

  • boundaries: a Nhalo x 2 array of start and stop indices for each halo in the particle_ids array

NB throughout this class halo indices (zero-based, continuous integer numbers) are used, NOT halo numbers. For accessing halos by halo number, one must additionally use the HaloNumberMapper class to get the index before passing it in here.

get_halo_number_per_particle(sim_length, number_mapper, fill_value=-1, dtype=<class 'int'>)[source]#

Return an array of halo numbers, one per particle.

Requires a HaloNumberMapper to map halo indices to halo numbers. If None is passed for the number_mapper, the halo indices are returned instead.

get_particle_index_list_for_halo(halo_index)[source]#

Get the index list for the specified halo index