Skip to content

Code to compute the 4-point correllation function binned by distances between and within 2 different pairs of galaxies

Notifications You must be signed in to change notification settings

misharash/s4PCF

Repository files navigation

s4PCF - code to compute the 4-point correllation function (4PCF) binned by distances between 2 different pairs of galaxies

Currently consists of two different executables:

  • s4PCF in main directory - counts quadruplets (also pairs and triplets) in bins. Based on encore by Oliver Philcox. run_npcf.py script (modernized version of run_npcf.csh) combines data and random catalogs, invokes the C++ code to count quadruplets, and divides counts to get 4,2,3-point correlation functions.
  • gs4PCF in gaussian_s4PCF subdirectory - randomly throws quadruplets from random catalog and averages the disconnected/Gaussian contribution to 4PCF. Based on RascalC by Oliver Philcox, comes with a bunch of useful python scripts.

Their better integration is work in progress.

Binning

Quadruplets of galaxies A, B, C, D (or $i$, $j$, $k$, $l$) are binned by lengths of AB, AC, BD ($r_{ij}$, $r_{ik}$, $r_{jl}$) sides (isotropically), in contrast with AB, AC, AD ($r_{ij}$, $r_{ik}$, $r_{il}$) in encore (which also uses higher order multipoles). The aim is to isolate two close pairs better.

AB ($r_{ij}$) is binned differently from two others, NBIN_LONG bins are uniformly spaced between rmin_long and rmax_long.

AC and BD ($r_{ik}$ and $r_{jl}$) are binned in the same way, NBIN_SHORT bins are uniformly spaced between rmin_short and rmax_short. BD ($r_{jl}$) bin number is more or equal than AC ($r_{ik}$) bin number, i.e. equal bins are included, and all bins can be recovered by symmetry.

s4PCF produces anisotropic 2-point correlation function in NBIN_CF radial bins between rmin_cf anf rmax_cf and in MBIN_CF mu (abs(cos(theta))) bins between 0 and 1, which can serve as input to gs4PCF. It also outputs isotropic 2- and 3-point correlation functions in NBIN_SHORT bins uniformly spaced between rmin_short and rmax_short, as a by-product.

Self-counting and other concerns

If rmin_long < 2 * rmax_short, a triple loop is activated to exclude self-counting triangles (C=D or $k=l$), while everything else is done in double loops (much faster, but often still slow).

Additionally, when rmin_long < rmax_short other possibilities arise: A=D ($i=l$) or/and B=C ($j=k$), although these can be excluded using only a double loop.

Both codes now have an option (PREVENT_TRIANGLES in s4PCF and prevent_triangles in gs4PCF, set in gaussian_s4PCF/modules/parameters.h) to exclude bins that allow triangular configurations (AC+BD>AB, $r_{ik}+r_{jl}&gt;r_{ij}$) and thus skip all the self-counting exclusion, although the results then may be tricky to read and interpret.

You might want to set rmin_long >= 3 * rmax_short, because then it is guaranteed that AC and BD ($r_{ik}$ and $r_{jl}$) are the shortest distances, and no self-counting issues will appear.