total_mass_enclosed_per_cylinder¶
- halotools.mock_observables.total_mass_enclosed_per_cylinder(centers, particles, particle_masses, downsampling_factor, rp_bins, period, num_threads=1, approx_cell1_size=None, approx_cell2_size=None)[source]¶
Calculate the total mass enclosed in a set of cylinders of infinite length.
- Parameters:
- centersarray_like
Numpy array of shape (num_cyl, 3) containing 3-d positions of galaxies. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
See the Formatting your xyz coordinates for Mock Observables calculations documentation page for instructions on how to transform your coordinate position arrays into the format accepted by the
galaxies
andparticles
arguments.- particlesarray_like
Numpy array of shape (num_ptcl, 3) containing 3-d positions of particles.
Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
- particle_massesarray_like
Float or array of shape (num_ptcl, ) storing the mass of each particle in units of Msun with h=1 units. If every particle has the same mass (i.e., if your simulation is DM-only), you can pass in a single float.
- downsampling_factorfloat
Factor by which the particles have been randomly downsampled. Should be unity if all simulation particles have been chosen.
- rp_binsarray_like
Numpy array of shape (num_rbins+1, ) of projected radial boundaries defining the bins in which the result is calculated.
Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
- periodarray_like
Length-3 sequence defining the periodic boundary conditions in each dimension. If you instead provide a single scalar, Lbox, period is assumed to be the same in all Cartesian directions. Length units are assumed to be in Mpc/h, here and throughout Halotools.
- num_threadsint, optional
Number of threads to use in calculation, where parallelization is performed using the python
multiprocessing
module. Default is 1 for a purely serial calculation, in which case a multiprocessing Pool object will never be instantiated. A string ‘max’ may be used to indicate that the pair counters should use all available cores on the machine.- approx_cell1_sizearray_like, optional
Length-3 array serving as a guess for the optimal manner by how points will be apportioned into subvolumes of the simulation box. The optimum choice unavoidably depends on the specs of your machine. Default choice is to use Lbox/10 in each dimension, which will return reasonable result performance for most use-cases. Performance can vary sensitively with this parameter, so it is highly recommended that you experiment with this parameter when carrying out performance-critical calculations.
- approx_cell2_sizearray_like, optional
Analogous to
approx_cell1_size
, but for sample2. See comments forapprox_cell1_size
for details.
- Returns:
- total_mass_enclosedarray_like
Numpy array of shape (num_cyl, num_rbins) storing the sum of all particle masses enclosed in each of the input cylinders.
Examples
>>> period = 100. >>> num_cyl, num_ptcl = 100, 1000 >>> centers = np.random.random((num_cyl, 3))*period >>> particles = np.random.random((num_ptcl, 3))*period >>> masses = np.random.rand(num_ptcl) >>> downsampling_factor = 1. >>> rp_bins = np.logspace(-1, 1, 15) >>> mass_encl = total_mass_enclosed_per_cylinder(centers, particles, masses, downsampling_factor, rp_bins, period)
The mass enclosed in cylinder i with radius j is given by:
>>> ith_cylinder_jth_radius_mass = mass_encl[i, j]