compute_richness

halotools.utils.compute_richness(unique_halo_ids, halo_id_of_galaxies)[source] [edit on github]

For every ID in unique_halo_ids, calculate the number of times the ID appears in halo_id_of_galaxies.

Parameters:

unique_halo_ids : ndarray

Numpy array of shape (num_halos, ) storing unique integers

halo_id_of_galaxies : ndarray

Numpy integer array of shape (num_halos, ) storing the host ID of each galaxy

Returns:

richness : ndarray

Numpy integer array of shape (num_halos, ) storing halo richness

Examples

>>> num_hosts = 100
>>> num_sats = int(1e5)
>>> unique_halo_ids = np.arange(5, num_hosts + 5)
>>> halo_id_of_galaxies = np.random.randint(0, 5000, num_sats)
>>> richness = compute_richness(unique_halo_ids, halo_id_of_galaxies)