# Which correlation function to use?¶

Corrfunc has a variety of correlation functions to cover a broad range of Science applications. The basic distinction occurs if the input particles are directly from a simulation or from an observational survey (or equivalently, a simulation that has been processed to look like a survey). For simulation data, referred throughout as theory, the assumption is that the particle positions are Cartesian, co-moving XYZ. For survey data, referred throughout as mocks, the assumption is that particle positions are Right Ascension (0 – 360 deg), Declination (-90 – 90 deg) and CZ (speed of light multiplied by the redshift). Depending on the exact type of data, and the desired correlation function you want, the following table should help you figure out which code you should use.

Input Data Periodic Particle domain Desired correlation function Returns Python code
X, Y, Z True Cube (box) wp($$r_p$$) 2-D Projected Correlation Corrfunc.theory.wp
$$\xi(r)$$ 3-D Real-space Correlation Corrfunc.theory.xi
X, Y, Z True or False Arbitrary $$\xi(r)$$ Pair-counts in 3-D real-space Corrfunc.theory.DD
$$\xi(r_p, \pi)$$ Pair-counts in 2-D Corrfunc.theory.DDrppi
$$\xi(s, \mu)$$ Pair-counts in 2-D Corrfunc.theory.DDsmu
ra, dec, cz False Arbitrary $$\xi(r_p, \pi)$$ Pair-counts in 2-D Corrfunc.mocks.DDrppi_mocks
$$\xi(s, \mu)$$ Pair-counts in 2-D Corrfunc.mocks.DDsmu_mocks
ra, dec False Arbitrary $$\omega(\theta)$$ Pair-counts in angular space Corrfunc.mocks.DDtheta_mocks

In all cases where only pair-counts are returned (e.g., all of the mocks routines), you will need to compute at least an additional RR term. Please see Corrfunc.utils.convert_3d_counts_to_cf to convert 3-D pair-counts (or angular pair counts) into a correlation function. For 2-D pair-counts, please use Corrfunc.utils.convert_rp_pi_counts_to_wp to convert into a projected correlation function. If you want to compute the $$\xi(r_p, \pi)$$ from the 2-D pair-counts, then simply call Corrfunc.utils.convert_3d_counts_to_cf with the arrays.

Also, see Using the command-line interface in Corrfunc for a detailed list of the clustering statistics and the various available API interfaces.