large_scale_density_spherical_volume¶

halotools.mock_observables.
large_scale_density_spherical_volume
(sample, tracers, radius, period=None, sample_volume=None, num_threads=1, approx_cell1_size=None, norm_by_mean_density=False)[source] [edit on github]¶ Calculate the mean density of the input
sample
from an input set of tracer particles using a sphere centered on each point in the inputsample
as the tracer volume.Around each point in the input
sample
, a sphere of the inputradius
is placed and the number of points in the inputtracers
is counted, optionally accounting for box periodicity. Thelarge_scale_density_spherical_volume
function returns the mean number density of tracer particles in each such sphere, optionally normalizing this result by the global mean number density of tracer particles in the entire sample volume.Parameters:  sample : array_like
Npts1 x 3 numpy array containing 3D positions of points. See the Formatting your xyz coordinates for Mock Observables calculations documentation page, or the Examples section below, for instructions on how to transform your coordinate position arrays into the format accepted by the
sample
andtracers
arguments. tracers : array_like
Npts2 x 3 numpy array containing 3D positions of tracers.
 radius : float
Radius of the sphere used to define the volume inside which the number density of tracers is calculated. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
 period : array_like, optional
Length3 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. If set to None (the default option), PBCs are set to infinity, and an input
sample_volume
must be provided. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools. sample_volume : float, optional
If period is set to None, you must specify the effective volume of the sample. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
 num_threads : int, 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_size : array_like, optional
Length3 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 usecases. Performance can vary sensitively with this parameter, so it is highly recommended that you experiment with this parameter when carrying out performancecritical calculations.
 norm_by_mean_density : bool, optional
If set to True, the returned number density will be normalized by the global number density of tracer particles averaged across the entire
sample_volume
. Default is False.
Returns:  number_density : array_like
LengthNpts1 array of number densities
Examples
>>> npts1, npts2 = 100, 200 >>> sample = np.random.random((npts1, 3)) >>> tracers = np.random.random((npts2, 3)) >>> radius = 0.1 >>> result = large_scale_density_spherical_volume(sample, tracers, radius, period=1)