compute_richness¶
- halotools.utils.compute_richness(unique_halo_ids, halo_id_of_galaxies)[source]¶
For every ID in unique_halo_ids, calculate the number of times the ID appears in halo_id_of_galaxies.
- Parameters:
- unique_halo_idsndarray
Numpy array of shape (num_halos, ) storing unique integers
- halo_id_of_galaxiesndarray
Numpy integer array of shape (num_galaxies, ) storing the host ID of each galaxy
- Returns:
- richnessndarray
Numpy integer array of shape (num_halos, ) storing richness of each host halo
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)