gi_plus_projected¶
- halotools.mock_observables.gi_plus_projected(sample1, orientations1, ellipticities1, sample2, rp_bins, pi_max, randoms1=None, randoms2=None, weights1=None, weights2=None, ran_weights1=None, ran_weights2=None, estimator='Landy-Szalay', period=None, num_threads=1, approx_cell1_size=None, approx_cell2_size=None)[source]¶
Calculate the projected gravitational shear-intrinsic ellipticity correlation function (GI), \(w_{g+}(r_p)\), where \(r_p\) is the separation perpendicular to the line-of-sight (LOS) between two galaxies. See the ‘Notes’ section for details of this calculation.
The first two dimensions define the plane for perpendicular distances. The third dimension is used for parallel distances, i.e. x,y positions are on the plane of the sky, and z is the redshift coordinate. This is the ‘distant observer’ approximation.
Note in particular that the
gi_plus_projected
function does not accept angular coordinates for the inputsample1
orsample2
.- Parameters:
- sample1array_like
Npts1 x 3 numpy array containing 3-D positions of points with associated orientations and ellipticities. 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.- orientations1array_like
Npts1 x 2 numpy array containing projected orientation vectors for each point in
sample1
. these will be normalized if not already.- ellipticities1: array_like
Npts1 x 1 numpy array containing ellipticities for each point in
sample1
.- sample2array_like, optional
Npts2 x 3 array containing 3-D positions of points.
- rp_binsarray_like
array of boundaries defining the radial bins perpendicular to the LOS in which pairs are counted. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
- pi_maxfloat
maximum LOS distance defining the projection integral length-scale in the z-dimension. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
- randoms1array_like, optional
Nran1 x 3 array containing 3-D positions of randomly distributed points corresponding to
sample1
. If no randoms are provided (the default option), the calculation can proceed using analytical randoms (only valid for periodic boundary conditions).- randoms2array_like, optional
Nran2 x 3 array containing 3-D positions of randomly distributed points corresponding to
sample2
. If no randoms are provided (the default option), the calculation can proceed using analytical randoms (only valid for periodic boundary conditions).- weights1array_like, optional
Npts1 array of weghts. If this parameter is not specified, it is set to numpy.ones(Npts1).
- weights2array_like, optional
Npts2 array of weghts. If this parameter is not specified, it is set to numpy.ones(Npts2).
- ran_weights1array_like, optional
Npran1 array of weghts. If this parameter is not specified, it is set to numpy.ones(Nran1).
- ran_weights2array_like, optional
Nran2 array of weghts. If this parameter is not specified, it is set to numpy.ones(Nran2).
- estimatorstring, optional
string indicating which estimator to use
- periodarray_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. If set to None (the default option), PBCs are set to infinity, in which case
randoms
must be provided. Length units are comoving and 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:
- correlation_functionnumpy.array
len(rp_bins)-1 length array containing the correlation function \(w_{g+}(r_p)\) computed in each of the bins defined by input
rp_bins
.
Notes
The projected GI-correlation function is calculated as:
\[w_{g+}(r_p) = 2 \int_0^{\pi_{\rm max}} \xi_{g+}(r_p, \pi) \mathrm{d}\pi\]If the Landy-Szalay estimator is indicated, the correlation function is estimated as:
\[ \begin{align}\begin{aligned}\xi_{g+}(r_p, \pi) = \frac{S_{+}D-S_{+}R}{R_sR}\\where\end{aligned}\end{align} \]\[S_{+}D = \sum_{i \neq j} w_jw_i e_{+}(j|i)\]\(w_j\) and \(w_j\) are weights. Weights are set to 1 for all galaxies by default. The alingment of the \(j\)-th galaxy relative to the direction to the \(i\)-th galaxy is given by:
\[e_{+}(j|i) = e_j\cos(2\phi)\]where \(e_j\) is the ellipticity of the \(j\)-th galaxy. \(\phi\) is the angle between the orientation vector, \(\vec{o}_j\), and the projected direction between the \(j\)-th and \(i\)-th galaxy, \(\vec{r}_{p i,j}\).
\[\cos(\phi) = \vec{o}_j \cdot \vec{r}_{p i,j}\]\(S_{+}R\) is analgous to \(S_{+}D\) but instead is computed with respect to a “random” catalog of galaxies. \(R_sR\) are random pair counts, where \(R_s\) corresponds to the shapes sample, i.e. the sample with orienttions and ellipticies,
sample1
, and R correspoinds tosample2
.Examples
For demonstration purposes we create a randomly distributed set of points within a periodic cube of Lbox = 250 Mpc/h.
>>> Npts = 1000 >>> Lbox = 250
>>> x = np.random.uniform(0, Lbox, Npts) >>> y = np.random.uniform(0, Lbox, Npts) >>> z = np.random.uniform(0, Lbox, Npts)
We transform our x, y, z points into the array shape used by the pair-counter by taking the transpose of the result of
numpy.vstack
. This boilerplate transformation is used throughout themock_observables
sub-package:>>> sample1 = np.vstack((x,y,z)).T
Alternatively, you may use the
return_xyz_formatted_array
convenience function for this same purpose, which provides additional wrapper behavior aroundnumpy.vstack
such as placing points into redshift-space.We then create a set of random orientation vectors and ellipticities for each point
>>> random_orientations = np.random.random((Npts,2)) >>> random_ellipticities = np.random.random(Npts)
We can the calculate the projected auto-GI correlation between these points:
>>> rp_bins = np.logspace(-1,1,10) >>> pi_max = 0.25 >>> w = gi_plus_projected(sample1, random_orientations, random_ellipticities, sample1, rp_bins, pi_max, period=Lbox)