pynbody.analysis.hmf.simulation_halo_mass_function

pynbody.analysis.hmf.simulation_halo_mass_function#

pynbody.analysis.hmf.simulation_halo_mass_function(snapshot_or_cat, log_M_min=8.0, log_M_max=15.0, delta_log_M=0.1, masses=None, mass_property=None, calculate_err=True, subsample_catalogue=None)[source]#

Estimate a halo mass function from a simulation, via binning haloes in mass.

Parameters:
  • snapshot_or_cat (SimSnap or HaloCatalogue) – The snapshot from which to calculate the halo mass function, or the halo catalogue itself. If a snapshot is provided, .halos() is called to get the first available catalogue.

  • log_M_min (float, optional) – The minimum halo mass (Msol h^-1) to consider. Default is 8.

  • log_M_max (float, optional) – The maximum halo mass (Msol h^-1) to consider. Default is 15.

  • delta_log_M (float, optional) – The bin spacing of halo masses. Default is 0.1.

  • masses (array, optional) – Provide an array of halo masses in Msol h^-1. If None, this is calculated from the snapshot.

  • mass_property (str, optional) – The property name giving the mass of each halo. If None, sums the mass in particles in each halo according to the particle data in the catalogue. Summing masses can be slow for large catalogues.

  • calculate_err (bool, optional) – If True, estimates error bars according to Poisson statistics.

  • subsample_catalogue (int, optional) – Subsample the halo catalogue by the specified factor. Not recommended except for debugging.

Returns:

  • bin_centers (SimArray) – The centre of the mass bins, in Msol h^-1.

  • num_den (SimArray) – The binned number density of haloes in this snapshot in comoving Mpc**-3 h**3 per decade of mass.

  • err (SimArray) – The error on the number density, if calculate_err is True.