cylindrical_isolation¶

halotools.mock_observables.
cylindrical_isolation
(sample1, sample2, rp_max, pi_max, period=None, num_threads=1, approx_cell1_size=None, approx_cell2_size=None)[source] [edit on github]¶ Determine whether a set of points,
sample1
, is isolated, i.e. does not have a neighbor insample2
within an user specified cylindrical volume centered at each point insample1
.See also Galaxy Catalog Analysis Example: Identifying isolated galaxies for example usage on a mock galaxy catalog.
Parameters:  sample1 : 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
sample1
andsample2
arguments.Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
 sample2 : array_like
Npts2 x 3 numpy array containing 3D positions of points.
 rp_max : array_like
radius of the cylinder to search for neighbors around galaxies in
sample1
. If a single float is given,rp_max
is assumed to be the same for each galaxy insample1
. You may optionally pass in an array of length Npts1, in which case each point insample1
will have its own individual neighborsearch projected radius.Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
 pi_max : array_like
Halflength of cylinder to search for neighbors around galaxies in
sample1
. If a single float is given,pi_max
is assumed to be the same for each galaxy insample1
. You may optionally pass in an array of length Npts1, in which case each point insample1
will have its own individual neighborsearch cylinder halflength.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.
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
rp_max
/10 in the xydimensions andpi_max
/10 in the zdimension, 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. approx_cell2_size : array_like, optional
Analogous to
approx_cell1_size
, but forsample2
. See comments forapprox_cell1_size
for details.
Returns:  is_isolated : numpy.array
array of booleans indicating if each point in
sample1
is isolated.
Notes
There is one edgecase of all the isolation criteria functions worthy of special mention. Suppose there exists a point p in
sample1
with the exact same spatial coordinates as one or more points insample2
. The matching point(s) insample2
will not be considered neighbors of p.Examples
First we create a randomly distributed set of points
sample1
, together with random zvelocities for those points. We will then placesample1
into redshiftspace using thereturn_xyz_formatted_array
function. We will use thecylindrical_isolation
function to determine which points insample1
have zero neighbors inside a cylinder of radiusrp_max
and halflengthpi_max
.>>> Npts = 1000 >>> Lbox = 250.0 >>> period = Lbox >>> x = np.random.uniform(0, Lbox, Npts) >>> y = np.random.uniform(0, Lbox, Npts) >>> z = np.random.uniform(0, Lbox, Npts) >>> vz = np.random.normal(loc = 0, scale = 100, size = Npts)
We place our points into redshiftspace, formatting the result into the appropriately shaped array used throughout the
mock_observables
subpackage:>>> from halotools.mock_observables import return_xyz_formatted_array >>> sample1 = return_xyz_formatted_array(x, y, z, period = Lbox, velocity = vz, velocity_distortion_dimension='z')
Now we will call
cylindrical_isolation
withsample2
set tosample1
, applying a projected separation cut of 500 kpc/h, and a lineofsight velocity cut of 750 km/s. Note that Halotools assumes h=1 throughout the package, and that all Halotools lengthunits are in Mpc/h.>>> rp_max = 0.5 # 500 kpc/h cut in perpendicular direction
Since h=1 implies \(H_{0} = 100\) km/s/Mpc, our 750 km/s velocity criteria gets transformed into a zdimension length criteria as:
>>> H0 = 100.0 >>> pi_max = 750./H0 >>> is_isolated = cylindrical_isolation(sample1, sample1, rp_max, pi_max, period=period)
In the next example that follows,
sample2
will be a different set of points fromsample1
, so we will determine which points insample1
have a neighbor insample2
located inside a cylinder of radiusrp_max
and halflengthpi_max
.>>> x2 = np.random.uniform(0, Lbox, Npts) >>> y2 = np.random.uniform(0, Lbox, Npts) >>> z2 = np.random.uniform(0, Lbox, Npts) >>> vz2 = np.random.normal(loc = 0, scale = 100, size = Npts) >>> sample2 = return_xyz_formatted_array(x2, y2, z2, period = Lbox, velocity = vz2, velocity_distortion_dimension='z')
>>> is_isolated = cylindrical_isolation(sample1, sample2, rp_max, pi_max, period=period)