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 in sample2 within an user specified cylindrical volume centered at each point in sample1.

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 3-D 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 and sample2 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 3-D 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 in sample1. You may optionally pass in an array of length Npts1, in which case each point in sample1 will have its own individual neighbor-search projected radius.

Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.

pi_max : array_like

Half-length 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 in sample1. You may optionally pass in an array of length Npts1, in which case each point in sample1 will have its own individual neighbor-search cylinder half-length.

Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.

period : array_like, optional

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 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

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 rp_max/10 in the xy-dimensions and pi_max/10 in the z-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_size : array_like, optional

Analogous to approx_cell1_size, but for sample2. See comments for approx_cell1_size for details.

Returns:

is_isolated : numpy.array

array of booleans indicating if each point in sample1 is isolated.

Notes

There is one edge-case 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 in sample2. The matching point(s) in sample2 will not be considered neighbors of p.

Examples

First we create a randomly distributed set of points sample1, together with random z-velocities for those points. We will then place sample1 into redshift-space using the return_xyz_formatted_array function. We will use the cylindrical_isolation function to determine which points in sample1 have zero neighbors inside a cylinder of radius rp_max and half-length pi_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 redshift-space, formatting the result into the appropriately shaped array used throughout the mock_observables sub-package:

>>> 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 with sample2 set to sample1, applying a projected separation cut of 500 kpc/h, and a line-of-sight velocity cut of 750 km/s. Note that Halotools assumes h=1 throughout the package, and that all Halotools length-units 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 z-dimension 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 from sample1, so we will determine which points in sample1 have a neighbor in sample2 located inside a cylinder of radius rp_max and half-length pi_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)